Код: Выделить всё
class Template{
protected function _arguments($source, $expression)
{
$args = $this->_array($expression, array(
$expression => array(
"opener" => "{",
"closer" => "}"
)
));
\\ unnecessary code
}
protected function _array($source)
{
$parts = array();
$tags = array();
$all = array();
$type = null;
$delimiter = null;
while ($source)
{
$match = $this->_implementation->match($source);
$type = $match["type"];
$delimiter = $match["delimiter"];
$opener = strpos($source, $type["opener"]);
$closer = strpos($source, $type["closer"]) + strlen($type["closer"]);
if ($opener !== false)
{
$parts[] = substr($source, 0, $opener);
$tags[] = substr($source, $opener, $closer - $opener);
$source = substr($source, $closer);
}
else
{
$parts[] = $source;
$source = "";
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/788 ... d-with-two