brightnucleus/view

View on GitHub

Showing 11 of 11 total issues

Method addToContext has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addToContext( string $key, $value, string $behavior ): View
    {
        switch ($behavior) {
            case View::REPLACE:
                $this->_context_[$key] = $value;
Severity: Minor
Found in src/View/View/AbstractView.php - About 1 hr to fix

    Method getRenderCallback has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getRenderCallback(string $uri, array $context = []): callable
        {
            if (! is_readable($uri)) {
                throw new FailedToLoadView(
                    sprintf(
    Severity: Minor
    Found in src/View/Engine/PHPEngine.php - About 1 hr to fix

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

          public function create(string $view, $type = null): View
          {
              if (!array_key_exists($view, $this->viewPathCache)) {
                  $uri    = $this->scanLocations([$view]);
                  $engine = $uri ? $this->getEngine($uri) : false;
      Severity: Minor
      Found in src/View/ViewBuilder.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 $this;
      Severity: Major
      Found in src/View/View/AbstractView.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $this;
        Severity: Major
        Found in src/View/View/AbstractView.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return $this;
          Severity: Major
          Found in src/View/View/AbstractView.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return $this;
            Severity: Major
            Found in src/View/View/AbstractView.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return $this;
              Severity: Major
              Found in src/View/View/AbstractView.php - About 30 mins to fix

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

                    public function scanLocations(array $criteria)
                    {
                        $uris = $this->locations->map(function ($location) use ($criteria) {
                            /** @var Location $location */
                            return $location->getURI($criteria);
                Severity: Minor
                Found in src/View/ViewBuilder.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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function find(array $criteria, Engine $engine = null): View
                    {
                        $uri = $criteria[0];
                
                        $views = $this->initializeFindables([$uri, $engine]);
                Severity: Minor
                Found in src/View/View/BaseViewFinder.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 find has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function find(array $criteria): Engine
                    {
                        $this->findables = $this->initializeFindables();
                
                        foreach ($criteria as $entry) {
                Severity: Minor
                Found in src/View/Engine/BaseEngineFinder.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