peakphp/framework

View on GitHub

Showing 32 of 34 total issues

Function resolve has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function resolve(array $definition, Container $container, array $args = [])
    {
        $final_args = $definition;
        if (!empty($args)) { // add create argument at the end
            foreach ($args as $arg) {
Severity: Minor
Found in src/Di/ArrayDefinition.php - About 3 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 resolve has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function resolve($class, Container $container, array $args = [], $explicit = null)
    {
        $method = '__construct';

        if (is_array($class)) {
Severity: Minor
Found in src/Di/ClassResolver.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 set has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function set(string $path, $value): void
    {
        if (!empty($path)) {
            $at = & $this->items;
            $keys = $this->explode($path);
Severity: Minor
Found in src/Collection/DotNotationCollection.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 inspectRecursive has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function inspectRecursive(array $handlers): array
    {
        $routes = [];
        foreach ($handlers as $handler) {
            $subRoutes = [];
Severity: Minor
Found in src/Backpack/Bedrock/AppRoutesMapper.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 resolve has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function resolve(Container $container, array $args = [], $explicit = null)
    {
        $definition = $this->definition;

        if (null !== $this->storedInstance) {
Severity: Minor
Found in src/Di/Binding/Singleton.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 resolve has 39 lines of code (exceeds 30 allowed). Consider refactoring.
Open

    public function resolve($class, Container $container, array $args = [], $explicit = null)
    {
        $method = '__construct';

        if (is_array($class)) {
Severity: Minor
Found in src/Di/ClassResolver.php - About 1 hr to fix

    Method resolve has 37 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

        public function resolve(array $definition, Container $container, array $args = [])
        {
            $final_args = $definition;
            if (!empty($args)) { // add create argument at the end
                foreach ($args as $arg) {
    Severity: Minor
    Found in src/Di/ArrayDefinition.php - About 1 hr to fix

      Function delete has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function delete($id)
          {
              if ($this->has($id)) {
                  //remove instance
                  unset($this->instances[$id]);
      Severity: Minor
      Found in src/Di/Container.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 skipKey has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function skipKey(string $key): bool
          {
              if (!empty($this->search)) {
                  foreach ($this->search as $search) {
                      if ($this->hasWildCard($search)) {
      Severity: Minor
      Found in src/Collection/CollectionFlattener.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 interpolate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          function interpolate(string $message, array $context = array(), Closure $fn = null): string
          {
              // build a replacement array with braces around the context keys
              $replace = array();
              foreach ($context as $key => $val) {
      Severity: Minor
      Found in src/Common/helpers.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 resolve has 34 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

          public function resolve(Container $container, array $args = [], $explicit = null)
          {
              $definition = $this->definition;
      
              if (null !== $this->storedInstance) {
      Severity: Minor
      Found in src/Di/Binding/Singleton.php - About 1 hr to fix

        Function inspect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function inspect($class, $method = '__construct')
            {
                if (is_string($class) && !class_exists($class)) {
                    throw new ClassNotFoundException($class);
                }
        Severity: Minor
        Found in src/Di/ClassInspector.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 flatCollection has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function flatCollection(array $data, string $prefix = null, array $flat_data = []): array
            {
                foreach ($data as $key => $val) {
                    if ($prefix !== null) {
                        $key = $prefix.$this->separator.$key;
        Severity: Minor
        Found in src/Collection/CollectionFlattener.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 resolve has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function resolve($resource): Stream
            {
                // detect best way to load and process configuration content
                if (is_array($resource)) {
                    return new DataStream($resource, new ArrayProcessor());
        Severity: Minor
        Found in src/Config/ConfigResolver.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 arrayMergeRecursiveDistinct has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function arrayMergeRecursiveDistinct(array $a, array $b, bool $mergeNumericKeys = false): array
            {
                $merged = $a;
        
                foreach($b as $key => $value) {
        Severity: Minor
        Found in src/Common/Traits/ArrayMergeRecursiveDistinct.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 process has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
            {
                $this->nextHandler = (isset($this->nextHandler)) ? next($this->handlers) : current($this->handlers);
        
                // nextHandler is a stack
        Severity: Minor
        Found in src/Http/Stack.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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __construct(array $definitions, bool $strict = false)
            {
                if (empty($definitions)) {
                    return;
                }
        Severity: Minor
        Found in src/Common/PhpIni.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 resolve has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function resolve(string $interface, Container $container, $explicit = [])
            {
                // try to find a match in the container for a class or an interface
                if ($container->hasInterface($interface)) {
                    $instance = $container->getInterface($interface);
        Severity: Minor
        Found in src/Di/InterfaceResolver.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 resolve has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function resolve($item): Bootable
            {
                if(is_string($item) && class_exists($item)) {
                    if (null !== $this->container) {
                        $item = $this->container->get($item);
        Severity: Minor
        Found in src/Bedrock/Bootstrap/BootableResolver.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 boot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function boot()
            {
                if ((php_sapi_name() === 'cli' || defined('STDIN'))) {
                    return;
                }
        Severity: Minor
        Found in src/Backpack/Bootstrap/Session.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