public function handle(Document $document) { /** @var ParserInterface $parser */ $parser = app()->build($this->config['parser']); $parserName = $parser->getName(); $parserConfig = $this->config->get($parserName, []); $parser->setConfig($parserConfig->toArray()); $document->setContent($parser->parse($document->getContent())); }
public static function registerExtension($class, $name, $extension) { if (null === static::$resolved) { static::$resolved = new Collection(); } \Illuminate\Container\Container::getInstance()->resolving($class, function ($instance) use($name, $extension) { $className = get_class($instance); $isExtended = static::$resolved->where('className', $className)->where('name', $name)->count() > 0; if ($isExtended) { return; } static::$resolved->push(compact('className', 'name')); forward_static_call_array($className . '::extend', [$name, $extension]); }); }
/** * Run a content processor * * @param $name * * @throws \Codex\Exception\CodexException */ protected function runProcessor($name) { if ($this->processed->has($name)) { return; } $this->processed->set($name, $this->getProcessors()->run($name, $this)); }
protected function render($with = []) { $view = view($this->codex->view('processors.buttons'), $this->config->except('buttons', 'groups')->all())->with($with); return $view->render(); }
/** * sortAssets method * * @param array|Collection $all * * @return \Codex\Support\Collection */ protected function sorter($all = []) { $all = $all instanceof Collection ? $all : new Collection($all); $sorter = new Sorter(); $sorted = new Collection(); foreach ($all as $name => $asset) { $sorter->addItem($asset['name'], $asset['depends']); } foreach ($sorter->sort() as $name) { $sorted->add($all->where('name', $name)->first()); } return $sorted; }
protected function getEnabledPlugins() { return $this->config->except('js_path', 'css_path', 'plugin_path', 'plugins')->keys()->toArray(); }
/** * all method * @return array */ public function all() { return $this->items->all(); }
public function toArray() { return ['processors' => $this->processors->toArray(), 'hooks' => $this->hooks->toArray(), 'plugins' => $this->plugins->toArray(), 'views' => $this->views->toArray()]; }
/** * Get default ref. * * @return Ref */ public function getDefault() { return $this->items->get($this->default); }
/** * Offset to unset * * @link http://php.net/manual/en/arrayaccess.offsetunset.php * * @param mixed $offset <p> * The offset to unset. * </p> * * @return void * @since 5.0.0 */ public function offsetUnset($offset) { $this->items->forget($offset); }