Showing 48 of 176 total issues
Method matchCheck
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function matchCheck($uriSplit, $urlSplit, array &$params) : bool
{
$result = false;
if ((strlen($uriSplit) >= 7) && ($uriSplit[0] == '{') && ($uriSplit[strlen($uriSplit) - 1] == '}')) {
Method serialize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function serialize($format = self::JSON)
{
if (!is_integer($format)) {
throw new \InvalidArgumentException('Invalid serialization format');
}
Method loadRelation
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function loadRelation(Column &$column, $className, $propName)
{
if (!class_exists($className)) {
throw new ActiveRecordException("The class $className doesn't exists.", 109);
}
Method matchURI
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function matchURI($uri, $url, array &$matchedExpr, array &$matchedGet) : bool
{
if (!is_string($url)) {
throw new \InvalidArgumentException("The URL must be given as a valid string");
}
Consider simplifying this complex logical expression. Open
if ((strcmp($method, RouteInterface::GET) == 0) ||
(strcmp($method, RouteInterface::POST) == 0) ||
(strcmp($method, RouteInterface::PUT) == 0) ||
(strcmp($method, RouteInterface::DELETE) == 0) ||
(strcmp($method, RouteInterface::HEAD) == 0) ||
Function where
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function &where(SelectionCriteria $where) : SQLWrapperInterface
{
//execute the private function 'export'
$exportMethod = new \ReflectionMethod($where, 'export');
$exportMethod->setAccessible(true);
- Read upRead up
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
Function isFloat
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function isFloat($str) : bool
{
if (!self::isString($str)) {
return false;
}
- Read upRead up
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
Function matchURI
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function matchURI($uri, $url, array &$matchedExpr, array &$matchedGet) : bool
{
if (!is_string($url)) {
throw new \InvalidArgumentException("The URL must be given as a valid string");
}
- Read upRead up
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
Function loadErrorHandlers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function loadErrorHandlers($method) : array
{
$errorHandlers = [];
foreach ($this->routes[$method] as &$currentRoute) {
- Read upRead up
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
Function limitOffsetOrderBy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function &limitOffsetOrderBy(ResultModifier $mod) : SQLWrapperInterface
{
//execute the private function 'export'
$exportMethod = new \ReflectionMethod($mod, 'export');
$exportMethod->setAccessible(true);
- Read upRead up
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
Function paramCheck
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected static function paramCheck($urlSplit, $type) : bool
{
if ((!is_int($type)) || ($type < 0) || ($type > 4)) {
throw new RouterException("Invalid parameter type", 100);
}
- Read upRead up
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 pbkdf2
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function pbkdf2($password, $salt, $keyLength, $count, $algorithm = self::SHA256)
Method __invoke
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __invoke(RequestInterface &$request, ResponseInterface &$response, GenericCollection &$arguments, $controllerArgs = [], Application $app = null);
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(RequestInterface &$controllerRequest, ResponseInterface &$controllerResponse, GenericCollection &$controllerArguments, array &$plugins, Application $app = null)
Method __invoke
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __invoke(RequestInterface &$request, ResponseInterface &$response, GenericCollection &$arguments, $controllerArgs = [], Application $app = null)
Function connect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function connect($name, array $details) : Logger
{
//check for the logger name
if ((!is_string($name)) || (strlen($name) <= 0)) {
throw new \InvalidArgumentException('The logger name must be given as a valid non-empty string');
- Read upRead up
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
Function loadRelation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function loadRelation(Column &$column, $className, $propName)
{
if (!class_exists($className)) {
throw new ActiveRecordException("The class $className doesn't exists.", 109);
}
- Read upRead up
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
Function initTransitionSchema
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function initTransitionSchema()
{
//table must have been already correctly parsed, so I know data is well-formed
if (!ActiveRecordTables::isRegistered(static::class)) {
throw new ActiveRecordException("Table definition for the current ActiveRecord object is missing.", 300);
- Read upRead up
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
Function loadField
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function loadField(Table &$table, array $fieldDefinition, $fieldName = null)
{
$field = new GenericCollection($fieldDefinition);
if ((!$field->has('name')) || (!is_string($field->get('name'))) || (strlen($field->get('name')) <= 0)) {
- Read upRead up
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
Avoid too many return
statements within this method. Open
return $str[$len - 1] != '.';