/** * Prepend parser to list of parsers, HIGH priority. * * @param ValueParserInterface $parser * * @return $this */ public function prependParser(ValueParserInterface $parser) { $parsers = $this->parsers; if (array_key_exists($parser->getName(), $parsers)) { unset($parsers[$parser->getName()]); } $this->parsers = array_merge([$parser->getName() => $parser], $parsers); return $this; }
/** * @param ValueParserInterface $parser * * @return $this */ public function addParser(ValueParserInterface $parser) { $this->parsers[$parser->getName()] = $parser; return $this; }