/** * @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; }
/** * @expectedException \ConfigToken\Exception\AlreadyRegisteredException */ public function testAlreadyRegistered() { $tokenFilter = new CustomTokenFilter(); TokenFilterFactory::register($tokenFilter); TokenFilterFactory::register($tokenFilter); }