Completed
Push — master ( e8da74...847a65 )
by Iman
10:06 queued 06:57
created

RouterEventManager::commitChain()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Imanghafoori\HeyMan\WatchingStrategies;
4
5
use Illuminate\Support\Str;
6
7
class RouterEventManager extends BaseManager
8
{
9
    public $data = [];
10
11
    protected $type = 'route';
12
13 51
    public function findMatchingCallbacks(array $matchedRoute): array
14
    {
15 51
        $matchedCallbacks = [];
16 51
        foreach ($this->data as $routeInfo => $callBacks) {
17 48
            foreach ($matchedRoute as $info) {
18 48
                if (Str::is($routeInfo, $info)) {
19 48
                    $matchedCallbacks[] = $callBacks['a'] ?? [];
20
                }
21
            }
22
        }
23
24 51
        return $matchedCallbacks;
25
    }
26
}
27