This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simply returns the titles of the nodes passed to it | |
* | |
* @param array $nodes Collection of nodes we want to have the titles of | |
*/ | |
function titles(array $nodes) { | |
return array_map( | |
function ($node) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simply returns the titles of the nodes passed to it | |
* | |
* @param array $nodes Collection of nodes we want to have the titles of | |
*/ | |
function titles(array $nodes) { | |
return array_map( | |
function ($node) { | |
return $node['title']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simply returns the titles of the nodes passed to it | |
* | |
* @param array $nodes Collection of nodes we want to have the titles of | |
*/ | |
function titles(array $nodes) { | |
return array_map( | |
function ($node) { | |
return $node['title']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adds the children and descendants attribute to an ordered set of nodes | |
* | |
* @param array $nodes pre-order walk of nodes in nested set format | |
*/ | |
function with_descendants_and_children(array $nodes) { | |
// First we initialise our stack | |
$ancestor_stack = []; | |