concrete/src/Tree/Node/Type/FileFolder.php
public function getChildFolderByName($name, $create = false)
    {
        $typeHandle = $this->getTreeNodeTypeHandle();
        if ($this->childNodesLoaded) {
            $childNodes = $this->childNodes;
        } else {
            $childNodesData = $this->getHierarchicalNodesOfType($typeHandle, 1, true, false, 1);
            $childNodes = array_map(function ($item) { return $item['treeNodeObject']; }, $childNodesData);
        }
        $result = null;
        foreach ($childNodes as $childNode) {
            if ($childNode->getTreeNodeTypeHandle() === $typeHandle && $childNode->getTreeNodeName() === $name) {
                $result = $childNode;
                break;
            }
        }
        if ($result === null && $create) {
            $result = static::add($name, $this);
        }

        return $result;
    }
public function getChildFolderByName($name, $create = false)
    {
        $typeHandle = $this->getTreeNodeTypeHandle();
        if ($this->childNodesLoaded) {
            $childNodes = $this->childNodes;
        } else {
            $childNodesData = $this->getHierarchicalNodesOfType($typeHandle, 1, true, false, 1);
            $childNodes = array_map(function ($item) { return $item['treeNodeObject']; }, $childNodesData);
        }
        $result = null;
        foreach ($childNodes as $childNode) {
            if ($childNode->getTreeNodeTypeHandle() === $typeHandle && $childNode->getTreeNodeName() === $name) {
                $result = $childNode;
                break;
            }
        }
        if ($result === null && $create) {
            $result = static::add($name, $this);
        }

        return $result;
    }
public function getChildFolderByName ( $ name , $ create = false ) { $ typeHandle = $ this -> getTreeNodeTypeHandle ( ) ; if ( $ this -> childNodesLoaded ) { $ childNodes = $ this -> childNodes ; } else { $ childNodesData = $ this -> getHierarchicalNodesOfType ( $ typeHandle , 1 , true , false , 1 ) ; $ childNodes = array_map ( function ( $ item ) { return $ item [ 'treeNodeObject' ] ; } , $ childNodesData ) ; } $ result = null ; foreach ( $ childNodes as $ childNode ) { if ( $ childNode -> getTreeNodeTypeHandle ( ) === $ typeHandle && $ childNode -> getTreeNodeName ( ) === $ name ) { $ result = $ childNode ; break ; } } if ( $ result === null && $ create ) { $ result = static :: add ( $ name , $ this ) ; } return $ result ; }
Get the first child folder this folder that has a specific name.

@param string $name The name of the child folder
@param bool $create Should the child folder be created if it does not exist?

@return static|null return NULL if no child folder has the specified name and $create is false
Get the first child folder this folder that has a specific name .