public function addParser($name, $class, $before = null)
    {
        if ($before === null) {
            $this->parsers[$name] = $class;
            return $this;
        }

        if (($offset = array_search($before, array_keys($this->parsers))) !== false) {
            $this->parsers = array_slice($this->parsers, 0, $offset, true)
                + array($name => $class)
                + array_slice($this->parsers, $offset, null, true);

            return $this;
        }

        throw new \RuntimeException(sprintf('Parser "%s" does not exist.', $before));
    }