| Total Complexity | 4 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Coverage | 75% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class ObjectToTabellaExtension extends \Twig_Extension |
||
| 8 | { |
||
| 9 | |||
| 10 | protected $fifreetableprefix; |
||
| 11 | |||
| 12 | 13 | public function __construct($fifreetableprefix) |
|
| 13 | { |
||
| 14 | 13 | $this->fifreetableprefix = $fifreetableprefix; |
|
| 15 | 13 | } |
|
| 16 | |||
| 17 | public function getFunctions() |
||
| 18 | { |
||
| 19 | return array( |
||
| 20 | new \Twig_SimpleFunction('object2view', array($this, 'object2View', 'is_safe' => array('html'))), |
||
| 21 | new \Twig_SimpleFunction('field2object', array($this, 'field2Object', 'is_safe' => array('html'))), |
||
| 22 | ); |
||
| 23 | } |
||
| 24 | |||
| 25 | 6 | public function object2View($object, $type = null) |
|
| 26 | { |
||
| 27 | 6 | $dfr = new DoctrineFieldReader($object, $this->fifreetableprefix); |
|
| 28 | 6 | return $dfr->object2View($object, $type); |
|
| 29 | } |
||
| 30 | |||
| 31 | 6 | public function field2Object($fieldtoobj, $object) |
|
| 35 | } |
||
| 36 | } |
||
| 37 |