コード例 #1
0
ファイル: typed_set.php プロジェクト: cepharum/txf
 /**
  * Extracts path-selected subset from set for read access.
  *
  * Using $default is provided since NULL might be a valid result, too.
  *
  * @throws \UnexpectedValueException on trying to descend into leaf node
  *
  * @param string $path pathname to subset
  * @param type|array $default default to use
  * @return mixed found subset, $default on missing
  */
 public function read($path, $default = null)
 {
     if (is_array($default)) {
         $default = $this->filterByType($default, false);
     } else {
         if (!is_null($default) && !$this->isMatchingType($default)) {
             throw new \InvalidArgumentException('invalid type of default value');
         }
     }
     return parent::read($path, $default);
 }