/** * Поиск и создание прокси-объекта для вызова методов типа документа. * * @param string $url URL. * @param string $urlModel Модель, которая обрабатывает URL и хранит данные о них. * * @return DoctypeResolver прокси-объект для вызова типа документа. */ public function find($url, $urlModel) { $address = $this->findUrl($url, $urlModel); return DoctypeResolver::createDoctype($address->doctype, [$urlModel => function () use($address) { return $address; }]); }
public function getDoctype($id) { $doctype = null; $leaf = $this->findLeaf($id); if ($leaf) { $doctype = $leaf['_doctype']; } if (!class_exists($doctype)) { throw new BadMethodCallException('Can\'t create class ' . $doctype); } return DoctypeResolver::createDoctype($doctype); }
private function doctype() { return DoctypeResolver::createDoctype($this->request->input('_doctype')); }