@param array $fieldResults
@param array $options

@return bool
347417
public static function invoke(
        array $fieldResults,
        array $options = []
    ): bool {
        /** @var ValidationResult $validationResult */
        foreach ($fieldResults as $validationResult) {
            if (!$validationResult->isValid()) {
                return false;
            }
        }

        return true;
    }
677220
public function setOptionsArray($options) {
    foreach($options as $key => $value) {
      if (!$this->setOption($key, $value)) {
        return false;
      }
    }
    return true;
  }
1099836
public static function invoke(
        ValidationResult $validationResult,
        array $options = []
    ): ValidationResult {
        $fieldConfig = Property::getArray(
            $options,
            static::OPTION_FIELD_CONFIG
        );

        if (empty($fieldConfig)) {
            return $validationResult;
        }

        $details = $validationResult->getDetails();
        $details[static::DETAIL_FIELD_CONFIG] = $fieldConfig;

        if ($validationResult instanceof ValidationResultFields) {
            return new ValidationResultFieldsBasic(
                $validationResult->isValid(),
                $validationResult->getCode(),
                $details,
                $validationResult->getFieldResults()
            );
        }

        return new ValidationResultBasic(
            $validationResult->isValid(),
            $validationResult->getCode(),
            $details
        );
    }
98973
public function getResults(array $options = []) : ?SavedSearch
    {
        $this->setContainerId($options['entity']);

        $table = TableRegistry::get('Search.SavedSearches');

        /** @var \Search\Model\Entity\SavedSearch|null */
        $savedSearch = $table->find()
            ->where(['id' => $this->widget->get('widget_id')])
            ->enableHydration(true)
            ->first();

        if (null === $savedSearch) {
            $this->errors[] = 'No data found for this entity';

            return null;
        }

        /** @var \Cake\Datasource\RepositoryInterface */
        $table = TableRegistry::get($savedSearch->get('model'));

        $search = new Search($table, $options['user']);
        // keeps backward compatibility
        $entity = $search->reset($savedSearch);
        if (null === $entity) {
            $this->errors[] = 'Failed to reset entity';

            return null;
        }
        $content = $entity->get('content');
        $content['saved'] = Validator::validateData($table, $content['saved'], $options['user']);
        $entity->set('content', $content);

        $this->options['fields'] = Utility::instance()->getSearchableFields($table, $options['user']);
        $this->options['associationLabels'] = Utility::instance()->getAssociationLabels($table);

        $this->data = $entity;

        return $this->data;
    }
1128498
public static function create(array $tokens, array $options = []) {
        HashMap::assert($tokens, 'tokens');

        $operation = SqlOperation::create($tokens);
        if ($operation !== SqlOperations::SELECT) return null;

        $query = implode('&', array_filter([
            self::createConditionals($tokens),
            self::createPagination($tokens, $options),
        ]));

        return $query;
    }
802132
public function getPopular(array $options = [], array $headers = [])
    {
        return $this->getFactory()->createResultCollection(
            $this->getApi()->getPopular($options, $headers)
        );
    }
1091464
public function clockpicker($fieldName, array $options = [])
    {
        $defaults = [
            'div' => [
                'class' => 'form-group',
            ],
            'label' => [
                'class' => 'control-label form-control-label',
            ],
            'class' => 'form-control form-control-clockpicker',
            'type' => 'text',
        ];
        $options = Hash::merge($defaults, $options);
        return parent::input($fieldName, $options);
    }
347423
protected function prepareResult(&$data, array $options)
    {
        if (!empty($options['unserialize']) && !empty($data)) {
            foreach ((array) $options['unserialize'] as $field) {
                $data[$field] = empty($data[$field]) ? array() : unserialize($data[$field]);
            }
        }
    }
968384
protected function setFieldResults(array $fieldResults)
    {
        foreach ($fieldResults as $fieldName => $validationResult) {
            $this->setFieldResult($fieldName, $validationResult);
        }
    }
1306599
public function isValid($value = null, array $options = []): bool
    {
        if (\count($options) > 0) {
            $this->setOptions($options);
        }
        $this->setValue($value);
        $this->errors = [];

        return $this->validateDateTime();
    }
1308527
public function file($fieldName, array $options = [])
    {
        $errorSuffix = null;
        $error       = $this->error($fieldName);
        $content     = parent::file($fieldName, $options);

        if ($this->getConfig('materializeCss', false) === false) {
            return $content;
        }

        $options = $this->_parseOptions($fieldName, $options);

        $options['type'] = __FUNCTION__;
        if ($error !== '') {
            $options['error'] = $error;
            $errorSuffix = 'Error';
        }

        $result = $this->_inputContainerTemplate([
            'error'       => $error,
            'content'     => $content,
            'options'     => $options,
            'errorSuffix' => $errorSuffix
        ]);

        return $result;
    }
125544
public function validates($entity, $options = [])
    {
        $fieldname = $this->name();

        if (!isset($entity->{$fieldname})) {
            return true;
        }
        return $entity->{$fieldname}->validates($options);
    }
1142180
public function getField($table, $field, $options = array(), $start = 0)
    {
        // Get Result
        $result = $this->getRow($table, array($field), $options, $start);
        if (count($result) >= 1)
            return array_shift($result);
        else
            return false;
    }
962899
public function query($query, $options = [])
    {
        $url = $this->instanceURLRepo->get();
        $url .= $this->resourceRepo->get('query');
        $url .= '?q=';
        $url .= urlencode($query);

        $queryResults = $this->request($url, $options);

        return $queryResults;
    }
798539
protected function checkIfOptionsExists(array $values, array $options)
    {
        foreach ($values as $selected) {
            $found = false;

            // walk all options
            foreach ($options as $option) {
                if ($option instanceof Option) {
                    if ($option->getValue() == $selected) {
                        $found = true;
                        break;
                    }
                } elseif ($option instanceof Optgroup) {
                    $options2 = $option->getOptions();
                    foreach ($options2 as $option2) {
                        if ($option2->getValue() == $selected) {
                            $found = true;
                            break 2;
                        }
                    }
                }
            }

            // if not found, then error!
            if (!$found) {
                // troubles? Then you want to probably log something here
                return false;
            }
        }

        return true;
    }
1233889
public function datepicker($fieldName, $options = [])
    {
        $defaults = [
            'class' => 'form-control form-control-datepicker',
            'type' => 'text',
        ];
        $options = array_merge($defaults, $options);
        return parent::input($fieldName, $options);
    }
975803
public function containsOption($optionValue, $options)
    {
        if ($this->validationDisabled) {
            return true;
        }

        foreach ($options as $option) {
            if ($option['value'] == $optionValue) {
                return true;
            }
        }

        return false;
    }