Example #1
0
 public static function constructfromReader($reader)
 {
     $instance = new self();
     if (is_a($reader, 'Keosu\\CoreBundle\\Entity\\Reader') && $reader->getService() == $instance->getService()) {
         $instance->name = $reader->getName();
         $readerConfig = $reader->getConfig();
         $instance->feed_url = $readerConfig['feed_url'];
         $instance->allowupdate = $reader->getAllowupdate();
     }
     return $instance;
 }
Example #2
0
 /**
  * Prepares adapter instance
  *
  * @param array $config
  * @throws Exception\S3\InvalidBucketException
  * @throws Exception\S3\InvalidCredentialsException
  * @return \Vegas\Filesystem\Adapter\S3|\Vegas\Filesystem\AdapterInterface
  */
 public static function setup($config)
 {
     if (!isset($config['key']) || empty($config['key'])) {
         throw new InvalidCredentialsException();
     }
     if (!isset($config['secret']) || empty($config['secret'])) {
         throw new InvalidCredentialsException();
     }
     //instantiate Amazon AWS S3 client
     $service = S3Client::factory(['key' => $config['key'], 'secret' => $config['secret'], 'scheme' => !isset($config['scheme']) ? 'https' : $config['scheme']]);
     if (!isset($config['bucket']) || empty($config['bucket'])) {
         throw new InvalidBucketException();
     }
     $client = new self($service, $config['bucket']);
     if (isset($config['region'])) {
         $client->getService()->setRegion($config['region']);
     }
     return $client;
 }