ZF-11062: Unnecessary code
Description
At the beginning of "__construct" method, the $options parameter type is checked:
if (null !== $options) {
if (is_string($options)) {
$this->setLayoutPath($options);
} elseif (is_array($options)) {
$this->setOptions($options);
} elseif ($options instanceof Zend_Config) {
$this->setConfig($options);
} else {
require_once 'Zend/Layout/Exception.php';
throw new Zend_Layout_Exception('Invalid option provided to constructor');
}
}
Then, setOptions and setConfig do it again:
public function setOptions($options)
{
if ($options instanceof Zend_Config) {
$options = $options->toArray();
...
public function setConfig(Zend_Config $config)
{
$this->setOptions($config->toArray());
...
Comments
Posted by Kai Uwe (kaiuwe) on 2011-02-10T09:36:42.000+0000
A typical use case:
The issue can be closed.
Posted by Marcos Gil Fuertes (marcis) on 2011-02-10T11:59:43.000+0000
But not in the __construct method...
if (is_array($options) || ($options instanceof Zend_Config)) { $this->setOptions($options); }