Example #1
0
File: Code.php Project: iwatea/Swim
 /**
  * Code.ymlから指定された$key,$codeのoptionを取得します。
  *
  * @param string $key 第一キー
  * @param string $code
  * @return array
  */
 public function getOption($key, $code)
 {
     if (is_array($key)) {
         throw new IllegalArgumentException('Codeはkeyに配列を指定できません');
     }
     foreach (parent::getData($key) as $element) {
         if ($element['code'] === $code) {
             if (isset($element['option'])) {
                 return $element['option'];
             } else {
                 throw new DataNotFoundException(sprintf('%s.%sにはoptionが設定されていません', $key, $code));
             }
         }
     }
     throw new IllegalArgumentException(sprintf('%s.%sは存在しません', $key, $code));
 }
Example #2
0
 public function __construct(ContainerInterface $container, $file_path)
 {
     $this->_file_path = $file_path;
     parent::__construct($container);
 }