mirror of
https://github.com/erusev/parsedown.git
synced 2025-09-03 03:42:38 +02:00
This is probably faster than duplicating the closure
This commit is contained in:
@@ -1614,10 +1614,13 @@ class Parsedown
|
|||||||
|
|
||||||
protected function elementsApplyRecursive($closure, array $Elements)
|
protected function elementsApplyRecursive($closure, array $Elements)
|
||||||
{
|
{
|
||||||
return array_map(
|
return array_reduce(
|
||||||
array($this, 'elementApplyRecursive'),
|
$Elements,
|
||||||
array_fill(0, count($Elements), $closure),
|
function (array $Elements, array $Element) use ($closure) {
|
||||||
$Elements
|
$Elements[] = $this->elementApplyRecursive($closure, $Element);
|
||||||
|
return $Elements;
|
||||||
|
},
|
||||||
|
array()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user