本文整理汇总了PHP中Assert\Assertion::inArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Assertion::inArray方法的具体用法?PHP Assertion::inArray怎么用?PHP Assertion::inArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert\Assertion
的用法示例。
在下文中一共展示了Assertion::inArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkKey
/**
* @param JWKInterface $key
*/
private function checkKey(JWKInterface $key)
{
Assertion::eq($key->get('kty'), 'OKP', 'Wrong key type.');
Assertion::true($key->has('x'), 'The key parameter "x" is missing.');
Assertion::true($key->has('crv'), 'The key parameter "crv" is missing.');
Assertion::inArray($key->get('crv'), ['Ed25519'], 'Unsupported curve');
}
示例2: setHandlerLoggerLevel
private function setHandlerLoggerLevel($handlerLoggerLevel)
{
$levels = [Logger::DEBUG, Logger::INFO, Logger::NOTICE, Logger::WARNING, Logger::ERROR, Logger::CRITICAL, Logger::ALERT, Logger::EMERGENCY];
Assertion::inArray($handlerLoggerLevel, $levels);
$this->handlerLoggerLevel = $handlerLoggerLevel;
return $this;
}
示例3: assertConfig
private function assertConfig(array $config)
{
Assertion::keyExists($config, "dbname");
Assertion::string($config['dbname']);
Assertion::keyExists($config, "driver");
Assertion::inArray($config["driver"], $this->supportedDrivers);
}
示例4: __construct
/**
* @param string $type
* @param string $code
*/
public function __construct($type, $code)
{
Assertion::inArray($type, $this->types);
Assertion::string($code);
$this->type = $type;
$this->code = $code;
}
示例5: __construct
/**
* @param string $text
* @param string $position
*/
public function __construct($text, $position = self::POSITION_CENTER)
{
Assertion::string($text);
Assertion::inArray($position, [self::POSITION_CENTER, self::POSITION_RIGHT, self::POSITION_LEFT]);
$this->text = $text;
$this->position = $position;
$this->artLength = max(array_map('mb_strlen', explode("\n", $text)));
}
示例6: thumbprint
public function thumbprint($hash_algorithm)
{
Assertion::inArray($hash_algorithm, hash_algos(), sprintf('Hash algorithm "%s" is not supported', $hash_algorithm));
$values = array_intersect_key($this->getAll(), array_flip(['kty', 'n', 'e', 'crv', 'x', 'y', 'k']));
ksort($values);
$input = json_encode($values);
return Base64Url::encode(hash($hash_algorithm, $input, true));
}
示例7: __construct
/**
* @param string $aType
* @param array $aProcessStepCollection
* @param AgentOptions $anOptions
*/
public function __construct($aType, array $aProcessStepCollection, AgentOptions $anOptions = null)
{
Assertion::inArray($aType, array(self::SEQUENCE, self::SPLIT, self::FORK, self::LOOP));
Assertion::allIsInstanceOf($aProcessStepCollection, 'GingerCore\\Model\\JsonWDL\\ProcessStep');
$this->type = $aType;
$this->processSteps = $aProcessStepCollection;
$this->options = is_null($anOptions) ? new AgentOptions(array()) : $anOptions;
}
示例8: addElement
/**
* @param string $name
* @param array $options
* @return ElementMetadata
*/
protected function addElement($name, array $options)
{
Assertion::inArray($options['type'], array_keys($this->types), "'{$options['type']}' is not a valid type");
/** @var ElementMetadata $element */
$element = new ElementMetadata($this->types[$options['type']]);
$element->setElementName($name);
$element->configure($options);
return $element;
}
示例9: __construct
/**
* @param string $aPathWithKey
* @param string $aValueType
*/
public function __construct($aPathWithKey, $aValueType)
{
Assertion::string($aPathWithKey);
$aPathWithKey = trim($aPathWithKey);
Assertion::notEmpty($aPathWithKey);
Assertion::inArray($aValueType, array(StructureDefinition::BOOLEAN, StructureDefinition::INTEGER, StructureDefinition::FLOAT, StructureDefinition::STRING, StructureDefinition::COLLECTION, StructureDefinition::HASHTABLE));
$this->extractPathFromKey($aPathWithKey);
$this->valueType = $aValueType;
}
示例10: __construct
public function __construct(DateTimeInterface $logDate, $logLevel, $logMessage, array $logContext, array $logCallGraph)
{
Assertion::inArray($logLevel, (new ReflectionClass(LogLevel::class))->getConstants());
Assertion::string($logMessage);
$this->logDate = $logDate;
$this->logLevel = $logLevel;
$this->logMessage = $logMessage;
$this->logContext = $logContext;
$this->logCallGraph = $logCallGraph;
}
示例11: enableSignedResponsesSupport
/**
* @param \Jose\JWTCreatorInterface $jwt_creator
* @param string $issuer
* @param string $signature_algorithm
* @param \Jose\Object\JWKSetInterface $signature_key_set
*/
public function enableSignedResponsesSupport(JWTCreatorInterface $jwt_creator, $issuer, $signature_algorithm, JWKSetInterface $signature_key_set)
{
Assertion::string($issuer);
Assertion::inArray($signature_algorithm, $jwt_creator->getSupportedSignatureAlgorithms());
Assertion::greaterThan($signature_key_set->countKeys(), 0, 'The signature key set must have at least one key.');
$this->setJWTCreator($jwt_creator);
$this->setIssuer($issuer);
$this->signature_key_set = $signature_key_set;
$this->signature_algorithm = $signature_algorithm;
}
示例12: create
/**
* Static constructor.
*
* @param string $type
* @param int $id
* @param int $userId
* @param \DateTimeInterface $date
*
* @return TwitterDelete
*/
public static function create($type, $id, $userId, \DateTimeInterface $date)
{
$obj = new self();
Assertion::inArray($type, [self::TWEET, self::DM]);
$obj->type = $type;
$obj->id = $id;
$obj->userId = $userId;
$obj->date = $date;
return $obj;
}
示例13: __construct
/**
* EncryptedSubjectIdentifier constructor.
*
* @param string $pairwise_hash_key
* @param string $algorithm
* @param string $salt
*/
public function __construct($pairwise_hash_key, $algorithm, $salt)
{
Assertion::string($pairwise_hash_key);
Assertion::string($algorithm);
Assertion::string($salt);
Assertion::inArray($algorithm, hash_algos(), sprintf('The algorithm "%s" is not supported.', $algorithm));
$this->pairwise_hash_key = $pairwise_hash_key;
$this->algorithm = $algorithm;
$this->salt = $salt;
}
示例14: __construct
/**
* EncryptedSubjectIdentifier constructor.
*
* @param string $pairwise_encryption_key
* @param string $algorithm
* @param null|string $iv
* @param string $salt
*/
public function __construct($pairwise_encryption_key, $algorithm, $iv, $salt)
{
Assertion::nullOrString($iv);
Assertion::string($salt);
Assertion::string($pairwise_encryption_key);
Assertion::string($algorithm);
Assertion::inArray($algorithm, openssl_get_cipher_methods(), sprintf('The algorithm "%s" is not supported.', $algorithm));
$this->pairwise_encryption_key = $pairwise_encryption_key;
$this->algorithm = $algorithm;
$this->salt = $salt;
$this->iv = $iv;
}
示例15: check
/**
* {@inheritdoc}
*/
public function check(ClientInterface $client, array $registration_parameters)
{
if (!array_key_exists('id_token_encrypted_response_alg', $registration_parameters) || !array_key_exists('id_token_encrypted_response_enc', $registration_parameters)) {
return;
}
Assertion::string($registration_parameters['id_token_encrypted_response_alg'], 'Invalid parameter "id_token_encrypted_response_alg". The value must be a string.');
Assertion::string($registration_parameters['id_token_encrypted_response_enc'], 'Invalid parameter "id_token_encrypted_response_enc". The value must be a string.');
Assertion::inArray($registration_parameters['id_token_encrypted_response_alg'], $this->getIdTokenManager()->getSupportedKeyEncryptionAlgorithms(), sprintf('The ID Token content encryption algorithm "%s" is not supported. Please choose one of the following algorithm: %s', $registration_parameters['id_token_encrypted_response_alg'], json_encode($this->getIdTokenManager()->getSupportedContentEncryptionAlgorithms())));
Assertion::inArray($registration_parameters['id_token_encrypted_response_enc'], $this->getIdTokenManager()->getSupportedContentEncryptionAlgorithms(), sprintf('The ID Token key encryption algorithm "%s" is not supported. Please choose one of the following algorithm: %s', $registration_parameters['id_token_encrypted_response_enc'], json_encode($this->getIdTokenManager()->getSupportedKeyEncryptionAlgorithms())));
$client->set('id_token_encrypted_response_alg', $registration_parameters['id_token_encrypted_response_alg']);
$client->set('id_token_encrypted_response_enc', $registration_parameters['id_token_encrypted_response_enc']);
}