本文整理汇总了PHP中Assert\Assertion::allString方法的典型用法代码示例。如果您正苦于以下问题:PHP Assertion::allString方法的具体用法?PHP Assertion::allString怎么用?PHP Assertion::allString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert\Assertion
的用法示例。
在下文中一共展示了Assertion::allString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: withCountryCodes
/**
* @param array $countryCodes
*
* @throws \InvalidArgumentException
*
* @return static
*/
public function withCountryCodes(array $countryCodes)
{
Assertion::allString($countryCodes);
Assertion::allNotBlank($countryCodes);
$instance = clone $this;
$instance->countryCodes = $countryCodes;
return $instance;
}
示例2: checkResponseTypes
/**
* @param \OAuth2\Client\ClientInterface $client
* @param array $registration_parameters
*/
private function checkResponseTypes(ClientInterface $client, array $registration_parameters)
{
Assertion::isArray($registration_parameters['response_types'], 'The parameter "response_types" must be an array of strings.');
Assertion::allString($registration_parameters['response_types'], 'The parameter "grant_types" must be an array of strings.');
foreach ($registration_parameters['response_types'] as $response_type) {
$types = $this->getResponseTypeManager()->getResponseTypes($response_type);
if (!in_array($response_type, $client->get('response_types'))) {
$response_types = $client->get('response_types');
$response_types[] = $response_type;
$client->set('response_types', $response_types);
}
foreach ($types as $type) {
$associated_grant_types = $type->getAssociatedGrantTypes();
$diff = array_diff($associated_grant_types, $registration_parameters['grant_types']);
Assertion::true(empty($diff), sprintf('The response type "%s" is associated with the grant types "%s" but this response type is missing.', $type->getResponseType(), json_encode($diff)));
$client->set('grant_types', array_unique(array_merge($client->get('grant_types'), $associated_grant_types)));
}
}
}
示例3: recordCustomEvent
public function recordCustomEvent($name, array $attributes)
{
Assertion::string($name);
Assertion::notBlank($name);
Assertion::allString(array_keys($attributes));
Assertion::allScalar(array_values($attributes));
$this->handle('newrelic_record_custom_event', [$name, $attributes]);
}
示例4: enableRequestObjectSupport
/**
* {@inheritdoc}
*/
public function enableRequestObjectSupport(JWTLoaderInterface $jwt_loader, array $mandatory_claims = [])
{
Assertion::allString($mandatory_claims, 'The mandatory claims array should contain only claims.');
$this->setJWTLoader($jwt_loader);
$this->request_object_allowed = true;
$this->mandatory_claims = $mandatory_claims;
}
示例5: getJWKSetsConfiguration
/**
* @param string $name
* @param string[] $jwksets
* @param bool $is_public
*
* @return array
*/
private static function getJWKSetsConfiguration($name, array $jwksets, $is_public = true)
{
self::checkParameters($name, $is_public);
Assertion::isArray($jwksets);
Assertion::allString($jwksets);
Assertion::allNotEmpty($jwksets);
return [self::BUNDLE_ALIAS => ['key_sets' => [$name => ['jwksets' => ['is_public' => $is_public, 'id' => $jwksets]]]]];
}
示例6: createProcessDataTaskFromDefinition
/**
* @param array $taskDefinition
* @return ProcessData
*/
private function createProcessDataTaskFromDefinition(array $taskDefinition)
{
Assertion::keyExists($taskDefinition, "target");
Assertion::notEmpty($taskDefinition["target"]);
Assertion::string($taskDefinition["target"]);
Assertion::keyExists($taskDefinition, "allowed_types");
Assertion::isArray($taskDefinition["allowed_types"]);
Assertion::allString($taskDefinition["allowed_types"]);
$preferredType = isset($taskDefinition["preferred_type"]) ? $taskDefinition["preferred_type"] : null;
$metadata = isset($taskDefinition['metadata']) ? $taskDefinition['metadata'] : array();
return ProcessData::address($taskDefinition["target"], $taskDefinition["allowed_types"], $preferredType, $metadata);
}
示例7: __construct
/**
* @param array $cookies
*/
public function __construct(array $cookies = [])
{
Assertion::allString(array_keys($cookies), 'CookieJar must be instantiated with an associative array');
$this->cookies = $cookies;
}
示例8: withStockTickers
/**
* @param array $stockTickers
*
* @throws \InvalidArgumentException
*
* @return static
*/
public function withStockTickers(array $stockTickers)
{
Assertion::allString($stockTickers);
Assertion::allNotBlank($stockTickers);
Assertion::lessOrEqualThan(count($stockTickers), NewsInterface::STOCK_TICKERS_MAX_COUNT);
$instance = clone $this;
$instance->stockTickers = $stockTickers;
return $instance;
}