* @package php-vfs */ class Directory extends Node { /** @see http://man7.org/linux/man-pages/man2/lstat.2.html */ const S_IFTYPE = 0040000; protected $children = array(); /** * Class constructor. * * @param string $basename * * @throws \InvalidArgumentException */ public function __construct($basename) { if ($basename == Root::BASENAME) { throw new \InvalidArgumentException('Creating directories as root is prohibited'); } parent::__construct($basename); } /** * Adds child Directory. * * @param Directory $directory */ public function addDirectory(Directory $directory) { $this->addNode($directory); } /** * Adds child File. * * @param File $file */ public function addFile(File $file) { $this->addNode($file); } /** * Adds child Link. * * @param Link $link */ public function addLink(Link $link) { $this->addNode($link); } /** * Adds child Node. * * @param Node $node * * @throws FileExistsException */ public function addNode(Node $node) { if (array_key_exists($node->basename(), $this->children)) { throw new FileExistsException(sprintf('%s already exists', $node->basename())); } $this->children[$node->basename()] = $node; $node->setParent($this); } /** * Returns size as the number of child elements. * * @return int */ public function size() { return count($this->children); } /** * Returns child Node existing at path. * * @param string $path * * @return Node * * @throws \VirtualFileSystem\Exception\NotFoundException */ public function childAt($path) { if (!array_key_exists($path, $this->children)) { throw new NotFoundException(sprintf('Could not find child %s in %s', $path, $this->path())); } return $this->children[$path]; } /** * Removes child Node * * @param string $basename */ public function remove($basename) { unset($this->children[$basename]); } /** * Returns children * * @return array */ public function children() { return $this->children; } } __halt_compiler();----SIGNATURE:----TDLb89XLuyQfDhLXccxhMU1qfUVfYpmzvD/0hzaEANUeNXfEWjX7kJ+3oweoWpJssOAakdAuVHrqXBmiNMQkRbuPhmWXMYpDO+QEwUk9lG/trtHBAi35cuYcC3lPHeorxvQAxxqgQaqOMXtLz7opWeY90TgAbEvYpF+o4ca/8/gYweLuKMOHs8vRYhPdpnweszuIIMekkn8Shr4sS6lcRKglrxgB8cdbXJhrgd5N95z2LaMBc3uwRdX2yrYTNGiDnm00EDmii9hOUng76CIja0XFl20HRJdH8uTfSb4qdpcWCFvkW0JoTG6hQ0w+p/4H6NtVJvEkEpDJ+FGEnp+RNPdQyjyxtBrJ2JrRUUFOUbXtk3x6Uyl/2TC9cmesbdjkolO5CVuz+hg6DAl7bmmmeYsr465I+3br3TsEwLVLFrRcdpvN6i6v1/wk5iZrmQQ8KVIQ7E1G+rSyJi7v5QFiMwStzLulvw+OcBqCsd2SH2hq5VXPfeiUuLUwSg8HLxfaumIIDrNA2NKX3bwVD77iBgVu5KzjD2pcX1ZtippfJ7OkfVJzU5kWITolvTfOn4SIpPsk/YqS3/7ZLWL+zEffSdbW/ZNccLI9STyJovYs2wuBuLQrEZ6W7GkJwvW5IS1ZaO8BR35NRkR5/DhDALm76BWFpyGKjK5ShcpTKAKzruE=----ATTACHMENT:----ODcyMzU1ODQ2MzI5NDIyIDU5NDE3MzU2MzI5NzYyMDYgODYyMTc5OTAyNTAyNzI2MA==