| Total Complexity | 7 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | trait ConfigTrait |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @var array |
||
| 10 | */ |
||
| 11 | private $config; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * ConfigTrait constructor. |
||
| 15 | * |
||
| 16 | * @param array $config |
||
| 17 | */ |
||
| 18 | public function __construct(array $config = []) |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Override this method to perform logic BEFORE configuration is applied. |
||
| 27 | * This method is useful for setting default values for properties |
||
| 28 | * that need to use new -keyword. |
||
| 29 | * If you do, just remember to call the parent implementation. |
||
| 30 | */ |
||
| 31 | protected function beforeConfig(): void |
||
| 32 | { |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Override this method to perform logic AFTER configuration is applied. |
||
| 37 | * This method is useful for configuring classes after instantiation, |
||
| 38 | * e.g. adding a query type to a schema or adding fields to object types. |
||
| 39 | * If you do, just remember to call the parent implementation. |
||
| 40 | */ |
||
| 41 | protected function afterConfig(): void |
||
| 42 | { |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @param array $config |
||
| 47 | * @return $this |
||
| 48 | */ |
||
| 49 | protected function setConfig(array $config) |
||
| 64 | } |
||
| 65 | } |
||
| 66 |