Returns all children with the given type.

@access public
@param string $type
@param boolean $recursive
@return array
970606
public function getChildrenByType($type, $recursive = true)
    {
        $results = array();

        foreach ($this->parts as $part) {
            if (is_a($part, $type) || is_subclass_of($part, $type)) {
                $results[] = $part;
            }
            
            if ($recursive) {
                $results = array_merge($results, $part->getChildrenByType($type, $recursive));
            }
        }

        return $results;
    }
969812
public function listDirectories(bool $recursion = true): array {
		$filter = new class extends Filter {
			public function filter(File $dirOrPath): bool {
				/**
				 * @var File $dirOrPath
				 */
				return $dirOrPath->isDirectory();
			}
		};
		$index  = $this->addFilter($filter);
		$result = $this->listContents($recursion);
		$this->removeFilter($index);

		return $result;
	}
258957
public function getGroupNames($recursive = false)
    {
        $fields = [$this->schema->commonName(), $this->schema->memberOf()];

        $names = $this->getGroups($fields, $recursive)->map(function (Group $group) {
            return $group->getCommonName();
        })->toArray();

        return array_unique($names);
    }
473887
private function recursiveGetChilds($childs, $result)
    {
        foreach ($childs as $node) {
            $result[] = $node[$this->config['id']];
            $result = $this->recursiveGetChilds($node[$this->config['childs']], $result);
        }

        return $result;
    }
1225885
public function dump($recursive = false)
    {
        $dataset = $this->data;

        if ($recursive) {
            $dataset = static::allToArray($dataset);
        }

        return $dataset;
    }
121139
public function listContents(string $directory = '', bool $recursive = false): array
    {
        list($prefix, $directory) = $this->getPrefixAndPath($directory);

        $fs     = $this->getFileSystem($prefix);
        $list   = $fs->listContents($directory, $recursive);

        foreach ($list as &$file) {
            $file['filesystem'] = $prefix;
        }

        unset($prefix, $directory, $fs);

        return $list;
    }
1313416
public static function files($path, $recursive = false, $toArray = false, $pathType = self::PATH_ABSOLUTE)
	{
		/**
		 * Files callback
		 *
		 * @param \SplFileInfo                $current  Current item's value
		 * @param string                      $key      Current item's key
		 * @param \RecursiveDirectoryIterator $iterator Iterator being filtered
		 *
		 * @return boolean   TRUE to accept the current item, FALSE otherwise
		 */
		$callback = function ($current, $key, $iterator) {
			return $current->isFile();
		};

		$files = static::findByCallback($path, $callback, $recursive);
		
		if ($toArray) {
		    $files = static::toArray($files, $pathType);
		}
		
		return $files;
	}
1036612
public function toArray($recursive = true)
    {
        $results     = [];
        $collections = $this->collections;

        if ($recursive) {
            foreach ($collections as $key => $value) {
                if ($value instanceof CollectionInterface) {
                    /** @noinspection PhpMethodParametersCountMismatchInspection */
                    $results[$key] = $value->toArray($recursive);
                } else {
                    $results[$key] = $value;
                }
            }
        } else {
            foreach ($collections as $key => $value) {
                $results[$key] = $value;
            }
        }

        return $results;
    }
1257681
public function files($directory, $recursive = false)
    {
        $result     = [];
        $recursive  = boolval($recursive);

        if ( ! $this->isDirectory($directory)) return [];

        $items = new FilesystemIterator($directory);

        foreach ($items as $item) {
            if ($item->isFile()) {
                $result[]       = $item->getPathname();
            } elseif ($recursive && $item->isDir() && ! $item->isLink()) {
                $subFiles       = $this->files($item->getPathname(), $recursive);
                foreach ($subFiles as $file) {
                    $result[]   = $file;
                }
            }
        }

        return $result;
    }
545150
def get_children(self, *types):
        

        children_objs = OrderedDict()
        if not types:
            types = self.get_all_child_types(self.obj_ref())
        for child_type in types:
            children_list = self.api.getList(self.obj_ref(), child_type)
            children_objs.update(self._build_children_objs(child_type, children_list))
        return list(children_objs.values())
109549
public function getFiles($regex = null, $recursive = false)
    {
        //argument test
        Argument::i()
            //argument 1 must be a string
            ->test(1, 'string', 'null')
            //argument 2 must be a boolean
            ->test(2, 'bool');

        $this->absolute();

        $files = array();

        if ($handle = opendir($this->data)) {
            //for each file
            while (false !== ($file = readdir($handle))) {
                // If this is infact a file
                if (filetype($this->data . '/' . $file) == 'file'
                    && (!$regex || preg_match($regex, $file))) {
                    //add it
                    $files[] = File::i($this->data . '/' . $file);
                // recursive and this is infact a directory
                } else if ($recursive && $file != '.' && $file != '..'
                    && filetype($this->data .'/'. $file) == 'dir') {
                    $subfiles = self::i($this->data.'/'.$file);
                    $files = array_merge($files, $subfiles->getFiles($regex, $recursive));
                }
            }

            closedir($handle);
        }

        return $files;
    }
1218169
public function getChild($index, $is_recursive = true)
    {


        if (!$this->hasChild($index, $is_recursive)) {
            throw new InvalidArgumentException('Child doesn\'t exist : ' . $index);
        }

        $recursive = function(Page $page) use ($index, &$recursive) {
            foreach ($page->getChildren() as $k => $p ) {

                /**@var Page $p*/
                if ($index == $k) {
                    return $p;
                }

                if ($p->hasChildren()) {
                    if ($pp = $recursive($p)) {
                        return $pp;
                    }
                }
            }
        };

        return $recursive($this);
    }
795048
public function getFiles($recursive = false)
    {
        return $this->appendIterator(
            function ($path) use ($recursive) {
                return Filesystem::files((string) $path, $recursive);
            }
        );
    }
203651
public function getModules($recursive)
    {
        if (!is_bool($recursive)) {
            throw new \Erebot\InvalidValueException(
                'Invalid value for recursion'
            );
        }

        if ($recursive && $this->proxified !== $this) {
            $inherited = $this->proxified->getModules(true);
        } else {
            $inherited = array();
        }

        $added      = array();
        $removed    = array();
        foreach ($this->modules as $name => $module) {
            if ($module->isActive()) {
                $added[]    = $name;
            } else {
                $removed[]  = $name;
            }
        }

        $inherited = array_diff($inherited, $removed);
        return array_merge($added, $inherited);
    }
51733
public function getValue($recursive = false)
    {
        $item = $this->data[$this->position][$this->key];

        if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
            $item = $item->value;
        }
        if (!($item = $this->getStub($item)) instanceof Stub) {
            return $item;
        }
        if (Stub::TYPE_STRING === $item->type) {
            return $item->value;
        }

        $children = $item->position ? $this->data[$item->position] : [];

        foreach ($children as $k => $v) {
            if ($recursive && !($v = $this->getStub($v)) instanceof Stub) {
                continue;
            }
            $children[$k] = clone $this;
            $children[$k]->key = $k;
            $children[$k]->position = $item->position;

            if ($recursive) {
                if (Stub::TYPE_REF === $v->type && ($v = $this->getStub($v->value)) instanceof Stub) {
                    $recursive = (array) $recursive;
                    if (isset($recursive[$v->position])) {
                        continue;
                    }
                    $recursive[$v->position] = true;
                }
                $children[$k] = $children[$k]->getValue($recursive);
            }
        }

        return $children;
    }
1233405
public function getAllChildren(&$children = [])
    {
        if (!$this->allChildren && $this->getChildren()) {
            $page = $this;
            foreach ($page->getChildren() as $child) {
                $children[] = $child;
                if ($child->getChildren()) {
                    $child->getAllChildren($children);
                }
            }

            $this->setAllChildren(array_reverse($children));
        }

        return $this->allChildren;
    }
52716
public static function camelize(array $data, $recursive = true)
    {
        $return = [];

        foreach ($data as $key => $value) {
            if (is_array($value) && $recursive) {
                $value = self::camelize($value, $recursive);
            }

            $return[Inflector::camelize($key)] = $value;
        }

        return $return;
    }