peakphp/framework

View on GitHub

Showing 34 of 34 total issues

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

    public function clear()
    {
        $result = true;
        $dir = new \DirectoryIterator($this->path);
        foreach ($dir as $file) {
Severity: Minor
Found in src/Config/Cache/FileCache.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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function get(string $path, $default = null)
    {
        $array = $this->items;

        if (!empty($path)) {
Severity: Minor
Found in src/Collection/DotNotationCollection.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 resolve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function resolve($handler)
    {
        if ($handler instanceof Stack ||
            $handler instanceof MiddlewareInterface ||
            $handler instanceof RequestHandlerInterface) {
Severity: Minor
Found in src/Http/Request/HandlerResolver.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 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

Function boot has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function boot()
    {
        // call environment method if exists
        // e.g. envDev() envProd() envStating() envTesting()
        $envMethod = 'env'.ucfirst(strtolower($this->application->getKernel()->getEnv()));
Severity: Minor
Found in src/Bedrock/AbstractBootstrapper.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 new DataStream($resource, new StdClassProcessor());
Severity: Major
Found in src/Config/ConfigResolver.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return new FileStream($resource, $filesHandlers);
    Severity: Major
    Found in src/Config/ConfigResolver.php - About 30 mins to fix

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

          public function resolve(Container $container, array $args = [], $explicit = null)
          {
              $definition = $this->definition;
      
              if (!is_null($explicit) && !empty($explicit)) {
      Severity: Minor
      Found in src/Di/Binding/Prototype.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 internalBuild has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function internalBuild(string $applicationClass): \Peak\Blueprint\Bedrock\HttpApplication
          {
              $kernel = $this->kernel;
              if (!isset($kernel)) {
                  $kernelClass = $this->kernelClass ?? \Peak\Bedrock\Kernel::class;
      Severity: Minor
      Found in src/Backpack/Bedrock/HttpAppBuilder.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 resolve has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function resolve(string $needle, Container $container, $explicit = null)
          {
              // Check for explicit dependency closure or object instance
              if (is_array($explicit) && array_key_exists($needle, $explicit)) {
                  if ($explicit[$needle] instanceof Closure) {
      Severity: Minor
      Found in src/Di/ExplicitResolver.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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function add($commands)
          {
              if (!is_array($commands)) {
                  $commands = [$commands];
              }
      Severity: Minor
      Found in src/Bedrock/Cli/Application.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 set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function set(string $name, $value)
          {
              /** @var array<DataType> $structure */
              $structure = $this->getStructure();
              if (!isset($structure[$name])) {
      Severity: Minor
      Found in src/Collection/Structure/AbstractStructure.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 fillUndefinedWithDefault has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function fillUndefinedWithDefault()
          {
              $structure = $this->getStructure();
              foreach ($structure as $key => $dataType) {
                  if (!array_key_exists($key, $this->data)) {
      Severity: Minor
      Found in src/Collection/Structure/AbstractStructure.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