/** * Transform resource into a config array * @param FilesystemResource $resource * @return array */ public function transform(FilesystemResource $resource) { $config = json_decode($resource->getBody(), true); return $this->validateConfig($config) ? $config : []; }
/** * Validate extension * @param FilesystemResource $resource * @return bool */ public function validateExtension(FilesystemResource $resource) { return pathinfo($resource->getPath(), PATHINFO_EXTENSION) === $this->getExtension(); }
/** * {@inheritdoc} */ protected function addFilesystemResource($path, FilesystemResource $resource) { // Read children before attaching the resource to this repository $children = $resource->listChildren(); parent::addFilesystemResource($path, $resource); // Recursively add all child resources $basePath = '/' === $path ? $path : $path . '/'; foreach ($children as $name => $child) { $this->addFilesystemResource($basePath . $name, $child); } }
/** * Transform resource into a config array * @param FilesystemResource $resource * @return array */ public function transform(FilesystemResource $resource) { $path = $resource->getFilesystemPath(); $config = (require $path); return $this->validateConfig($config) ? $config : []; }