ZF-3577: simple optimizing toString functions
Description
escape the output string after the string was generated if no tags are included in the string
e.g: Zend_View_Helper_HeadTitle
public function toString($indent = null)
{
$indent = (null !== $indent)
? $this->getWhitespace($indent)
: $this->getIndent();
$items = array();
foreach ($this as $item) {
$items[] = $this->_escape($item);
}
$separator = $this->_escape($this->getSeparator());
return $indent . '' . implode($separator, $items) . '';
}
the escape function need only one call
public function toString($indent = null)
{
$indent = (null !== $indent)
? $this->getWhitespace($indent)
: $this->getIndent();
$items = array();
foreach ($this as $item) {
$items[] = $item; // rem escpae
}
$separator = $this->getSeparator(); // rem escape
return $indent . '' . $this->escape( implode($separator, $items) ) . ''; // add escape
}
Comments
Posted by Jon Whitcraft (sidhighwind) on 2008-10-28T15:30:15.000+0000
Fixed in r12174.
Posted by Wil Sinclair (wil) on 2008-11-13T14:10:00.000+0000
Changing issues in preparation for the 1.7.0 release.