<?php
namespace Website\Widgets\Disqus; use Moto; use Moto\Service\AbstractStaticService; use Zend; class Service extends AbstractStaticService { const ERROR_UNABLE_TO_SEND_MESSAGE = 'COMMON.ERROR.UNABLE_TO_SEND'; const ERROR_UNABLE_TO_SEND_CODE = 500; protected static $_resourceName = 'widget.disqus'; protected static $_lists; public static function getOptions() { return Moto\Website\Integration::first('disqus')->toArray(); } public static function setOptions($request = null) { if (null === $request) { $request = static::getRequest()->getParams(); } $filter = new InputFilter\SetOptions(); $filter->setData($request); if (!$filter->isValid()) { throw new Moto\System\Exception(Moto\System\Exception::ERROR_BAD_REQUEST_MESSAGE, Moto\System\Exception::ERROR_BAD_REQUEST_CODE, $filter->getMessagesKeys()); } $model = Moto\Website\Integration::first('disqus'); $model->fromArray($filter->getValues()); $model->save(); return $model->toArray(); } }