/** * 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)); }
public function __construct(ContainerInterface $container, $file_path) { $this->_file_path = $file_path; parent::__construct($container); }