jpcercal/environment

View on GitHub

Showing 3 of 13 total issues

Function removeChar has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    protected function removeChar($string, $charStart = null, $charEnd = null)
    {
        if (!is_null($charStart) && (is_string($charStart) || is_array($charStart))) {
            if (is_string($charStart)) {
                $charStart = [$charStart];
Severity: Minor
Found in src/Resource/ArrayResource.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 filterItems has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function filterItems(array $items)
    {
        $data = [];

        foreach ($items as $item) {
Severity: Minor
Found in src/Resource/ArrayResource.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 process has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function process()
    {
        $rawResource      = $this->getResource();
        $rawResourceLower = strtolower($rawResource);

Severity: Minor
Found in src/Resource/Resource.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

Severity
Category
Status
Source
Language