Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
CRAP | |
75.00% |
3 / 4 |
TwbBundleFormStatic | |
0.00% |
0 / 1 |
|
50.00% |
1 / 2 |
3.14 | |
75.00% |
3 / 4 |
__invoke(ElementInterface $element = null) | |
0.00% |
0 / 1 |
2.15 | |
66.67% |
2 / 3 |
|||
render(ElementInterface $oElement) | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
<?php | |
namespace TwbBundle\Form\View\Helper; | |
use Zend\Form\ElementInterface; | |
class TwbBundleFormStatic extends \Zend\Form\View\Helper\AbstractHelper{ | |
/** | |
* @var string | |
*/ | |
private static $staticFormat = '<p class="form-control-static">%s</p>'; | |
/** | |
* Invoke helper as functor | |
* | |
* Proxies to {@link render()}. | |
* | |
* @param ElementInterface|null $element | |
* @return string|TwbBundleFormStatic | |
*/ | |
public function __invoke(ElementInterface $element = null) | |
{ | |
if (!$element) { | |
return $this; | |
} | |
return $this->render($element); | |
} | |
/** | |
* @see \Zend\Form\View\Helper\AbstractHelper::render() | |
* @param ElementInterface $oElement | |
* @return string | |
*/ | |
public function render(ElementInterface $oElement){ | |
return sprintf(self::$staticFormat,$oElement->getValue()); | |
} | |
} |