<?php
 namespace App\OfferProfileRules; class Criterion_GlobalDestination extends CriterionAbstract { public function checkFields(\App\OfferProfileRules\Fields $fields) { return $this->checkField($fields->globalDestination); } public function checkAssignedValues(\App\MessagesCollector $msgs) { if (!$this->values and in_array($this->operation, ['equal', 'notEqual'])) { $msgs->addWarning("It is mandatory to set at least one departure area."); } else { foreach ($this->values as $elem) { if (!in_array($elem, ['domestic', 'international', ])) { $msgs->addWarning("The global destination `{$elem}` is not valid."); } } } } protected function createDescription_getEntityName($code) { $_LANG = \App\Loader_Lang::getInstance()->getGlobal(); return $_LANG['Admin']['OfferProfileRules']['formFields']['globalDestinationCriterions'][$code]; } } 