本文整理汇总了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;
}
示例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);
}
示例3: setValue
/**
* @return PrimitiveRegistryList
**/
public function setValue($value)
{
if ($value) {
Assert::isArray($value);
Assert::isInstance(current($value), Registry::class);
}
$this->value = $value;
return $this;
}
示例4: getBitmask
public function getBitmask($config)
{
Assert::isInstance($config, AMQPQueueConfig::class);
$bitmask = parent::getBitmask($config);
if ($config->getExclusive()) {
$bitmask = $bitmask | AMQP_EXCLUSIVE;
}
return $bitmask;
}
示例5: getBitmask
public function getBitmask($config)
{
Assert::isInstance($config, AMQPExchangeConfig::class);
$bitmask = parent::getBitmask($config);
if ($config->getInternal()) {
$bitmask = $bitmask | AMQP_INTERNAL;
}
return $bitmask;
}
示例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()));
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}