sinergi/config

View on GitHub

Showing 17 of 17 total issues

Function loadFile has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function loadFile($path, $env, $file)
    {
        $retval = [];
        foreach (self::$loaders as $fileType => $loader) {
            $file = "{$file}.{$fileType}";
Severity: Minor
Found in src/Loader.php - About 2 hrs 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 __construct has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($config)
    {
        $this->paths = new PathCollection();
        if (is_array($config)) {
            if (isset($config['path'])) {
Severity: Minor
Found in src/Configuration.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 getValue has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getValue(array $haystack = null, $key = null, $sub = null, $default = null)
    {
        if (empty($key) && !isset($haystack)) {
            return $default;
        } elseif (empty($key)) {
Severity: Minor
Found in src/Parser.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

Method __invoke has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __invoke(ContainerInterface $container)
    {
        $options = $this->options($container->get('config'));
        $driverClass = $options['driverClass'];
        $metadataDriverClass = $options['metadataDriverClass'];
Severity: Minor
Found in src/Polyfill/Doctrine/EntityManager.php - About 1 hr to fix

    Method getValue has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getValue(array $haystack = null, $key = null, $sub = null, $default = null)
        {
            if (empty($key) && !isset($haystack)) {
                return $default;
            } elseif (empty($key)) {
    Severity: Minor
    Found in src/Parser.php - About 1 hr to fix

      Function getContainerValue has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getContainerValue($id)
          {
              if (isset($this->container[$id])) {
                  return $this->container[$id];
              }
      Severity: Minor
      Found in src/Container.php - About 55 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 __invoke has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __invoke(ContainerInterface $container)
          {
              $options = $this->options($container->get('config'));
              $driverClass = $options['driverClass'];
              $metadataDriverClass = $options['metadataDriverClass'];
      Severity: Minor
      Found in src/Polyfill/Doctrine/EntityManager.php - About 55 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 $value;
      Severity: Major
      Found in src/Parser.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

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

          Avoid too many return statements within this method.
          Open

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

            Avoid too many return statements within this method.
            Open

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

              Avoid too many return statements within this method.
              Open

                              return $default;
              Severity: Major
              Found in src/Parser.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return $haystack[$key];
                Severity: Major
                Found in src/Parser.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return $default;
                  Severity: Major
                  Found in src/Parser.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

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

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

                            public static function mergeArrays(array $array1, array $array2, array $array3 = null)
                            {
                                $retval = $array1;
                                foreach ($array2 as $key => $value) {
                                    if (is_array($value) && isset($retval[$key])) {
                        Severity: Minor
                        Found in src/Loader.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