Function generateRoutesForNode
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function generateRoutesForNode(NodeInterface $node, ReadSiteInterface $site, array $routePattern)
{
$routes = array();
if (!$node instanceof NodeInterface) {
- 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
Method generateRoutesForRedirection
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateRoutesForRedirection(RedirectionInterface $redirection, ReadSiteInterface $site)
{
$routes = array();
$node = $this->getNodeForRedirection($redirection);
- Create a ticketCreate a ticket
Method generateRoutesForNode
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateRoutesForNode(NodeInterface $node, ReadSiteInterface $site, array $routePattern)
{
$routes = array();
if (!$node instanceof NodeInterface) {
- Create a ticketCreate a ticket
Function generateRoutesForRedirection
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function generateRoutesForRedirection(RedirectionInterface $redirection, ReadSiteInterface $site)
{
$routes = array();
$node = $this->getNodeForRedirection($redirection);
- 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
Method completeRoutePattern
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function completeRoutePattern($parentId = null, $suffix = null, $language, $siteId, array $routePattern)
- Create a ticketCreate a ticket
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$routeDocumentClass,
SiteRepositoryInterface $siteRepository,
NodeRepositoryInterface $nodeRepository,
RedirectionRepositoryInterface $redirectionRepository,
RouteDocumentRepositoryInterface $routeDocumentRepository
- Create a ticketCreate a ticket
The method generateRoutesForRedirection uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$paramValue = $redirection->getUrl();
}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Possibly zero references to use statement for classlike/namespace RouteDocumentInterface
(\OpenOrchestra\ModelInterface\Model\RouteDocumentInterface)
Open
use OpenOrchestra\ModelInterface\Model\RouteDocumentInterface;
- Create a ticketCreate a ticket
- Exclude checks
Parameter $site
has undeclared type \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
public function createForSite(SiteInterface $site)
- Create a ticketCreate a ticket
- Exclude checks
Call to method findPublishedByPathAndLanguage
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
$nodes = $this->nodeRepository->findPublishedByPathAndLanguage($node->getPath(), $site->getSiteId(), $node->getLanguage());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getPath
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$nodes = $this->nodeRepository->findPublishedByPathAndLanguage($node->getPath(), $site->getSiteId(), $node->getLanguage());
- Create a ticketCreate a ticket
- Exclude checks
Parameter $siteRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\SiteRepositoryInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
$nodes = $this->nodeRepository->findPublishedByLanguageAndSiteId($language, $site->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
$routePattern = $this->nodeRepository->findAllRoutePattern($language, $site->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Argument 2 (site)
is \OpenOrchestra\ModelInterface\Model\SiteInterface
but \OpenOrchestra\Backoffice\Manager\RouteDocumentManager::generateRoutesForNode()
takes \OpenOrchestra\ModelInterface\Model\ReadSiteInterface
defined at /code/Backoffice/Manager/RouteDocumentManager.php:221
Open
$routes = array_merge($this->generateRoutesForNode($node, $site, $routePattern), $routes);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
public function createForNode(NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
$this->routeDocumentRepository->removeBySiteId($site->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Argument 2 (site)
is \OpenOrchestra\ModelInterface\Model\SiteInterface
but \OpenOrchestra\Backoffice\Manager\RouteDocumentManager::generateRoutesForRedirection()
takes \OpenOrchestra\ModelInterface\Model\ReadSiteInterface
defined at /code/Backoffice/Manager/RouteDocumentManager.php:265
Open
$routes = array_merge($this->generateRoutesForRedirection($redirection, $site), $routes);
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLanguages
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
$siteLanguages = $site->getLanguages();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $routeDocumentRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\RouteDocumentRepositoryInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Call to method findPublishedByLanguageAndSiteId
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
$nodes = $this->nodeRepository->findPublishedByLanguageAndSiteId($language, $site->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Parameter $redirectionRepository
has undeclared type \OpenOrchestra\ModelInterface\Repository\RedirectionRepositoryInterface
Open
public function __construct(
- Create a ticketCreate a ticket
- Exclude checks
Parameter $site
has undeclared type \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
public function clearForSite(SiteInterface $site)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$nodes = $this->nodeRepository->findPublishedByPathAndLanguage($node->getPath(), $site->getSiteId(), $node->getLanguage());
- Create a ticketCreate a ticket
- Exclude checks
Call to method findAllRoutePattern
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
$routePattern = $this->nodeRepository->findAllRoutePattern($node->getLanguage(), $site->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method findBySiteId
from undeclared class \OpenOrchestra\ModelInterface\Repository\RedirectionRepositoryInterface
Open
$listRedirection = $this->redirectionRepository->findBySiteId($site->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open
$listRedirection = $this->redirectionRepository->findBySiteId($site->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method findAllRoutePattern
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
$routePattern = $this->nodeRepository->findAllRoutePattern($language, $site->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getId
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
$this->routeDocumentRepository->removeByRedirectionId($redirection->getId());
- 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
Call to method findOneBySiteId
from undeclared class \OpenOrchestra\ModelInterface\Repository\SiteRepositoryInterface
Open
$site = $this->siteRepository->findOneBySiteId($node->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Parameter $redirection
has undeclared type \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
public function createOrUpdateForRedirection(RedirectionInterface $redirection)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$this->routeDocumentRepository->removeByNodeIdsSiteIdAndLanguage($nodeIds, $node->getSiteId(), $node->getLanguage());
- Create a ticketCreate a ticket
- Exclude checks
Parameter $redirection
has undeclared type \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
protected function getNodeForRedirection(RedirectionInterface $redirection)
- Create a ticketCreate a ticket
- Exclude checks
Possibly zero references to use statement for classlike/namespace SiteAliasInterface
(\OpenOrchestra\ModelInterface\Model\SiteAliasInterface)
Open
use OpenOrchestra\ModelInterface\Model\SiteAliasInterface;
- 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 method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$site = $this->siteRepository->findOneBySiteId($node->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$routePattern = $this->nodeRepository->findAllRoutePattern($node->getLanguage(), $site->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Return type of clearForNode()
is undeclared type \Doctrine\Common\Collections\Collection
Open
public function clearForNode(NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Call to method findNodeIdByIncludedPathSiteIdAndLanguage
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
$nodeIds = $this->nodeRepository->findNodeIdByIncludedPathSiteIdAndLanguage(
- Create a ticketCreate a ticket
- Exclude checks
Call to method removeByNodeIdsSiteIdAndLanguage
from undeclared class \OpenOrchestra\ModelInterface\Repository\RouteDocumentRepositoryInterface
Open
$this->routeDocumentRepository->removeByNodeIdsSiteIdAndLanguage($nodeIds, $node->getSiteId(), $node->getLanguage());
- Create a ticketCreate a ticket
- Exclude checks
Return type of getNodeForRedirection()
is undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
protected function getNodeForRedirection(RedirectionInterface $redirection)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getNodeId
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
if (is_null($redirection->getNodeId())) {
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
protected function generateRoutesForNode(NodeInterface $node, ReadSiteInterface $site, array $routePattern)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
$site = $this->siteRepository->findOneBySiteId($redirection->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Required argument follows optional Open
protected function completeRoutePattern($parentId = null, $suffix = null, $language, $siteId, array $routePattern)
- 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 removeBySiteId
from undeclared class \OpenOrchestra\ModelInterface\Repository\RouteDocumentRepositoryInterface
Open
$this->routeDocumentRepository->removeBySiteId($site->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Parameter $node
has undeclared type \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
public function clearForNode(NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getRoutePattern
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
$route->setPattern($redirection->getRoutePattern());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getPath
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$node->getPath(),
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\ReadSiteInterface
Open
$pattern = $this->completeRoutePattern($node->getParentId(), $node->getRoutePattern(), $node->getLanguage(), $site->getSiteId(), $routePattern);
- Create a ticketCreate a ticket
- Exclude checks
Call to method getAliases
from undeclared class \OpenOrchestra\ModelInterface\Model\ReadSiteInterface
Open
foreach ($site->getAliases() as $key => $alias) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getScheme
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$scheme = $node->getScheme();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\ReadSiteInterface
Open
$route->setSiteId($site->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Parameter $site
has undeclared type \OpenOrchestra\ModelInterface\Model\ReadSiteInterface
Open
protected function generateRoutesForRedirection(RedirectionInterface $redirection, ReadSiteInterface $site)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getId
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
$route->setName($key . '_' . $redirection->getId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getUrl
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
$paramValue = $redirection->getUrl();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$this->routeDocumentRepository->removeByNodeIdsSiteIdAndLanguage($nodeIds, $node->getSiteId(), $node->getLanguage());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getNodeId
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
$redirection->getNodeId(),
- 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
Call to method getLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$route->setLanguage($node->getLanguage());
- Create a ticketCreate a ticket
- Exclude checks
Call to method isPermanent
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
'permanent' => $redirection->isPermanent()
- Create a ticketCreate a ticket
- Exclude checks
Call to method findOneBySiteId
from undeclared class \OpenOrchestra\ModelInterface\Repository\SiteRepositoryInterface
Open
$site = $this->siteRepository->findOneBySiteId($redirection->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Parameter $redirection
has undeclared type \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
public function deleteForRedirection(RedirectionInterface $redirection)
- Create a ticketCreate a ticket
- Exclude checks
Call to method removeByRedirectionId
from undeclared class \OpenOrchestra\ModelInterface\Repository\RouteDocumentRepositoryInterface
Open
$this->routeDocumentRepository->removeByRedirectionId($redirection->getId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$node->getSiteId(),
- Create a ticketCreate a ticket
- Exclude checks
Call to method findOnePublished
from undeclared class \OpenOrchestra\ModelInterface\Repository\NodeRepositoryInterface
Open
$node = $this->nodeRepository->findOnePublished(
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
$redirection->getSiteId()
- Create a ticketCreate a ticket
- Exclude checks
Call to method getNodeId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$route->setNodeId($node->getNodeId());
- 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 getId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$paramValue = $key . '_' . $node->getId();
- Create a ticketCreate a ticket
- Exclude checks
Call to method getId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$route->setName($key . '_' . $node->getId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSiteId
from undeclared class \OpenOrchestra\ModelInterface\Model\ReadSiteInterface
Open
$route->setSiteId($site->getSiteId());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$node->getLanguage()
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLocale
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
$redirection->getLocale(),
- Create a ticketCreate a ticket
- Exclude checks
Call to method getRoutePattern
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$pattern = $this->completeRoutePattern($node->getParentId(), $node->getRoutePattern(), $node->getLanguage(), $site->getSiteId(), $routePattern);
- Create a ticketCreate a ticket
- Exclude checks
Method \OpenOrchestra\Backoffice\Manager\RouteDocumentManager::clearForNode
is declared to return \Doctrine\Common\Collections\Collection
but has no return value Open
public function clearForNode(NodeInterface $node)
- Create a ticketCreate a ticket
- Exclude checks
Call to method getAliases
from undeclared class \OpenOrchestra\ModelInterface\Model\ReadSiteInterface
Open
foreach ($site->getAliases() as $key => $alias) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getParentId
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$pattern = $this->completeRoutePattern($node->getParentId(), $node->getRoutePattern(), $node->getLanguage(), $site->getSiteId(), $routePattern);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $redirection
has undeclared type \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
protected function generateRoutesForRedirection(RedirectionInterface $redirection, ReadSiteInterface $site)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $site
has undeclared type \OpenOrchestra\ModelInterface\Model\ReadSiteInterface
Open
protected function generateRoutesForNode(NodeInterface $node, ReadSiteInterface $site, array $routePattern)
- 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
Reference to constant ROOT_PARENT_ID
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
if (is_null($parentId) || NodeInterface::ROOT_PARENT_ID == $parentId || '' == $parentId || 0 === strpos($suffix, '/')) {
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLanguage
from undeclared class \OpenOrchestra\ModelInterface\Model\NodeInterface
Open
$pattern = $this->completeRoutePattern($node->getParentId(), $node->getRoutePattern(), $node->getLanguage(), $site->getSiteId(), $routePattern);
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLocale
from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open
if ($alias->getLanguage() == $redirection->getLocale()) {
- Create a ticketCreate a ticket
- Exclude checks
Avoid excessively long variable names like $routeDocumentRepository. Keep variable name length under 20. Open
protected $routeDocumentRepository;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $redirectionRepository. Keep variable name length under 20. Open
RedirectionRepositoryInterface $redirectionRepository,
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $redirectionRepository. Keep variable name length under 20. Open
protected $redirectionRepository;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $routeDocumentRepository. Keep variable name length under 20. Open
RouteDocumentRepositoryInterface $routeDocumentRepository
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
The closing parenthesis and the opening brace of a multi-line function declaration must be on the same line Open
{
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$this->routeDocumentRepository->removeByNodeIdsSiteIdAndLanguage($nodeIds, $node->getSiteId(), $node->getLanguage());
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
return $this->suppressDoubleSlashes($this->completeRoutePattern($parent['parentId'], $parent['routePattern'] . '/' . $suffix, $language, $siteId, $routePattern));
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
if (is_null($parentId) || NodeInterface::ROOT_PARENT_ID == $parentId || '' == $parentId || 0 === strpos($suffix, '/')) {
- Create a ticketCreate a ticket
- Exclude checks
Arguments with default values must be at the end of the argument list Open
protected function completeRoutePattern($parentId = null, $suffix = null, $language, $siteId, array $routePattern)
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
$pattern = $this->completeRoutePattern($node->getParentId(), $node->getRoutePattern(), $node->getLanguage(), $site->getSiteId(), $routePattern);
- Create a ticketCreate a ticket
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
$nodes = $this->nodeRepository->findPublishedByPathAndLanguage($node->getPath(), $site->getSiteId(), $node->getLanguage());
- Create a ticketCreate a ticket
- Exclude checks