当前位置: 首页>>代码示例>>PHP>>正文


PHP Assert::isInstance方法代码示例

本文整理汇总了PHP中Hesper\Core\Base\Assert::isInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::isInstance方法的具体用法?PHP Assert::isInstance怎么用?PHP Assert::isInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hesper\Core\Base\Assert的用法示例。


在下文中一共展示了Assert::isInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: of

 /**
  * @throws WrongArgumentException
  * @return PrimitiveEnumeration
  **/
 public function of($class)
 {
     $className = $this->guessClassName($class);
     Assert::classExists($className);
     Assert::isInstance($className, Enumeration::class);
     $this->className = $className;
     return $this;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:12,代码来源:PrimitiveEnumeration.php

示例2: send

 public function send(Message $message)
 {
     if (!$this->queue) {
         throw new WrongStateException('you must set the queue first');
     }
     Assert::isInstance($message, 'TextMessage');
     $this->getStream()->write($message->getTimestamp()->toString() . "\t" . str_replace(PHP_EOL, ' ', $message->getText()) . PHP_EOL);
 }
开发者ID:justthefish,项目名称:hesper,代码行数:8,代码来源:TextFileSender.php

示例3: setValue

 /**
  * @return PrimitiveRegistryList
  **/
 public function setValue($value)
 {
     if ($value) {
         Assert::isArray($value);
         Assert::isInstance(current($value), Registry::class);
     }
     $this->value = $value;
     return $this;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:12,代码来源:PrimitiveRegistryList.php

示例4: getBitmask

 public function getBitmask($config)
 {
     Assert::isInstance($config, AMQPQueueConfig::class);
     $bitmask = parent::getBitmask($config);
     if ($config->getExclusive()) {
         $bitmask = $bitmask | AMQP_EXCLUSIVE;
     }
     return $bitmask;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:9,代码来源:AMQPPeclQueueBitmask.php

示例5: getBitmask

 public function getBitmask($config)
 {
     Assert::isInstance($config, AMQPExchangeConfig::class);
     $bitmask = parent::getBitmask($config);
     if ($config->getInternal()) {
         $bitmask = $bitmask | AMQP_INTERNAL;
     }
     return $bitmask;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:9,代码来源:AMQPPeclExchangeBitmask.php

示例6: importValue

 public function importValue($value)
 {
     if ($value) {
         Assert::isInstance($value, $this->className);
         //			Assert::isEqual(get_class($value), $this->className);
     } else {
         return parent::importValue(null);
     }
     return $this->import(array($this->getName() => $value->getId()));
 }
开发者ID:justthefish,项目名称:hesper,代码行数:10,代码来源:PrimitiveRegistry.php

示例7: uncache

 public function uncache()
 {
     foreach ($this->classNameMap as $className => $tags) {
         $dao = ClassUtils::callStaticMethod("{$className}::dao");
         /* @var $dao StorableDAO */
         $worker = Cache::worker($dao);
         Assert::isInstance($worker, TaggableDaoWorker::class);
         $worker->expireTags($tags);
     }
 }
开发者ID:justthefish,项目名称:hesper,代码行数:10,代码来源:UncacherTaggableDaoWorkerTags.php

示例8: compare

 public function compare($one, $two)
 {
     Assert::isInstance($one, Date::class);
     Assert::isInstance($two, Date::class);
     $stamp1 = $one->toStamp();
     $stamp2 = $two->toStamp();
     if ($stamp1 == $stamp2) {
         return 0;
     }
     return $stamp1 < $stamp2 ? -1 : 1;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:11,代码来源:DateObjectComparator.php

示例9: compare

 public function compare($one, $two)
 {
     Assert::isInstance($one, Identifiable::class);
     Assert::isInstance($two, Identifiable::class);
     $oneId = $one->getId();
     $twoId = $two->getId();
     if ($oneId === $twoId) {
         return 0;
     }
     return $oneId < $twoId ? -1 : 1;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:11,代码来源:ImmutableObjectComparator.php

示例10: addLink

 /**
  * @throws WrongArgumentException
  * @return AMQPPool
  **/
 public function addLink($name, AMQP $amqp)
 {
     if (isset($this->pool[$name])) {
         throw new WrongArgumentException("amqp link with name '{$name}' already registered");
     }
     if ($this->pool) {
         Assert::isInstance($amqp, current($this->pool));
     }
     $this->pool[$name] = $amqp;
     return $this;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:15,代码来源:AMQPSelective.php

示例11: getBitmask

 public function getBitmask($config)
 {
     Assert::isInstance($config, AMQPOutgoingMessage::class);
     $bitmask = 0;
     if ($config->getMandatory()) {
         $bitmask = $bitmask | AMQP_MANDATORY;
     }
     if ($config->getImmediate()) {
         $bitmask = $bitmask | AMQP_IMMEDIATE;
     }
     return $bitmask;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:12,代码来源:AMQPPeclOutgoingMessageBitmask.php

示例12: cloneInnerBuilder

 public function cloneInnerBuilder($property)
 {
     $mapping = $this->getFormMapping();
     Assert::isIndexExists($mapping, $property);
     $primitive = $mapping[$property];
     Assert::isInstance($primitive, PrimitiveForm::class);
     $result = new $this($primitive->getProto());
     if (isset($this->limitedPropertiesList[$primitive->getName()])) {
         $result->setLimitedPropertiesList($this->limitedPropertiesList[$primitive->getName()]);
     }
     return $result;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:12,代码来源:PrototypedBuilder.php

示例13: getIdsArray

 public static function getIdsArray($objectsList)
 {
     $out = [];
     if (!$objectsList) {
         return $out;
     }
     Assert::isInstance(current($objectsList), Identifiable::class, 'only identifiable lists accepted');
     foreach ($objectsList as $object) {
         $out[] = $object->getId();
     }
     return $out;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:12,代码来源:ArrayUtils.php

示例14: fillOwn

 /**
  * @return Form
  **/
 public function fillOwn($object, &$result)
 {
     Assert::isInstance($result, Form::class);
     foreach ($this->getFormMapping() as $primitive) {
         if ($primitive instanceof PrimitiveForm && $result->exists($primitive->getName()) && $primitive->isComposite()) {
             Assert::isEqual($primitive->getProto(), $result->get($primitive->getName())->getProto());
             continue;
         }
         $result->add($primitive);
     }
     $result = parent::fillOwn($object, $result);
     $result->setProto($this->proto);
     return $result;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:17,代码来源:FormBuilder.php

示例15: validate

 public final function validate($object, $form, $previousObject = null)
 {
     if (is_array($object)) {
         return $this->validateList($object, $form, $previousObject);
     }
     Assert::isInstance($object, $this->className());
     Assert::isInstance($form, Form::class);
     if ($previousObject) {
         Assert::isInstance($previousObject, $this->className());
     }
     if ($this->baseProto()) {
         $this->baseProto()->validate($object, $form, $previousObject);
     }
     return $this->validateSelf($object, $form, $previousObject);
 }
开发者ID:justthefish,项目名称:hesper,代码行数:15,代码来源:EntityProto.php


注:本文中的Hesper\Core\Base\Assert::isInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。