| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace ModulesGarden\Servers\ZimbraEmail\App\Libs\Restrictions;
- use ModulesGarden\Servers\ZimbraEmail\App\Libs\Restrictions\Interfaces\AbstractRestriction;
- use ModulesGarden\Servers\ZimbraEmail\App\Libs\Restrictions\Interfaces\RuleInterface;
- /**
- *
- * Created by PhpStorm.
- * User: Tomasz Bielecki ( tomasz.bi@modulesgarden.com )
- * Date: 07.11.19
- * Time: 09:58
- * Class Restriction
- */
- class Restriction extends AbstractRestriction
- {
- /**
- * {@inheritDoc}
- */
- public function check()
- {
- /**
- *
- * check if rule is valid
- */
- if($this->rule->isValid() !== false)
- {
- return true;
- }
- /**
- * set status as invalid
- */
- $this->setIsValid(self::STATUS_INVALID);
- /**
- *
- * set error message
- */
- $this->setErrorMessage($this->rule->getMessage());
- /**
- *
- * throw error if is enabled
- */
- if($this->isThrowErrorEnabled())
- {
- throw new \Exception($this->getErrorMessage());
- }
- /**
- *
- * return valid status
- */
- return $this->isValid();
- }
- }
|