atelierspierrot/reflectors

View on GitHub

Showing 26 of 26 total issues

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

    public function getReflector()
    {
        if (empty($this->reflector)) {
            if ($this->isFunction() || $this->isClosure()) {
                $this->reflector = new \ReflectionFunction($this->getFunctionName());
Severity: Minor
Found in src/Reflectors/ReflectionCallback.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

Avoid too many return statements within this method.
Open

        return null;
Severity: Major
Found in src/Reflectors/ValueType.php - About 30 mins to fix

    Function setReadOnlyProperties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setReadOnlyProperties(array $data)
        {
            foreach ($data as $var=>$val) {
                if (!property_exists(get_called_class(), $var)) {
                    throw new \InvalidArgumentException(
    Severity: Minor
    Found in src/Reflectors/ReadOnlyPropertiesTrait.php - About 25 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 __get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __get($name)
        {
            if (array_key_exists($name, $this->_read_only_props)) {
                if (is_string($this->_read_only_props[$name]) && is_callable(array(get_called_class(), $this->_read_only_props[$name]))) {
                    return call_user_func(array($this, $this->_read_only_props[$name]));
    Severity: Minor
    Found in src/Reflectors/ReadOnlyPropertiesTrait.php - About 25 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 export has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function export($argument, $return = false)
        {
            $_class     = get_called_class();
            $reflection = new \ReflectionClass($_class);
            if (!in_array('Reflector', $reflection->getInterfaceNames())) {
    Severity: Minor
    Found in src/Reflectors/ReflectorTrait.php - About 25 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