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;
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(
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;
- Read upRead up
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;
Avoid too many return
statements within this method. Open
return $this;
Avoid too many return
statements within this method. Open
return $this;
Avoid too many return
statements within this method. Open
return $this;
Avoid too many return
statements within this method. Open
return $this;
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);
- Read upRead up
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]);
- Read upRead up
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) {
- Read upRead up
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"