コード例 #1
0
 /**
  * @return \Elastica\Client
  */
 protected function createZedClient()
 {
     $config = ['transport' => ucfirst(Config::get(ApplicationConstants::ELASTICA_PARAMETER__TRANSPORT)), 'port' => Config::get(ApplicationConstants::ELASTICA_PARAMETER__PORT), 'host' => Config::get(ApplicationConstants::ELASTICA_PARAMETER__HOST)];
     if (Config::hasValue(ApplicationConstants::ELASTICA_PARAMETER__AUTH_HEADER)) {
         $config['headers'] = ['Authorization' => 'Basic ' . Config::get(ApplicationConstants::ELASTICA_PARAMETER__AUTH_HEADER)];
     }
     return new Client($config);
 }
コード例 #2
0
 /**
  * @param array $composerJson
  * @param \Symfony\Component\Finder\SplFileInfo $composerJsonFile
  *
  * @return array
  */
 public function update(array $composerJson, SplFileInfo $composerJsonFile)
 {
     if (!Config::hasValue(DevelopmentConstants::COMPOSER_BRANCH_ALIAS)) {
         return $composerJson;
     }
     $alias = Config::get(DevelopmentConstants::COMPOSER_BRANCH_ALIAS);
     $composerJson[self::KEY_EXTRA] = [self::KEY_BRANCH_ALIAS => [self::KEY_MASTER_BRANCH => $alias]];
     return $composerJson;
 }
コード例 #3
0
 /**
  * @param array $composerJson
  * @param \Symfony\Component\Finder\SplFileInfo $composerJsonFile
  *
  * @return array
  */
 public function update(array $composerJson, SplFileInfo $composerJsonFile)
 {
     $bundleName = $this->getBundleName($composerJson);
     $dependentBundles = $this->getDependentBundles($bundleName);
     if (!Config::hasValue(DevelopmentConstants::COMPOSER_REQUIRE_VERSION)) {
         return $composerJson;
     }
     $composerRequireVersion = Config::get(DevelopmentConstants::COMPOSER_REQUIRE_VERSION);
     if (preg_match('/^[0-9]/', $composerRequireVersion)) {
         $composerRequireVersion = self::RELEASE_OPERATOR . $composerRequireVersion;
     }
     foreach ($dependentBundles as $dependentBundle) {
         $filter = new CamelCaseToDash();
         $dependentBundle = strtolower($filter->filter($dependentBundle));
         $composerJson[self::KEY_REQUIRE]['spryker/' . $dependentBundle] = $composerRequireVersion;
     }
     return $composerJson;
 }
コード例 #4
0
 /**
  * @throws \Exception
  *
  * @return void
  */
 protected function assertConfig()
 {
     if (!Config::hasValue(KernelConstants::AUTO_LOADER_UNRESOLVABLE_CACHE_PROVIDER)) {
         throw new Exception('Undefined UnresolvableCacheProvider. Make sure class exists and it\'s set in AUTO_LOADER_UNRESOLVABLE_CACHE_PROVIDER');
     }
 }
コード例 #5
0
ファイル: AclConfig.php プロジェクト: spryker/Acl
 /**
  * @return array
  */
 public function getUserRuleWhitelist()
 {
     if (Config::hasValue(AclConstants::ACL_USER_RULE_WHITELIST)) {
         return Config::get(AclConstants::ACL_USER_RULE_WHITELIST);
     }
     return [];
 }
コード例 #6
0
 /**
  * @param string $kvAdapter
  *
  * @throws \ErrorException
  *
  * @return array
  */
 protected static function createAdapterConfig($kvAdapter)
 {
     $config = null;
     switch ($kvAdapter) {
         case static::KV_ADAPTER_REDIS:
             $config = ['protocol' => Config::get(StorageConstants::STORAGE_REDIS_PROTOCOL, Config::get(LibraryConstants::YVES_STORAGE_SESSION_REDIS_PROTOCOL)), 'port' => Config::get(StorageConstants::STORAGE_REDIS_PORT, Config::get(LibraryConstants::YVES_STORAGE_SESSION_REDIS_PORT)), 'host' => Config::get(StorageConstants::STORAGE_REDIS_HOST, Config::get(LibraryConstants::YVES_STORAGE_SESSION_REDIS_HOST)), 'database' => Config::get(StorageConstants::STORAGE_REDIS_DATABASE, static::DEFAULT_REDIS_DATABASE)];
             // TODO: Remove elseif, only there for BC
             if (Config::hasKey(StorageConstants::STORAGE_REDIS_PASSWORD)) {
                 $config['password'] = Config::get(StorageConstants::STORAGE_REDIS_PASSWORD);
             } elseif (Config::hasKey(LibraryConstants::YVES_STORAGE_SESSION_REDIS_PASSWORD)) {
                 $config['password'] = Config::get(LibraryConstants::YVES_STORAGE_SESSION_REDIS_PASSWORD);
             }
             // TODO: Remove elseif, only there for BC
             $config['persistent'] = false;
             if (Config::hasKey(StorageConstants::STORAGE_PERSISTENT_CONNECTION)) {
                 $config['persistent'] = (bool) Config::get(StorageConstants::STORAGE_PERSISTENT_CONNECTION);
             } elseif (Config::hasKey(LibraryConstants::YVES_STORAGE_SESSION_PERSISTENT_CONNECTION)) {
                 $config['persistent'] = Config::get(LibraryConstants::YVES_STORAGE_SESSION_PERSISTENT_CONNECTION);
             }
             break;
         case static::SEARCH_ELASTICA_ADAPTER:
             $config = ['transport' => ucfirst(Config::get(LibraryConstants::ELASTICA_PARAMETER__TRANSPORT)), 'port' => Config::get(LibraryConstants::ELASTICA_PARAMETER__PORT), 'host' => Config::get(LibraryConstants::ELASTICA_PARAMETER__HOST)];
             if (Config::hasValue(LibraryConstants::ELASTICA_PARAMETER__AUTH_HEADER)) {
                 $config['headers'] = ['Authorization' => 'Basic ' . Config::get(LibraryConstants::ELASTICA_PARAMETER__AUTH_HEADER)];
             }
             break;
     }
     if ($config === null) {
         throw new ErrorException('Missing implementation for adapter ' . $kvAdapter);
     }
     return $config;
 }