Completed
Push — master ( c3faac...8e8eee )
by wen
13:29
created

Extensions::apply()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Sco\Admin\View;
4
5
use Illuminate\Support\Collection;
6
use Sco\Admin\Contracts\Initializable;
7
use Sco\Admin\Contracts\View\Extensions\ExtensionInterface;
8
9
class Extensions extends Collection
10
{
11
    public function initialize()
12
    {
13
        $this->each(function (ExtensionInterface $extension) {
14
            if ($extension instanceof Initializable) {
15
                $extension->initialize();
16
            }
17
        });
18
    }
19
20
    public function apply($query)
21
    {
22
        $this->each(function (ExtensionInterface $extension) use ($query) {
23
            $extension->apply($query);
24
        });
25
    }
26
}
27