/** * {@inheritDoc} * @see \Fixin\Delivery\Cargo\CargoHandlerInterface::handle($cargo) */ public function handle(CargoInterface $cargo) : CargoInterface { if (in_array($cargo->getContentType(), static::ALLOWED_TYPES)) { $cargo->setContent($this->container->get('Base\\Json\\Json')->decode($cargo->getContent())); } return $cargo; }
/** * {@inheritDoc} * @see \Fixin\Delivery\Cargo\CargoHandlerInterface::handle($cargo) */ public function handle(CargoInterface $cargo) : CargoInterface { if (in_array($cargo->getContentType(), static::ALLOWED_TYPES)) { $content = $cargo->getContent(); $view = $this->container->clonePrototype('View\\View'); $view->setTemplate($this->template); $cargo->setContent($view); if ($content instanceof ViewInterface) { $view->setChild($this->contentName, $content); return $cargo; } $view->setVariable($this->contentName, $content); } return $cargo; }