1 | <?php |
||
2 | /** |
||
3 | * This file is part of the O2System Framework package. |
||
4 | * |
||
5 | * For the full copyright and license information, please view the LICENSE |
||
6 | * file that was distributed with this source code. |
||
7 | * |
||
8 | * @author Steeve Andrian Salim |
||
9 | * @copyright Copyright (c) Steeve Andrian Salim |
||
10 | */ |
||
11 | |||
12 | // ------------------------------------------------------------------------ |
||
13 | |||
14 | namespace O2System\Spl\Traits; |
||
15 | |||
16 | // ------------------------------------------------------------------------ |
||
17 | |||
18 | /** |
||
19 | * Class OptionsSetterTrait |
||
20 | * |
||
21 | * @package O2System\Spl\Traits\Collectors |
||
22 | */ |
||
23 | trait OptionsSetterTrait |
||
24 | { |
||
25 | /** |
||
26 | * OptionsSetterTrait::setOptions |
||
27 | * |
||
28 | * @param array $options |
||
29 | * |
||
30 | * @return $this |
||
31 | */ |
||
32 | public function setOptions(array $options) |
||
33 | { |
||
34 | if (count($options)) { |
||
35 | foreach ($options as $method => $value) { |
||
36 | $method = camelcase('set_' . $method); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
37 | |||
38 | if (method_exists($this, $method)) { |
||
39 | call_user_func_array([&$this, $method], [$value]); |
||
40 | } |
||
41 | } |
||
42 | } |
||
43 | |||
44 | return $this; |
||
45 | } |
||
46 | } |