atelierspierrot/patterns

View on GitHub

Showing 6 of 12 total issues

Collection has 32 functions (exceeds 20 allowed). Consider refactoring.
Open

class Collection
    implements CollectionInterface
{

    /**
Severity: Minor
Found in src/Patterns/Commons/Collection.php - About 4 hrs to fix

    Function getInstance has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getInstance()
        {
            if (is_null(self::$_instance)) {
                $_class     = get_called_class();
                $reflection = new ReflectionClass($_class);
    Severity: Minor
    Found in src/Patterns/Traits/SingletonTrait.php - About 1 hr to fix

    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 getKey has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getKey($val = null, $var = null, $section = false)
        {
            if (!empty($val)) {
                if (!empty($var)) {
                    foreach ($this->registry as $_sct=>$_data) {
    Severity: Minor
    Found in src/Patterns/Commons/Registry.php - About 1 hr to fix

    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 createInstance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function createInstance($classname, array $arguments = array())
        {
            $reflection_obj = new ReflectionClass($classname);
            if ($reflection_obj->getMethod('__construct')->isPublic()) {
                self::$_instances[ $classname ] = call_user_func_array(array($reflection_obj, 'newInstance'), $arguments);
    Severity: Minor
    Found in src/Patterns/Abstracts/AbstractSingleton.php - About 45 mins to fix

    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 loadClass has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function loadClass($className)
        {
            if ($filePath = $this->resolveFileName($className)) {
                if ($this->getFailureFlag() & self::FAIL_GRACEFULLY) {
                    if ($this->classFileExists($filePath)) {
    Severity: Minor
    Found in src/SplClassLoader.php - About 35 mins to fix

    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 setEntry has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setEntry($var = null, $val = null, $section = false)
        {
            if (!empty($var)) {
                if ($section) {
                    if (!isset($this->registry[$section])) {
    Severity: Minor
    Found in src/Patterns/Commons/Registry.php - About 35 mins to fix

    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

    Severity
    Category
    Status
    Source
    Language