mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Use mutating loop instead of creating new array
This commit is contained in:
parent
cdaf86b039
commit
86940be224
@ -1664,26 +1664,22 @@ class Parsedown
|
||||
|
||||
protected function elementsApplyRecursive($closure, array $Elements)
|
||||
{
|
||||
$newElements = array();
|
||||
|
||||
foreach ($Elements as $Element)
|
||||
foreach ($Elements as &$Element)
|
||||
{
|
||||
$newElements[] = $this->elementApplyRecursive($closure, $Element);
|
||||
$Element = $this->elementApplyRecursive($closure, $Element);
|
||||
}
|
||||
|
||||
return $newElements;
|
||||
return $Elements;
|
||||
}
|
||||
|
||||
protected function elementsApplyRecursiveDepthFirst($closure, array $Elements)
|
||||
{
|
||||
$newElements = array();
|
||||
|
||||
foreach ($Elements as $Element)
|
||||
foreach ($Elements as &$Element)
|
||||
{
|
||||
$newElements[] = $this->elementApplyRecursiveDepthFirst($closure, $Element);
|
||||
$Element = $this->elementApplyRecursiveDepthFirst($closure, $Element);
|
||||
}
|
||||
|
||||
return $newElements;
|
||||
return $Elements;
|
||||
}
|
||||
|
||||
protected function element(array $Element)
|
||||
|
Loading…
Reference in New Issue
Block a user