| Conditions | 4 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4.1967 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 2 | public function render($value) |
|
| 24 | { |
||
| 25 | 2 | $text = $this->options['text'] ?: parent::render($value); |
|
| 26 | 2 | $parameters = []; |
|
| 27 | 2 | $accessor = PropertyAccess::createPropertyAccessor(); |
|
| 28 | |||
| 29 | 2 | foreach ($this->options['parameters'] as $parameterName => $fieldName) { |
|
| 30 | if (!$fieldName) { |
||
| 31 | $fieldName = $parameterName; |
||
| 32 | } |
||
| 33 | $parameters[$parameterName] = $accessor->getValue($this->entity, $fieldName); |
||
| 34 | } |
||
| 35 | |||
| 36 | 2 | $render = $this->twig->render($this->options['template'], [ |
|
| 37 | 2 | 'text' => $text, |
|
| 38 | 2 | 'parameters' => $parameters, |
|
| 39 | 2 | 'options' => $this->options, |
|
| 40 | ]); |
||
| 41 | |||
| 42 | 2 | return $render; |
|
| 43 | } |
||
| 44 | |||
| 75 |