Method addMainAttributes
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addMainAttributes(FacadeInterface $facade, NodeInterface $node)
{
if ($site = $this->siteRepository->findOneBySiteId($node->getSiteId())) {
$facade->templateSet = $site->getTemplateSet();
}
- Create a ticketCreate a ticket
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
$facadeClass,
EncryptionManager $encrypter,
SiteRepositoryInterface $siteRepository,
StatusRepositoryInterface $statusRepository,
EventDispatcherInterface $eventDispatcher,
- Create a ticketCreate a ticket
Function addPreviewLinks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function addPreviewLinks(FacadeInterface $facade, NodeInterface $node)
{
if ($this->hasGroup(CMSGroupContext::PREVIEW) && $site = $this->siteRepository->findOneBySiteId($node->getSiteId())) {
/** @var SiteAliasInterface $alias */
$encryptedId = $this->encrypter->encrypt($node->getId());
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The class NodeTransformer has a coupling between objects value of 18. Consider to reduce the number of dependencies under 13. Open
class NodeTransformer extends AbstractSecurityCheckerAwareTransformer
{
protected $encrypter;
protected $siteRepository;
protected $statusRepository;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Avoid assigning values to variables in if clauses and the like (line '179', column '58'). Open
protected function addPreviewLinks(FacadeInterface $facade, NodeInterface $node)
{
if ($this->hasGroup(CMSGroupContext::PREVIEW) && $site = $this->siteRepository->findOneBySiteId($node->getSiteId())) {
/** @var SiteAliasInterface $alias */
$encryptedId = $this->encrypter->encrypt($node->getId());
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid assigning values to variables in if clauses and the like (line '99', column '13'). Open
protected function addMainAttributes(FacadeInterface $facade, NodeInterface $node)
{
if ($site = $this->siteRepository->findOneBySiteId($node->getSiteId())) {
$facade->templateSet = $site->getTemplateSet();
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid unused parameters such as '$params'. Open
public function transform($node, array $params = array())
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Parameter $siteRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\SiteRepositoryInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
@throws type of transform
has undeclared type \OpenOrchestra\BaseApi\Exceptions\TransformerParameterTypeException
Open
public function transform($node, array $params = array())
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property nodeType
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->nodeType = $node->getNodeType();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property deleted
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->deleted = $node->isDeleted();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getMetaDescription
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->metaDescription = $node->getMetaDescription();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $encrypter
has undeclared type \OpenOrchestra\BaseBundle\Manager\EncryptionManager
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
if ($site = $this->siteRepository->findOneBySiteId($node->getSiteId())) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method addRight
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->addRight('can_read', $this->authorizationChecker->isGranted(ContributionActionInterface::READ, $node));
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
if ($this->hasGroup(CMSGroupContext::PREVIEW) && $site = $this->siteRepository->findOneBySiteId($node->getSiteId())) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $eventDispatcher
has undeclared type \Symfony\Component\EventDispatcher\EventDispatcherInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \OpenOrchestra\BaseApi\Exceptions\TransformerParameterTypeException
Open
throw new TransformerParameterTypeException();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->siteId = $node->getSiteId();
- Create a ticketCreate a ticket
- Exclude checks
Call to method isDeleted
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->deleted = $node->isDeleted();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getUpdatedBy
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->updatedBy = $node->getUpdatedBy();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property createdAt
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->createdAt = $node->getCreatedAt();
- Create a ticketCreate a ticket
- Exclude checks
Call to method addRight
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->addRight('can_edit_data', $this->businessRulesManager->isGranted(BusinessActionInterface::EDIT, $node) && $this->authorizationChecker->isGranted(ContributionActionInterface::EDIT, $node));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\NodeTransformer::getContext
Open
$facade->setAreas($this->getContext()->transform('area', $area), $key);
- Create a ticketCreate a ticket
- Exclude checks
Call to method getScheme
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteAliasInterface
Open
$scheme = $alias->getScheme();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property status
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
null !== $facade->status &&
- Create a ticketCreate a ticket
- Exclude checks
Parameter $authorizationChecker
has undeclared type \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method getParentId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->parentId = $node->getParentId();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property language
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->language = $node->getLanguage();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property updatedBy
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->updatedBy = $node->getUpdatedBy();
- Create a ticketCreate a ticket
- Exclude checks
Call to method addRight
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->addRight('can_publish_node', $this->businessRulesManager->isGranted(NodeStrategy::CHANGE_TO_PUBLISH_STATUS, $node));
- Create a ticketCreate a ticket
- Exclude checks
Call to method getId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->id = $node->getId();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getMetaFollow
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->metaFollow = $node->getMetaFollow();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getUpdatedAt
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->updatedAt = $node->getUpdatedAt();
- Create a ticketCreate a ticket
- Exclude checks
Call to method addRight
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->addRight('can_delete', $this->authorizationChecker->isGranted(ContributionActionInterface::DELETE, $node) && $this->businessRulesManager->isGranted(NodeStrategy::DELETE_VERSION, $node));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\NodeTransformer::hasGroup
Open
if ($this->hasGroup(CMSGroupContext::AUTHORIZATIONS)) {
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\ApiBundle\Transformer\NodeTransformer->authorizationChecker
Open
$facade->addRight('can_edit', $this->authorizationChecker->isGranted(ContributionActionInterface::EDIT, $node));
- Create a ticketCreate a ticket
- Exclude checks
Call to method setAreas
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->setAreas($this->getContext()->transform('area', $area), $key);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\NodeTransformer::getContext
Open
$facade->status = $this->getContext()->transform('status', $node->getStatus());
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property id
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
return $this->nodeRepository->find($facade->id);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
public function transform($node, array $params = array())
- Create a ticketCreate a ticket
- Exclude checks
Return type of addMainAttributes()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
protected function addMainAttributes(FacadeInterface $facade, NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getTemplate
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->template = $node->getTemplate();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getPath
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->path = $node->getPath();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getCreatedAt
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->createdAt = $node->getCreatedAt();
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\ApiBundle\Transformer\NodeTransformer->authorizationChecker
Open
$facade->addRight('can_edit_data', $this->businessRulesManager->isGranted(BusinessActionInterface::EDIT, $node) && $this->authorizationChecker->isGranted(ContributionActionInterface::EDIT, $node));
- Create a ticketCreate a ticket
- Exclude checks
Call to method getStatus
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->status = $this->getContext()->transform('status', $node->getStatus());
- Create a ticketCreate a ticket
- Exclude checks
Parameter $facade
has undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
public function reverseTransform(FacadeInterface $facade, array $params = array())
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
protected function addMainAttributes(FacadeInterface $facade, NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property createdBy
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->createdBy = $node->getCreatedBy();
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\ApiBundle\Transformer\NodeTransformer->authorizationChecker
Open
$facade->addRight('can_read', $this->authorizationChecker->isGranted(ContributionActionInterface::READ, $node));
- Create a ticketCreate a ticket
- Exclude checks
Call to method findOneBySiteId
from undeclared class \OpenOrchestra\ModelInterface\Repository\SiteRepositoryInterface
Open
if ($this->hasGroup(CMSGroupContext::PREVIEW) && $site = $this->siteRepository->findOneBySiteId($node->getSiteId())) {
- Create a ticketCreate a ticket
- Exclude checks
Return type of getPreviewLink()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
protected function getPreviewLink($scheme, $alias, $encryptedId, $aliasId)
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant SCHEME_DEFAULT
from undeclared class \OpenOrchestra\ModelInterface\Model\SchemeableInterface
Open
if (is_null($scheme) || SchemeableInterface::SCHEME_DEFAULT == $scheme) {
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \OpenOrchestra\BaseApi\Transformer\AbstractSecurityCheckerAwareTransformer
Open
class NodeTransformer extends AbstractSecurityCheckerAwareTransformer
- Create a ticketCreate a ticket
- Exclude checks
Parameter $facade
has undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
protected function addMainAttributes(FacadeInterface $facade, NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property nodeId
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->nodeId = $node->getNodeId();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property parentId
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->parentId = $node->getParentId();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property routePattern
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->routePattern = $node->getRoutePattern();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getVersion
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->version = $node->getVersion();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property updatedAt
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->updatedAt = $node->getUpdatedAt();
- Create a ticketCreate a ticket
- Exclude checks
Return type of addAreas()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
protected function addAreas(FacadeInterface $facade, NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Call to method addPreviewLink
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->addPreviewLink(
- Create a ticketCreate a ticket
- Exclude checks
Reference to constant ABSOLUTE_PATH
from undeclared class \Symfony\Component\Routing\Generator\UrlGeneratorInterface
Open
$previewLink['link'] = $domain . $this->generateRoute($routeName, $parameters, UrlGeneratorInterface::ABSOLUTE_PATH);
- Create a ticketCreate a ticket
- Exclude checks
Call to method find
from undeclared class \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open
$status = $this->statusRepository->find($facade->status->id);
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property metaDescription
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->metaDescription = $node->getMetaDescription();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getMetaIndex
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->metaIndex = $node->getMetaIndex();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
protected function addStatus(FacadeInterface $facade, NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getDomain
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteAliasInterface
Open
$domain = $scheme . '://' . $alias->getDomain();
- Create a ticketCreate a ticket
- Exclude checks
Return type of transform()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
public function transform($node, array $params = array())
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property siteId
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->siteId = $node->getSiteId();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getAreas
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
foreach ($node->getAreas() as $key => $area) {
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\NodeTransformer::getContext
Open
return $this->getContext()->transform('link', $previewLink);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $facade
has undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
protected function addPreviewLinks(FacadeInterface $facade, NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property status
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$params['source']->getStatus()->getId() !== $facade->status->id
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
if (!$node instanceof NodeInterface) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->language = $node->getLanguage();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getVersionName
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->versionName = $node->getVersionName();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property versionName
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->versionName = $node->getVersionName();
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared property \OpenOrchestra\ApiBundle\Transformer\NodeTransformer->authorizationChecker
Open
$facade->addRight('can_delete', $this->authorizationChecker->isGranted(ContributionActionInterface::DELETE, $node) && $this->businessRulesManager->isGranted(NodeStrategy::DELETE_VERSION, $node));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\NodeTransformer::hasGroup
Open
if ($this->hasGroup(CMSGroupContext::AREAS)) {
- Create a ticketCreate a ticket
- Exclude checks
Return type of addStatus()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
protected function addStatus(FacadeInterface $facade, NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
protected function addPreviewLinks(FacadeInterface $facade, NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getScheme
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$this->getPreviewLink($node->getScheme(), $alias, $encryptedId, $aliasId)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\NodeTransformer::hasGroup
Open
if ($this->hasGroup(CMSGroupContext::STATUS)) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
if ($alias->getLanguage() == $node->getLanguage()) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $alias
has undeclared type \OpenOrchestra\ModelInterface\Model\SiteAliasInterface
Open
protected function getPreviewLink($scheme, $alias, $encryptedId, $aliasId)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getDomain
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteAliasInterface
Open
'name' => $alias->getDomain(),
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\NodeTransformer::generateRoute
Open
$previewLink['link'] = $domain . $this->generateRoute($routeName, $parameters, UrlGeneratorInterface::ABSOLUTE_PATH);
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property status
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$status = $this->statusRepository->find($facade->status->id);
- Create a ticketCreate a ticket
- Exclude checks
Call to method find
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
return $this->nodeRepository->find($facade->id);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $nodeRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\NodeTransformer::newFacade
Open
$facade = $this->newFacade();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property path
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->path = $node->getPath();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getRoutePattern
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->routePattern = $node->getRoutePattern();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property metaFollow
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->metaFollow = $node->getMetaFollow();
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\NodeTransformer::hasGroup
Open
if ($this->hasGroup(CMSGroupContext::AUTHORIZATIONS_DELETE_VERSION)) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method addRight
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->addRight('can_edit', $this->authorizationChecker->isGranted(ContributionActionInterface::EDIT, $node));
- Create a ticketCreate a ticket
- Exclude checks
Parameter $facade
has undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
protected function addAreas(FacadeInterface $facade, NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property status
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->status = $this->getContext()->transform('status', $node->getStatus());
- Create a ticketCreate a ticket
- Exclude checks
@throws annotation of reverseTransform
has suspicious class type \OpenOrchestra\ApiBundle\Exceptions\HttpException\StatusChangeNotGrantedHttpException,
which does not extend Error/Exception Open
public function reverseTransform(FacadeInterface $facade, array $params = array())
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property id
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
if (null !== $facade->id) {
- Create a ticketCreate a ticket
- Exclude checks
Reference to undeclared class \OpenOrchestra\BaseApi\Transformer\AbstractSecurityCheckerAwareTransformer
Open
parent::__construct($facadeClass, $authorizationChecker);
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property templateSet
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->templateSet = $site->getTemplateSet();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
protected function addAreas(FacadeInterface $facade, NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Call to method encrypt
from undeclared class \OpenOrchestra\BaseBundle\Manager\EncryptionManager
Open
$encryptedId = $this->encrypter->encrypt($node->getId());
- Create a ticketCreate a ticket
- Exclude checks
Parameter $statusRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method getNodeId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->nodeId = $node->getNodeId();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getNodeType
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->nodeType = $node->getNodeType();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property metaIndex
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->metaIndex = $node->getMetaIndex();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getCreatedBy
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->createdBy = $node->getCreatedBy();
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\NodeTransformer::hasGroup
Open
if ($this->hasGroup(CMSGroupContext::AUTHORIZATIONS_CHANGE_STATUS)) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $facade
has undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
protected function addStatus(FacadeInterface $facade, NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Return type of addPreviewLinks()
is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
protected function addPreviewLinks(FacadeInterface $facade, NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Call to method findOneBySiteId
from undeclared class \OpenOrchestra\ModelInterface\Repository\SiteRepositoryInterface
Open
if ($site = $this->siteRepository->findOneBySiteId($node->getSiteId())) {
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property id
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->id = $node->getId();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getName
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$facade->name = $node->getName();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property name
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->name = $node->getName();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property template
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->template = $node->getTemplate();
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property version
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
$facade->version = $node->getVersion();
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\NodeTransformer::hasGroup
Open
if ($this->hasGroup(CMSGroupContext::PREVIEW) && $site = $this->siteRepository->findOneBySiteId($node->getSiteId())) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$encryptedId = $this->encrypter->encrypt($node->getId());
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$params['source'] instanceof NodeInterface &&
- Create a ticketCreate a ticket
- Exclude checks
Reference to instance property status
from undeclared class \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open
null !== $facade->status->id &&
- Create a ticketCreate a ticket
- Exclude checks
Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\StatusInterface
Open
if ($status instanceof StatusInterface) {
- Create a ticketCreate a ticket
- Exclude checks
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (array_key_exists('source', $params) &&
$params['source'] instanceof NodeInterface &&
null !== $facade->status &&
null !== $facade->status->id &&
$params['source']->getStatus()->getId() !== $facade->status->id
- Read upRead up
- Create a ticketCreate a ticket
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 120.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Line exceeds 120 characters; contains 125 characters Open
$previewLink['link'] = $domain . $this->generateRoute($routeName, $parameters, UrlGeneratorInterface::ABSOLUTE_PATH);
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$facade->addRight('can_read', $this->authorizationChecker->isGranted(ContributionActionInterface::READ, $node));
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
if ($this->hasGroup(CMSGroupContext::PREVIEW) && $site = $this->siteRepository->findOneBySiteId($node->getSiteId())) {
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
$facade->addRight('can_publish_node', $this->businessRulesManager->isGranted(NodeStrategy::CHANGE_TO_PUBLISH_STATUS, $node));
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 209 characters Open
$facade->addRight('can_edit_data', $this->businessRulesManager->isGranted(BusinessActionInterface::EDIT, $node) && $this->authorizationChecker->isGranted(ContributionActionInterface::EDIT, $node));
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$facade->addRight('can_edit', $this->authorizationChecker->isGranted(ContributionActionInterface::EDIT, $node));
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 207 characters Open
$facade->addRight('can_delete', $this->authorizationChecker->isGranted(ContributionActionInterface::DELETE, $node) && $this->businessRulesManager->isGranted(NodeStrategy::DELETE_VERSION, $node));
- Create a ticketCreate a ticket
- Exclude checks