Total Complexity | 7 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | abstract class BehaviorRegistry implements HasLockInterface, HasBehaviorsInterface |
||
16 | { |
||
17 | /** |
||
18 | * @return BehaviorCollectionInterface<TParentCollection> |
||
19 | */ |
||
20 | abstract protected function getBehaviorCollection(): BehaviorCollectionInterface; |
||
21 | |||
22 | public function hasBehavior(string $behaviorClassName): bool |
||
23 | { |
||
24 | foreach ($this->getBehaviorCollection() as $behavior) { |
||
25 | if ($behavior instanceof $behaviorClassName) { |
||
26 | return true; |
||
27 | } |
||
28 | } |
||
29 | |||
30 | return false; |
||
31 | } |
||
32 | |||
33 | public function findBehaviorByClass(string $class) |
||
42 | } |
||
43 | |||
44 | public function lock(): void |
||
49 |