GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Pull Request — new (#864)
by Dave
07:45
created

FormElementsRecursiveIterator   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A recursiveIterateElements() 0 18 4
1
<?php
2
3
namespace SleepingOwl\Admin\Traits;
4
5
use SleepingOwl\Admin\Contracts\Form\ElementsInterface;
6
7
trait FormElementsRecursiveIterator
8
{
9
    /**
10
     * @param \Closure $callback
11
     *
12
     * @return bool|void
13
     */
14
    public function recursiveIterateElements(\Closure $callback)
15
    {
16
        // If Callback function returns TRUE then recurse iterator should stop.
17
        $result = null;
18
19
        foreach ($this->getElements() as $element) {
0 ignored issues
show
Bug introduced by
It seems like getElements() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
        foreach ($this->/** @scrutinizer ignore-call */ getElements() as $element) {
Loading history...
20
            if ($element instanceof ElementsInterface) {
21
                $result = $element->recursiveIterateElements($callback);
0 ignored issues
show
Bug introduced by
The method recursiveIterateElements() does not exist on SleepingOwl\Admin\Contracts\Form\ElementsInterface. It seems like you code against a sub-type of said class. However, the method does not exist in SleepingOwl\Admin\Contracts\Form\FormInterface or SleepingOwl\Admin\Contra...Columns\ColumnInterface. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
                /** @scrutinizer ignore-call */ 
22
                $result = $element->recursiveIterateElements($callback);
Loading history...
22
            } else {
23
                $result = $callback($element);
24
            }
25
26
            if ($result === true) {
27
                break;
28
            }
29
        }
30
31
        return $result;
32
    }
33
}
34