Function filterSearch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa)
{
$qa->match(array('extra.site_id' => $configuration->getSearchIndex('site_id')));
$userName = $configuration->getSearchIndex('user_name');
- 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
Missing class import via use statement (line '88', column '52'). Open
$qa->match(array('datetime' => new \MongoRegex('/' . $date . '.*/i')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '72', column '55'). Open
$qa->match(array('extra.user_name' => new \MongoRegex('/.*' . $userName . '.*/i')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '77', column '53'). Open
$qa->match(array('extra.user_ip' => new \MongoRegex('/.*' . $userIP . '.*/i')));
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Call to method getSearchIndex
from undeclared class \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open
$userIP = $configuration->getSearchIndex('user_ip');
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSkip
from undeclared class \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open
$qa->skip($configuration->getSkip());
- Create a ticketCreate a ticket
- Exclude checks
Call to method match
from undeclared class \Solution\MongoAggregation\Pipeline\Stage
Open
$qa->match(array('extra.user_ip' => new \MongoRegex('/.*' . $userIP . '.*/i')));
- Create a ticketCreate a ticket
- Exclude checks
Call to method match
from undeclared class \Solution\MongoAggregation\Pipeline\Stage
Open
$qa->match(array('extra.site_id' => $configuration->getSearchIndex('site_id')));
- Create a ticketCreate a ticket
- Exclude checks
Class extends undeclared class \OpenOrchestra\Repository\AbstractAggregateRepository
Open
class LogRepository extends AbstractAggregateRepository implements LogRepositoryInterface
- Create a ticketCreate a ticket
- Exclude checks
Parameter $configuration
has undeclared type \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open
protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ModelLogBundle\Repository\LogRepository::createAggregationQuery
Open
$qa = $this->createAggregationQuery();
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \MongoRegex
Open
$qa->match(array('datetime' => new \MongoRegex('/' . $date . '.*/i')));
- Create a ticketCreate a ticket
- Exclude checks
Call to method getOrder
from undeclared class \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open
$order = $configuration->getOrder();
- Create a ticketCreate a ticket
- Exclude checks
Call to method match
from undeclared class \Solution\MongoAggregation\Pipeline\Stage
Open
$qa->match(array('datetime' => new \MongoRegex('/' . $date . '.*/i')));
- Create a ticketCreate a ticket
- Exclude checks
Call to method getLimit
from undeclared class \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open
$qa->limit($configuration->getLimit());
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSearchIndex
from undeclared class \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open
$userName = $configuration->getSearchIndex('user_name');
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \MongoRegex
Open
$qa->match(array('extra.user_name' => new \MongoRegex('/.*' . $userName . '.*/i')));
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ModelLogBundle\Repository\LogRepository::hydrateAggregateQuery
Open
return $this->hydrateAggregateQuery($qa);
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ModelLogBundle\Repository\LogRepository::createAggregationQuery
Open
$qa = $this->createAggregationQuery();
- Create a ticketCreate a ticket
- Exclude checks
Parameter $qa
has undeclared type \Solution\MongoAggregation\Pipeline\Stage
Open
protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa)
- Create a ticketCreate a ticket
- Exclude checks
Parameter $configuration
has undeclared type \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open
public function findForPaginate(PaginateFinderConfiguration $configuration)
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ModelLogBundle\Repository\LogRepository::countDocumentAggregateQuery
Open
return $this->countDocumentAggregateQuery($qa);
- Create a ticketCreate a ticket
- Exclude checks
Parameter $configuration
has undeclared type \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open
public function countWithFilter(PaginateFinderConfiguration $configuration)
- Create a ticketCreate a ticket
- Exclude checks
Returning type \Solution\MongoAggregation\Pipeline\Stage
but filterSearch()
is declared to return array
Open
return $qa;
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ModelLogBundle\Repository\LogRepository::countDocumentAggregateQuery
Open
return $this->countDocumentAggregateQuery($qa);
- Create a ticketCreate a ticket
- Exclude checks
Call to method match
from undeclared class \Solution\MongoAggregation\Pipeline\Stage
Open
$qa->match(array('extra.user_name' => new \MongoRegex('/.*' . $userName . '.*/i')));
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSearchIndex
from undeclared class \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open
$date = $configuration->getSearchIndex('date');
- Create a ticketCreate a ticket
- Exclude checks
Call to undeclared method \OpenOrchestra\ModelLogBundle\Repository\LogRepository::createAggregationQuery
Open
$qa = $this->createAggregationQuery();
- Create a ticketCreate a ticket
- Exclude checks
Call to method __construct
from undeclared class \MongoRegex
Open
$qa->match(array('extra.user_ip' => new \MongoRegex('/.*' . $userIP . '.*/i')));
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSearchIndex
from undeclared class \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open
$qa->match(array('extra.site_id' => $configuration->getSearchIndex('site_id')));
- Create a ticketCreate a ticket
- Exclude checks
Call to method getSearchIndex
from undeclared class \OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration
Open
$dateFormat = $configuration->getSearchIndex('date-format');
- Create a ticketCreate a ticket
- Exclude checks
Avoid variables with short names like $qa. Configured minimum length is 3. Open
$qa = $this->createAggregationQuery();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $qa. Configured minimum length is 3. Open
$qa = $this->createAggregationQuery();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $qa. Configured minimum length is 3. Open
protected function filterSearch(PaginateFinderConfiguration $configuration, Stage $qa)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $qa. Configured minimum length is 3. Open
$qa = $this->createAggregationQuery();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}