public function read()
 {
     $resources = [];
     $files = scandir($this->path);
     foreach ($files as $file) {
         if (!in_array($file, ['.', '..'])) {
             $resource_data = $this->serializer->deserialize($this->path . DIRECTORY_SEPARATOR . $file);
             $resource = ResourceFactory::get($this->type);
             $resource->setData($resource_data);
             $resources[] = $resource;
         }
     }
     return $resources;
 }
Beispiel #2
0
 /**
  * @param $type string
  * @param $id int
  * @return IResource
  */
 public function getOnce($type, $id)
 {
     $resource = ResourceFactory::get($type);
     $resource->setData($this->driver->find($type, $id));
     return $resource;
 }