/** * {@inheritDoc} */ public function createRecursive($mode = AdapterInterface::CREATION_MODE) { $parentPath = explode(DIRECTORY_SEPARATOR, $this->path); array_pop($parentPath); $parentPath = implode(DIRECTORY_SEPARATOR, $parentPath); $parentDirectory = $this->filesystem->dir($parentPath); return $parentDirectory->stat()->then(null, function () use($parentDirectory, $mode) { return $parentDirectory->createRecursive($mode); })->then(function () use($mode) { return $this->create($mode); })->then(function () { return new FulfilledPromise(); }); }
/** * @param array $node * @return \React\Promise\PromiseInterface */ public function detect(array $node) { return $this->filesystem->getAdapter()->stat($node['path'])->then(function ($stat) { return $this->walkMapping($stat); }); }
/** * @param string $filename * @param FilesystemInterface $filesystem */ public function __construct($filename, FilesystemInterface $filesystem) { $this->filesystem = $filesystem; $this->adapter = $filesystem->getAdapter(); $this->createNameNParentFromFilename($filename); }