本文整理汇总了PHP中Assert\Assertion::allIsInstanceOf方法的典型用法代码示例。如果您正苦于以下问题:PHP Assertion::allIsInstanceOf方法的具体用法?PHP Assertion::allIsInstanceOf怎么用?PHP Assertion::allIsInstanceOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert\Assertion
的用法示例。
在下文中一共展示了Assertion::allIsInstanceOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param Field[] $elements
* @param Ship[] $ships
*/
private function __construct(array $elements, array $ships = [])
{
Assertion::allIsInstanceOf($elements, Field::class);
Assertion::allIsInstanceOf($ships, Ship::class);
$this->elements = $elements;
$this->ships = $ships;
}
示例2: __construct
/**
* @param databox_field[] $fields
*/
public function __construct($fields = [])
{
Assertion::allIsInstanceOf($fields, databox_field::class);
foreach ($fields as $field) {
$this->add_element($field);
}
}
示例3: filterByValueCompatibility
public static function filterByValueCompatibility(array $list, $value)
{
Assertion::allIsInstanceOf($list, Typed::class);
$is_numeric = is_numeric($value);
$is_valid_date = RecordHelper::validateDate($value);
$filtered = [];
foreach ($list as $item) {
switch ($item->getType()) {
case Mapping::TYPE_FLOAT:
case Mapping::TYPE_DOUBLE:
case Mapping::TYPE_INTEGER:
case Mapping::TYPE_LONG:
case Mapping::TYPE_SHORT:
case Mapping::TYPE_BYTE:
if ($is_numeric) {
$filtered[] = $item;
}
break;
case Mapping::TYPE_DATE:
if ($is_valid_date) {
$filtered[] = $item;
}
break;
case Mapping::TYPE_STRING:
default:
$filtered[] = $item;
}
}
return $filtered;
}
示例4: __construct
/**
* Construct.
*
* @param TransitionHandlerFactory $handlerFactory The transition handler factory.
* @param StateRepository $stateRepository The state repository.
* @param Workflow[] $workflows The set of managed workflows.
*/
public function __construct(TransitionHandlerFactory $handlerFactory, StateRepository $stateRepository, $workflows = array())
{
Assertion::allIsInstanceOf($workflows, 'Netzmacht\\Workflow\\Flow\\Workflow');
$this->workflows = $workflows;
$this->handlerFactory = $handlerFactory;
$this->stateRepository = $stateRepository;
}
示例5: __construct
/**
* @param array $processingTypes
* @param bool $supportAll
*/
private function __construct(array $processingTypes, $supportAll)
{
Assertion::allIsInstanceOf($processingTypes, Prototype::class);
Assertion::boolean($supportAll);
$this->supportedProcessingTypes = $processingTypes;
$this->supportAllTypes = $supportAll;
}
示例6: __construct
/**
* @param SnapshotStore $snapshotStore
* @param AggregateRepository[] $aggregateRepositories
*/
public function __construct(SnapshotStore $snapshotStore, array $aggregateRepositories)
{
Assertion::notEmpty($aggregateRepositories);
Assertion::allIsInstanceOf($aggregateRepositories, AggregateRepository::class);
$this->snapshotStore = $snapshotStore;
$this->aggregateRepositories = $aggregateRepositories;
}
示例7: __construct
/** @param Processor[] $processors */
public function __construct(HttpClient $httpClient, array $processors)
{
Assertion::allIsInstanceOf($processors, Processor::class);
$this->httpClient = $httpClient;
foreach ($processors as $processor) {
$this->processors[$processor->getContentType()] = $processor;
}
}
示例8: __construct
/**
* @param TechnicalData[] $data
*/
public function __construct($data = [])
{
Assertion::allIsInstanceOf($data, TechnicalData::class);
$this->data = [];
foreach ($data as $technicalData) {
$this->data[$technicalData->getName()] = $technicalData;
}
}
示例9: addConditions
/**
* Add multiple conditions.
*
* @param array $conditions Array of conditions being added.
*
* @return $this
*
* @throws \Assert\InvalidArgumentException If array contains an invalid condition.
*/
public function addConditions(array $conditions)
{
Assertion::allIsInstanceOf($conditions, 'Netzmacht\\Workflow\\Flow\\Condition\\Transition\\Condition');
foreach ($conditions as $condition) {
$this->addCondition($condition);
}
return $this;
}
示例10: __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;
}
示例11: __construct
/**
* Constructor.
*
* @param string $name
* @param string $type
* @param Photo[] $photos
*/
public function __construct($name, $type, array $photos)
{
\Assert\that($name)->string()->notEmpty();
\Assert\that($type)->string()->notEmpty();
Assertion::allIsInstanceOf($photos, Photo::class);
$this->name = $name;
$this->type = $type;
$this->photos = $photos;
}
示例12: __construct
/**
* @param FieldNode[] $fields
* @param Link[] $links
* @param ResourceNode[] $resources
*/
public function __construct(array $fields, array $links = [], array $resources = [])
{
Assertion::allIsInstanceOf($fields, FieldNode::class);
Assertion::allIsInstanceOf($links, Link::class);
Assertion::allIsInstanceOf($resources, ResourceNode::class);
$this->fields = $fields;
$this->links = $links;
$this->resources = $resources;
}
示例13: __construct
/**
* Constructor.
*
* @param string $name
* @param string $type
* @param Tip[] $tips
*/
public function __construct($name, $type, array $tips)
{
\Assert\that($name)->string()->notEmpty();
\Assert\that($type)->string()->notEmpty();
Assertion::allIsInstanceOf($tips, Tip::class);
$this->name = $name;
$this->type = $type;
$this->tips = $tips;
}
示例14: __construct
/**
* @param Entity[] $entities
*/
public function __construct(array $entities = array())
{
Assertion::allIsInstanceOf($entities, '\\OpenConext\\Value\\Saml\\Entity');
foreach ($entities as $entity) {
if ($this->contains($entity)) {
continue;
}
$this->entities[] = $entity;
}
}
示例15: hasPermissions
/**
* Consider if role has a set of permissions.
*
* @param Permission[] $permissions Set of permissions.
*
* @return bool
*/
public function hasPermissions($permissions)
{
Assertion::allIsInstanceOf($permissions, 'Netzmacht\\Workflow\\Security\\Permission');
foreach ($permissions as $permission) {
if (!$this->hasPermission($permission)) {
return false;
}
}
return true;
}