本文整理汇总了PHP中SplObjectStorage::offsetExists方法的典型用法代码示例。如果您正苦于以下问题:PHP SplObjectStorage::offsetExists方法的具体用法?PHP SplObjectStorage::offsetExists怎么用?PHP SplObjectStorage::offsetExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplObjectStorage
的用法示例。
在下文中一共展示了SplObjectStorage::offsetExists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invalidate
public function invalidate(AbstractTerritoire $territoire)
{
$timestamp = $this->em->getRepository('AppBundle\\Repository\\CacheInfo\\TerritoireTimestamp')->findOneByTerritoire($territoire);
if (!$timestamp && $this->toPersist->offsetExists($territoire)) {
$timestamp = $this->toPersist[$territoire];
}
if ($timestamp) {
$timestamp->setNow();
}
if (!$timestamp) {
$timestamp = new TerritoireTimestamp($territoire);
$this->em->persist($timestamp);
$this->toPersist[$territoire] = $timestamp;
}
if ($territoire instanceof Commune) {
$this->invalidate($territoire->getDepartement());
return;
}
if ($territoire instanceof Departement) {
$this->invalidate($territoire->getRegion());
return;
}
if ($territoire instanceof Region && $territoire->getCirconscriptionEuropeenne()) {
$this->invalidate($territoire->getCirconscriptionEuropeenne());
}
if ($territoire instanceof Region || $territoire instanceof CirconscriptionEuropeenne) {
$this->invalidate($territoire->getPays());
}
}
示例2: getByProperty
/**
* @param Property $property
* @return AggregatorRelay
* @throws UnexpectedValueException
*/
public function getByProperty(Property $property)
{
if (!$this->map->offsetExists($property)) {
throw new UnexpectedValueException();
}
return $this->map->offsetGet($property);
}
示例3: setHelper
/**
* @param $helper
*
* @throws \AGmakonts\DddBricks\Repository\Exception\HelperException
*/
private function setHelper(AbstractRepository $helper)
{
if (get_called_class() === $helper) {
throw new HelperException(HelperException::HELPER_SELF_REFERENCING);
}
if (TRUE === $this->_helpers->offsetExists($helper->getEntityType())) {
throw new HelperException(HelperException::HELPER_ALREADY_REQUESTED);
}
$this->_helpers->attach($helper->getEntityType(), $helper);
}
示例4: executeCommand
/**
* {@inheritdoc}
*/
public function executeCommand(CommandInterface $command)
{
$this->storeCommand($command);
$this->performExecution(function () use($command) {
$priority = $command->getPriority();
while (!empty($this->commands) && $this->commands[0]->getPriority() >= $priority) {
$cmd = array_shift($this->commands);
$this->commandResults[$cmd] = $cmd->execute($this);
$this->executionCount++;
if ($cmd === $command) {
// Bail out as soon as target command has been executed.
break;
}
}
if ($this->executionDepth == 1) {
// Execute remaining commands if this is a top level execution.
while (!empty($this->commands)) {
$cmd = array_shift($this->commands);
$this->commandResults[$cmd] = $cmd->execute($this);
$this->executionCount++;
}
}
});
try {
if ($this->commandResults->offsetExists($command)) {
return $this->commandResults[$command];
}
} finally {
if ($this->executionDepth == 0) {
// Free command result memory after top level execution.
$this->commandResults = new \SplObjectStorage();
}
}
}
示例5: offsetExists
/**
* Whether a offset exists
* @link http://php.net/manual/en/arrayaccess.offsetexists.php
* @param mixed $offset <p>
* An offset to check for.
* </p>
* @return boolean true on success or false on failure.
* </p>
* <p>
* The return value will be casted to boolean if non-boolean was returned.
* @since 5.0.0
*/
public function offsetExists($offset)
{
if (is_scalar($offset)) {
return array_key_exists($offset, $this->scalarStore);
}
if (is_object($offset)) {
return $this->objectStore->offsetExists($offset);
}
if (is_array($offset)) {
foreach ($this->arrayKeys as $index => $entry) {
if ($entry === $offset) {
$this->lastArrayKey = $offset;
$this->lastArrayValue = $this->arrayValues[$index];
return true;
}
}
}
return false;
}
示例6: link
public function link($model = NULL, $field = NULL, $reverse = FALSE)
{
var_dump('Link');
if (!$model instanceof Yada_Model) {
$field = $model;
$model = $this->_model;
}
var_dump($field->name);
$this->field($model, $field);
$field = $this->_field;
if (!$field instanceof Yada_Field_Interface_Related) {
throw new Kohana_Exception('Field :name in Model :model isn\'t a Related Field', array(':name' => $field->name, ':model' => Yada::common_name('model', $model)));
}
$related = $field->related();
if (!$this->_linked->offsetExists($field)) {
$this->_linked[$field] = array($related, $reverse);
$related->mapper->link($related->model, $related, TRUE);
}
return $related->model;
}
示例7: offsetUnset
public function offsetUnset($index)
{
$this->validateIndex($index);
// Decrement counters when replacing existing item
if (parent::offsetExists($index)) {
$oldResult = parent::offsetGet($index);
if ($oldResult instanceof Success) {
$this->countSuccess--;
} elseif ($oldResult instanceof Failure) {
$this->countFailure--;
} elseif ($oldResult instanceof Warning) {
$this->countWarning--;
} else {
$this->countUnknown--;
}
}
parent::offsetUnset($index);
}
示例8: offsetExists
public function offsetExists($object)
{
$this->initialize();
return parent::offsetExists($object);
}
示例9: offsetExists
/**
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
*/
public function offsetExists($object)
{
@trigger_error('The ' . __METHOD__ . ' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
return parent::offsetExists($object);
}
示例10: offsetExists
/**
* @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
*/
public function offsetExists($object)
{
$this->triggerDeprecation(__METHOD__);
return parent::offsetExists($object);
}
示例11: offsetUnset
/**
* @param object $index
* @link http://php.net/manual/en/splobjectstorage.offsetunset.php
*/
public function offsetUnset($index)
{
$this->validateIndex($index);
// Decrement counters when replacing existing item
if (parent::offsetExists($index)) {
$this->updateCounters(parent::offsetGet($index), -1);
}
parent::offsetUnset($index);
}
示例12: isSubscribed
private function isSubscribed(WebSocketConnection $connection)
{
return $this->connectionTableMap->offsetExists($connection);
}
示例13: SplObjectStorage
$obj->setInfo('AAA');
// getInfo()
// 获得当前节点的值。也必须是调用rewind后,才可以调用getInfo。
$obj->getInfo();
// current()
// 获得当前节点对象
$obj->current();
// getHash()
// 获得参数的hash值
$obj->getHash($a2);
// next()
// 指针移到下一个节点
$obj->next();
// offsetExists
// 判断对象容器中是否存在该对象
$obj->offsetExists($a2);
// offsetSet()
// 给对象容器中的某个对象设置值
$obj->offsetSet($a2, 'BBB');
// offsetGet()
// 获得对象容器中的某个针对象对应的值
$obj->offsetGet($a2);
// offsetUnset()
// 将某节点删除
//$obj->offsetUnset($a1);
// serialize()
// 将对象容器序列化
$serialize_obj = $obj->serialize();
// unserialize()
// 将对象容器反序列化
$obj_2 = new SplObjectStorage();
示例14: offsetExists
/**
* @param object $offset
* @return bool
*/
public function offsetExists($offset)
{
return $this->list->offsetExists($offset);
}
示例15: _shouldIgnorePayment
/**
* return true if the payment should not be processed
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param SplObjectStorage $processedPayments
* @return bool
*/
protected function _shouldIgnorePayment(Mage_Sales_Model_Order_Payment $payment, SplObjectStorage $processedPayments)
{
return $processedPayments->offsetExists($payment) || $payment->getMethod() === Mage::getModel('payment/method_free')->getCode();
}