Showing 487 of 487 total issues
File Container.php
has 547 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php namespace Nine\Containers;
/**
* **A Dependency Injection and Service Locator container.**
*
Container
has 62 functions (exceeds 20 allowed). Consider refactoring. Open
class Container implements ArrayAccess, ContainerContract
{
/**
* The contextual binding map.
*
Method register
has 192 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(Container $app)
{
$app['profiler.mount_prefix'] = '/_profiler';
$app->extend('dispatcher', function ($dispatcher, $app) {
return new TraceableEventDispatcher($dispatcher, $app['stopwatch'], $app['logger']);
File Arrays.php
has 391 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php namespace Nine\Library;
/**
* @package Nine Library
* @version 0.3.1
Function register
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function register(Container $app)
{
// only register if twig templates are enabled by the framework
if ($this->config['view.twig.enabled']) {
- 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 data_set
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public static function data_set(&$target, $key, $value, $overwrite = TRUE)
{
$segments = is_array($key) ? $key : explode('.', $key);
if (($segment = array_shift($segments)) === '*') {
- 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 register
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(Container $app)
{
// only register if twig templates are enabled by the framework
if ($this->config['view.twig.enabled']) {
The class Container has an overall complexity of 136 which is very high. The configured complexity threshold is 50. Open
class Container implements ArrayAccess, ContainerContract
{
/**
* The contextual binding map.
*
- Exclude checks
The class Container has 44 non-getter- and setter-methods. Consider refactoring Container to keep number of methods under 25. Open
class Container implements ArrayAccess, ContainerContract
{
/**
* The contextual binding map.
*
- Read upRead up
- Exclude checks
TooManyMethods
Since: 0.1
A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
The default was changed from 10 to 25 in PHPMD 2.3.
Example
Source https://phpmd.org/rules/codesize.html#toomanymethods
The class Container has 31 public methods. Consider refactoring Container to keep number of public methods under 10. Open
class Container implements ArrayAccess, ContainerContract
{
/**
* The contextual binding map.
*
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class Potion has 12 public methods. Consider refactoring Potion to keep number of public methods under 10. Open
class Potion implements ContainerContract, \ArrayAccess
{
use WithInjectorArrayAccess, WithConfigurableInjector;
/**
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Method register
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(Container $app)
{
$app['db.default_options'] = [
'driver' => 'pdo_mysql',
'dbname' => env('DB_DATABASE', NULL),
Function register
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function register(Container $app)
{
$app['profiler.mount_prefix'] = '/_profiler';
$app->extend('dispatcher', function ($dispatcher, $app) {
return new TraceableEventDispatcher($dispatcher, $app['stopwatch'], $app['logger']);
- 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
File F9WebProfilerServiceProvider.php
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* This file is part of the Silex framework.
*
Function getMethodArguments
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getMethodArguments(Request $request, $controller, array $parameters) : array
{
// use this request
$this->current_request = $request;
- 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 parseItem
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseItem(Container $container, $name)
{
try {
$element = $container[$name];
} catch (\Exception $e) {
Function parseItem
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function parseItem(Container $container, $name)
{
try {
$element = $container[$name];
} catch (\Exception $e) {
- 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 data_get
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function data_get($target, $key, $default = NULL)
{
if (NULL === $key) {
return $target;
}
- 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 extract_dependencies
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function extract_dependencies($class, $method = NULL)
{
// collect the request attributes
$attributes = $this->current_request->attributes->all();
Avoid excessively long variable names like $outOfRequestScopeTypes. Keep variable name length under 20. Open
private $outOfRequestScopeTypes = [];
- Read upRead up
- 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++ ) {
}
}
}