Inheritance: use trait Webiny\Component\StdLib\SingletonTrait
Example #1
0
 /**
  * Constructor
  *
  * @param string  $directory Directory of the storage
  * @param string  $publicUrl Public storage URL
  * @param bool    $dateFolderStructure If true, will append Y/m/d to the key
  * @param boolean $create Whether to create the directory if it does not
  *                                     exist (default FALSE)
  *
  * @throws StorageException
  */
 public function __construct($directory, $publicUrl = '', $dateFolderStructure = false, $create = false)
 {
     $this->helper = LocalHelper::getInstance();
     $this->directory = $this->helper->normalizeDirectoryPath($directory);
     $this->publicUrl = $publicUrl;
     $this->dateFolderStructure = $dateFolderStructure;
     $this->create = $create;
 }
Example #2
0
 /**
  * Constructor
  *
  * @param array|ArrayObject $config
  *
  * @throws StorageException
  */
 public function __construct($config)
 {
     if (is_array($config)) {
         $config = new ArrayObject($config);
     }
     if (!$config instanceof ArrayObject) {
         throw new StorageException('Storage driver config must be an array or ArrayObject!');
     }
     $this->helper = LocalHelper::getInstance();
     $this->directory = $this->helper->normalizeDirectoryPath($config->key('Directory', '', true));
     $this->publicUrl = $config->key('PublicUrl', '', true);
     $this->dateFolderStructure = $config->key('DateFolderStructure', false, true);
     $this->create = $config->key('Create', false, true);
 }