| Conditions | 2 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Anomaly\PreferencesModule; |
||
| 25 | public function getFunctions() |
||
| 26 | { |
||
| 27 | return [ |
||
| 28 | new \Twig_SimpleFunction( |
||
| 29 | 'preference_value', |
||
| 30 | function ($key) { |
||
| 31 | return $this->dispatch(new GetPreferenceValue($key)); |
||
| 32 | } |
||
| 33 | ), |
||
| 34 | new \Twig_SimpleFunction( |
||
| 35 | 'preference', |
||
| 36 | function ($key) { |
||
| 37 | |||
| 38 | /* @var PreferenceInterface $preference */ |
||
| 39 | if (!$preference = $this->dispatch(new GetPreference($key))) { |
||
| 40 | return null; |
||
| 41 | } |
||
| 42 | |||
| 43 | return (new Decorator())->decorate($this->dispatch(new GetValueFieldType($preference))); |
||
| 44 | } |
||
| 45 | ), |
||
| 46 | ]; |
||
| 47 | } |
||
| 48 | } |
||
| 49 |