Implementation of the HuggableInterface
@param Huggable $huggable
175255
public function hug(Huggable $huggable)
    {
        // If huggable is a container
        if ($huggable instanceof ContainerInterface && $huggable->has(Map::class)) {
            $this->registerRoutes($huggable->get(Map::class));
        }
        $this->returnHug($this);
    }
560344
public function add(callable $newTopMiddleware)
    {
        if ($this->isGuarded) {
            if ($newTopMiddleware instanceof GuardInterface) {
                throw new \RuntimeException('Invalid state: already guarded');
            }
        } else {
            if (!($newTopMiddleware instanceof GuardInterface)) {
                throw new \RuntimeException('Invalid state: not guarded');
            }
        }

        $clone = clone $this;
        $clone->isGuarded = true;

        return $clone->push($newTopMiddleware);
    }
983173
private function createServiceFactoryFromCallable(Invokable $invokable): Closure
    {
        return function (array $arguments = []) use ($invokable) {
            return $this->invoker->invoke($invokable, $arguments);
        };
    }
332188
public function setHandler($handler, $handlerMethod = null) : void
    {
        if (!is_callable($handler) && is_null($handlerMethod)) {
            throw new \InvalidArgumentException(
                'In case the $handler is not a callable, $handlerMethod must specify a method to be called'
            );
        }
        $this->handler = $handler;
        $this->handlerMethod = $handlerMethod;
    }
143886
public function protect($callable)
    {
        try {
            return parent::protect($callable);
        } catch (PimpleExpectedInvokableException $e) {
            throw new ExpectedInvokableException(
                $e->getMessage(),
                $e->getCode(),
                $e
            );
        } catch (\Throwable $e) {
            throw new ContainerException(
                $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
40399
public function setHook(string $hook, callable $callable): self
    {
        $availableHooks = [self::BEFORE_PAUSE_HOOK, self::AFTER_PAUSE_HOOK];

        if (!in_array($hook, $availableHooks)) {
            throw new \InvalidArgumentException('Invalid hook. Available hooks: ' . join(', ', $availableHooks));
        }

        $this->hooks[$hook] = $callable;
        return $this;
    }
1118886
private function cspAllow(
        $friendlyDirective,
        $friendlySource = null,
        $reportOnly = null
    ) {
        Types::assert(
            ['string' => [$friendlyDirective, $friendlySource]]
        );

        $directive = $this->longDirective($friendlyDirective);

        $source = $this->longSource($friendlySource);

        $this->addCSPSource($directive, $source, $reportOnly);
    }
733651
protected function _assignCoverable()
    {
        if (!$this->_states['lines']) {
            return;
        }

        foreach ($this->_root->lines['content'] as $index => $value) {
            $this->_root->lines['content'][$index]['coverable'] = $this->_isCoverable($index);
        }
    }
438750
protected function registerServiceProvider($pluggable)
    {
        $pluggable = Str::studly($pluggable['slug']);
        $file = $this->getPath()."/{$pluggable}/Providers/{$pluggable}ServiceProvider.php";
        $namespace = $this->getNamespace()."{$pluggable}\\Providers\\{$pluggable}ServiceProvider";

        if (!$this->files->exists($file)) {
            $message = "Pluggable [{$pluggable}] must have a \"{$pluggable}/Providers/{$pluggable}ServiceProvider.php\" file";

            throw new FileNotFoundException($message);
        }

        App::register($namespace);
    }
368611
private function setMoneyEmbeddable(
        MoneyEmbeddableInterface $moneyEmbeddable,
        bool $notify = true
    ): self {
        $this->moneyEmbeddable = $moneyEmbeddable;
        $this->moneyEmbeddable->setOwningEntity($this);
        if (true === $notify) {
            $this->notifyEmbeddablePrefixedProperties(
                HasMoneyEmbeddableInterface::PROP_MONEY_EMBEDDABLE
            );
        }

        return $this;
    }
909436
public function extend($id, $callable)
    {
        try {
            return parent::extend($id, $callable);
        } catch (UnknownIdentifierException $e) {
            throw new ContainerNotFoundException(
                $e->getMessage(),
                $e->getCode(),
                $e
            );
        } catch (PimpleFrozenServiceException $e) {
            throw new FrozenServiceException($id);
        } catch (PimpleInvalidServiceIdentifierException $e) {
            throw new InvalidServiceIdentifierException($id);
        } catch (PimpleExpectedInvokableException $e) {
            throw new ExpectedInvokableException(
                $e->getMessage(),
                $e->getCode(),
                $e
            );
        } catch (\Throwable $e) {
            throw new ContainerException(
                $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
863956
public function wrap($callable, $params = [])
    {
        $kernel = new ClosureHttpKernel();

        if (is_callable($callable)) {
            $middleware = $callable($kernel);
        } else {
            // Add kernel as 'app' parameter
            $params = ['app' => $kernel] + $params;
            $makeMethod = method_exists($this->container, 'makeWith') ?  'makeWith' : 'make';
            $middleware = $this->container->$makeMethod($callable, $params);
        }

        if ($middleware instanceof TerminableInterface) {
            return new TerminableClosureMiddleware($kernel, $middleware);
        }

        return new ClosureMiddleware($kernel, $middleware);
    }
513000
public function interactWith(
        FormInterface $form,
        HelperSet $helperSet,
        InputInterface $input,
        OutputInterface $output
    ) {
        if (FormUtil::isTypeInAncestry($form, ButtonType::class)) {
            throw new NoNeedToInteractWithForm();
        }

        // by default, we let another interactor interact with this form
        throw new CanNotInteractWithForm();
    }
436422
public function set_expandable($expandable) {
        foreach ($expandable as $node) {
            $this->expandable[$node['key'].':'.$node['type']] = $node;
        }
    }
940754
protected function setSlug($slug)
    {
        $config  = $this->getSluggableConfig();
        $save_to = $config['save_to'];

        if ($this->storeSlugLocally()) {
            $this->setAttribute($save_to, $slug);
            return;
        }

        $this->setSlugInCmsTable($slug);
    }
272773
public function deleted(ViewableContract $viewable)
    {
        if ($this->removeViewsOnDelete($viewable)) {
            app(Views::class)->forViewable($viewable)->destroy();
        }
    }
306594
public static function bootTaggable()
    {
        static::created(function (Model $taggableModel) {
            if ($taggableModel->queuedTags) {
                $taggableModel->tag($taggableModel->queuedTags);

                $taggableModel->queuedTags = [];
            }
        });

        static::deleted(function (Model $taggableModel) {
            $taggableModel->tags()->detach();
        });
    }