* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ namespace PrestaShop\Module\Ps_metrics\Middleware; abstract class Middleware { /** * @var Middleware */ private $next; /** * @param Middleware $next * * @return Middleware */ public function linkWith(\PrestaShop\Module\Ps_metrics\Middleware\Middleware $next) { $this->next = $next; return $next; } /** * @param mixed $response * * @return array */ public function execute($response) { if (null === $this->next) { return (array) $response; } return $this->next->execute($response); } }