Esempio n. 1
0
 /**
  * Runs through each storage backend and processes the Storable object
  * @param  StorableInterface $object
  * @return array
  * @throws \Exception
  */
 public function process(StorableInterface $object)
 {
     if (is_array($this->backends) && count($this->backends) > 0) {
         $results = [];
         $identifiers = $object->getStorableBackendIdentifiers();
         foreach ($this->backends as $identifier => $backend) {
             if (in_array($identifier, $identifiers)) {
                 $results[$identifier] = $backend->write($object);
             }
         }
         return $results;
     } else {
         throw new StorageProcessingException(sprintf("Tried to process an storable object '%s' with no backends", $object->getStorableIdentifier()));
     }
 }