AddonTableEntries   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 21
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 2
1
<?php namespace Anomaly\PreferencesModule\Preference\Table;
2
3
use Anomaly\Streams\Platform\Addon\AddonCollection;
4
use Anomaly\Streams\Platform\Addon\Extension\ExtensionCollection;
5
use Anomaly\Streams\Platform\Addon\Module\ModuleCollection;
6
7
/**
8
 * Class AddonTableEntries
9
 *
10
 * @link          http://pyrocms.com/
11
 * @author        PyroCMS, Inc. <[email protected]>
12
 * @author        Ryan Thompson <[email protected]>
13
 */
14
class AddonTableEntries
15
{
16
17
    /**
18
     * Handle the command.
19
     *
20
     * @param AddonTableBuilder $builder
21
     * @param AddonCollection   $addons
22
     */
23
    public function handle(AddonTableBuilder $builder, AddonCollection $addons)
24
    {
25
        /* @var AddonCollection|ModuleCollection|ExtensionCollection $entries */
26
        $entries = $addons->{$builder->getType()}->withAnyConfig(['preferences\', \'preferences/preferences']);
27
28
        if (in_array($builder->getType(), ['modules', 'extensions'])) {
29
            $entries = $entries->enabled();
30
        }
31
32
        $builder->setTableEntries($entries);
33
    }
34
}
35