コード例 #1
0
ファイル: Token.php プロジェクト: liutec/cfgtokenlib
 /**
  * @param boolean $ignoreUnknownFilters
  * @throws UnknownFilterException
  * @return $this
  */
 public function applyFilters($ignoreUnknownFilters = True)
 {
     $unresolvedFilters = array();
     $filteredValue = $this->unfilteredTokenValue;
     foreach ($this->filters as $filterName) {
         if (!TokenFilterFactory::isRegisteredByName($filterName)) {
             if (!$ignoreUnknownFilters) {
                 throw new UnknownFilterException($filterName);
             }
             $unresolvedFilters[$filterName] = $filterName;
             continue;
         }
         $filteredValue = TokenFilterFactory::getFilteredValue($filterName, $filteredValue, $ignoreUnknownFilters);
     }
     $this->setTokenValue($filteredValue);
     $this->unresolvedFilters = $unresolvedFilters;
     return $this;
 }
コード例 #2
0
 /**
  * @expectedException \ConfigToken\Exception\AlreadyRegisteredException
  */
 public function testAlreadyRegistered()
 {
     $tokenFilter = new CustomTokenFilter();
     TokenFilterFactory::register($tokenFilter);
     TokenFilterFactory::register($tokenFilter);
 }