Completed
Push — master ( e481c7...bcdb1b )
by Marco
35:35 queued 20:00
created

CommandsLoader::load()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 7
nc 4
nop 2
dl 0
loc 15
rs 9.2
c 0
b 0
f 0
1
<?php namespace Comodojo\Extender\Components;
2
3
use \Comodojo\Foundation\Base\AbstractYamlLoader;
4
use \Exception;
5
6
/**
7
 * @package     Comodojo Extender
8
 * @author      Marco Giovinazzi <[email protected]>
9
 * @license     MIT
10
 *
11
 * LICENSE:
12
 *
13
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
 * THE SOFTWARE.
20
 */
21
22
class CommandsLoader extends AbstractYamlLoader {
23
24
    public static function load($file, array $attributes = []) {
0 ignored issues
show
Unused Code introduced by
The parameter $attributes is not used and could be removed. ( Ignorable by Annotation )

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

24
    public static function load($file, /** @scrutinizer ignore-unused */ array $attributes = []) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
26
        $config = static::importData($file);
27
28
        $classes = [];
29
30
        foreach ($config as $package) {
31
            foreach ($package as $command) {
32
                if ( $command['scope'] === 'extender') {
33
                    $classes[] = $command['class'];
34
                }
35
            }
36
        }
37
38
        return $classes;
39
40
    }
41
42
}
43