* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Adapter\Presenter\Order; use Exception; use Hook; use Link; use PrestaShop\PrestaShop\Adapter\Presenter\PresenterInterface; class OrderReturnPresenter implements PresenterInterface { /** * @var string */ private $prefix; /** * @var Link */ private $link; /** * OrderReturnPresenter constructor. * * @param string $prefix * @param Link $link */ public function __construct($prefix, Link $link) { $this->prefix = $prefix; $this->link = $link; } /** * @param array $orderReturn * * @return OrderReturnLazyArray * * @throws \ReflectionException */ public function present($orderReturn) { if (!is_array($orderReturn)) { throw new Exception('orderReturnPresenter can only present order_return passed as array'); } $orderReturnLazyArray = new OrderReturnLazyArray($this->prefix, $this->link, $orderReturn); Hook::exec('actionPresentOrderReturn', ['presentedOrderReturn' => &$orderReturnLazyArray] ); return $orderReturnLazyArray; } }