1 | <?php |
||
17 | trait ConfigurableTrait |
||
18 | { |
||
19 | /** |
||
20 | * @var ConfigInterface $config |
||
21 | */ |
||
22 | private $config; |
||
23 | |||
24 | /** |
||
25 | * Set the object's configuration container. |
||
26 | * |
||
27 | * @param ConfigInterface|array $config The datas to set. |
||
28 | * @throws InvalidArgumentException If the parameter is invalid. |
||
29 | * @return ConfigurableInterface Chainable |
||
30 | */ |
||
31 | public function setConfig($config) |
||
44 | |||
45 | /** |
||
46 | * Retrieve the object's configuration container, or one of its entry. |
||
47 | * |
||
48 | * If the object has no existing config, create one. |
||
49 | * |
||
50 | * If a key is provided, return the configuration key value instead of the full object. |
||
51 | * |
||
52 | * @param string $key Optional. If provided, the config key value will be returned, instead of the full object. |
||
53 | * @see self::create_config() |
||
54 | * @return ConfigInterface |
||
55 | */ |
||
56 | public function config($key = null) |
||
67 | |||
68 | /** |
||
69 | * Retrieve a new ConfigInterface instance for the object. |
||
70 | * |
||
71 | * @see AbstractConfig::__construct() |
||
72 | * @param array|string|null $data Optional data to pass to the new ConfigInterface instance. |
||
73 | * @return ConfigInterface |
||
74 | */ |
||
75 | protected function createConfig($data = null) |
||
79 | } |
||
80 |