@param array  $options
@param string $method     the method requiring the validation

@return array
768189
protected function validateOptions(array $options, $method)
    {
        $options = parent::validateOptions($options, $method);

        $options = $this->setOptionIfNotSet($options, 'width', 0);
        $options = $this->setOptionIfNotSet($options, 'height', 0);

        $this->checkIfInteger($options, 'width', __METHOD__);
        $this->checkIfInteger($options, 'height', __METHOD__);

        return $options;
    }
978662
public function validates($options = [])
    {
        $success = true;
        foreach ($this as $entity) {
            if (!$entity->validates($options)) {
                $success = false;
            }
        }
        return $success;
    }
922507
protected function createRequest($method, $url, $token, array $options)
    {
        $defaults = [
            'headers' => $this->getHeaders($token),
        ];

        $options = array_merge_recursive($defaults, $options);
        $factory = $this->getRequestFactory();

        return $factory->getRequestWithOptions($method, $url, $options);
    }
276447
private function validate(array $options)
    {
        if (array_key_exists('mandatorId', $options)) {
            $options['mandatorId'] = (int) $options['mandatorId'];
        }

        list($customerId, $licenseKey) =
            $this->siteAccessHelper->getRecommendationServiceCredentials($options['mandatorId'], $options['siteaccess']);

        $options = array_filter($options, function ($val) {
            return $val !== null;
        });

        $resolver = new OptionsResolver();
        $resolver->setRequired(['contentTypeIdList', 'host', 'webHook', 'transaction']);
        $resolver->setDefined(array_keys($options));
        $resolver->setDefaults([
            'transaction' => (new \DateTime())->format('YmdHis') . rand(111, 999),
            'customerId' => $customerId,
            'licenseKey' => $licenseKey,
            'mandatorId' => null,
            'siteaccess' => null,
            'lang' => null,
        ]);

        return $resolver->resolve($options);
    }
883865
protected function _doRequest($method, $uri, $options)
    {
        return $this->httpClient->request($method, $uri, $options);
    }
507753
protected static function checkOptions(array $options)
    {
        if (isset($options['value'])) {
            $value = $options['value'];
            unset($options['value']);
            $options['value'] = $value;
        }

        return $options;
    }
1130602
protected function validateClientOptions(array $options) {
        parent::validateClientOptions($options);
        
        \CharlotteDunois\Validation\Validator::make($options, array(
            'commandPrefix' => 'string|nullable',
            'commandBlockedMessagePattern' => 'boolean',
            'commandEditableDuration' => 'integer',
            'commandThrottlingMessagePattern' => 'boolean',
            'nonCommandEditable' => 'boolean',
            'unknownCommandResponse' => 'boolean',
            'owners' => 'array:string|array:integer',
            'invite' => 'string'
        ))->throw(\InvalidArgumentException::class);
    }
1247564
public static function validateOptions(array $options): array
    {
        foreach ($options as $option => $value) {
            switch ($option) {
                case Scheduler::OPTION_AT:
                case Scheduler::OPTION_INTERVAL:
                case Scheduler::OPTION_RETRY:
                case Scheduler::OPTION_RETRY_INTERVAL:
                case Scheduler::OPTION_TIMEOUT:
                    if (!is_int($value)) {
                        throw new InvalidArgumentException('option '.$option.' must be an integer');
                    }

                break;
                case Scheduler::OPTION_IGNORE_DATA:
                case Scheduler::OPTION_FORCE_SPAWN:
                    if (!is_bool($value)) {
                        throw new InvalidArgumentException('option '.$option.' must be a boolean');
                    }

                break;
                case Scheduler::OPTION_ID:
                    if (!$value instanceof ObjectId) {
                        throw new InvalidArgumentException('option '.$option.' must be a an instance of '.ObjectId::class);
                    }

                break;
                default:
                    throw new InvalidArgumentException('invalid option '.$option.' given');
            }
        }

        return $options;
    }
456302
protected function createRequest($method, array $options)
    {
        $uri = $this->httpClient->getConfig('base_uri');
        $defaults = $this->httpClient->getConfig('defaults');
        $headers = isset($defaults['headers']) ? $defaults['headers'] : [];

        return $this->messageFactory->createRequest($method, $uri, $headers, $options);
    }
364316
protected function validate($entity, array &$options)
    {
        $allowedEntityClasses = $this->getAllowedEntityClasses();

        if (!empty($allowedEntityClasses)) {
            $entityClassAllowed = false;

            foreach ($allowedEntityClasses as $allowedEntityClass) {
                if ($entity instanceof $allowedEntityClass) {
                    $entityClassAllowed = true;

                    break;
                }
            }
            if (!$entityClassAllowed) {
                $message = sprintf(
                    'View widget "%s" requires entity to be instance of one of "%s" classes.',
                    $this->getAlias(),
                    implode('", "', $allowedEntityClasses)
                );

                throw new WidgetException($message);
            }
        }
        try {
            $options = $this->optionsResolver->resolve($options);
        } catch (ExceptionInterface $ex) {
            throw new WidgetException(
                sprintf('View widget "%s" options are invalid: "%s".', $this->getAlias(), $ex->getMessage())
            );
        }
    }
93409
protected function validateOptions(array $options, $method)
    {
        foreach ($options as $key => $value) {
            if (!in_array($key, $this->validOptions)) {
                throw new BadOptionException($key, $this->validOptions, $method);
            }
        }

        $options = $this->setOptionIfNotSet($options, 'format', MediaInterface::MEDIA_ORIGINAL);
        $options = $this->setOptionIfNotSet($options, 'style', '');
        $options = $this->setOptionIfNotSet($options, 'class', '');
        $options = $this->setOptionIfNotSet($options, 'id', '');
        $options = $this->setOptionIfNotSet($options, 'alt', '');
        $options = $this->setOptionIfNotSet($options, 'legend', '');

        $this->checkIfString($options, 'format', $method);
        $this->checkIfString($options, 'style', $method);
        $this->checkIfString($options, 'class', $method);
        $this->checkIfString($options, 'id', $method);
        $this->checkIfString($options, 'alt', $method);
        $this->checkIfString($options, 'legend', $method);

        return $options;
    }
294586
public function getOptions($options = array())
    {
        if ($options instanceof \Zend_Config) {
            return $options->toArray();
        } elseif (!is_array($options)) {
            throw new \Zend_Validate_Exception('$config must be an instance of Zend_Config or array.');
        }
        
        return $options;
    }
972190
public function escape($value, $method = null, array $options = []) {
		$defaults = ['escape' => true];
		$options += $defaults;

		if ($options['escape'] === false) {
			return $value;
		}
		if (is_array($value)) {
			return array_map([$this, __FUNCTION__], $value);
		}
		return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
	}
1324977
public function errors($options = [])
    {
        $errors = [];
        $errored = false;
        foreach ($this as $entity) {
            $result = $entity->errors($options);
            $errors[] = $result;
            if ($result) {
                $errored = true;
            }
        }
        return $errored ? $errors : [];
    }
1325989
protected function makeRequest($method, $uri, $options)
    {
        $logger = $this->getLogger();

        try {
            $logger->info(sprintf('Making API %s request to %s', $method, $uri), [$options]);

            /** @var ResponseInterface $response */
            $response = $this->_doRequest($method, $uri, $options);

            $logger->debug('Response from HTTP call was status code:', [$response->getStatusCode()]);
            $logger->debug('Response JSON was:', [$response->getBody()]);

            return $response;
        } catch (\Exception $e) {
            throw $e; // Just rethrow for now
        }
    }
578144
public function get ($method, $options = array ()) {
		$req = $this->site . $this->element_name_plural;
        if (isset ($this->_data['id']) && $this->_data['id']) { 
          $req .= '/' . $this->_data['id'];
        }
        $req .= '/' . $method . '.xml';
		if (count ($options) > 0) {
			$req .= '?' . http_build_query ($options);
		}
		return $this->_send_and_receive ($req, 'GET');
	}
1041641
private function getValidatorOptions(array $options)
    {
        $resolver = new OptionsResolver();
        $resolver->setDefaults([
            'groups' => null,
            'traverse' => false,
            'deep' => false,
        ]);

        return $resolver->resolve(isset($options['validator']) ? $options['validator'] : []);
    }