| Conditions | 3 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | final public static function register(): void |
||
| 26 | { |
||
| 27 | collect(static::getMixins())->each(static function ($extension, $mixin) { |
||
|
|
|||
| 28 | if (! is_subclass_of($mixin, AbstractComponent::class)) { |
||
| 29 | throw new MixinInvalidException(sprintf( |
||
| 30 | 'Mixed class %s is not descendant of %s.', |
||
| 31 | $mixin, |
||
| 32 | AbstractComponent::class |
||
| 33 | )); |
||
| 34 | } |
||
| 35 | if (! method_exists($extension, 'mixin')) { |
||
| 36 | throw new MacroableMissedException(sprintf('Class %s doesn’t use Macroable Trait.', $extension)); |
||
| 37 | } |
||
| 38 | /** @var Macroable $extension */ |
||
| 39 | $extension::mixin(new $mixin()); |
||
| 40 | }); |
||
| 43 |