本文整理汇总了PHP中Illuminate\Support\Collection::offsetExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::offsetExists方法的具体用法?PHP Collection::offsetExists怎么用?PHP Collection::offsetExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Collection
的用法示例。
在下文中一共展示了Collection::offsetExists方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchIn
/**
* @param string|Model $model
* @param string $query
* @param int|null $perPage
* @param string $pageName
*
* @return LengthAwarePaginator|Collection
* @throws \Exception
*/
public function searchIn($model, $query = "", $perPage = null, $pageName = 'page')
{
if ($model instanceof Model) {
$model = get_class($model);
}
if (!$this->models->offsetExists($model)) {
throw new \Exception("Search engine for model [{$model}] not found");
}
return $this->_search([$this->models->get($model)], $query = "", $perPage = null, $pageName = 'page');
}
示例2: offsetExists
public function offsetExists($key)
{
$keySegments = explode('.', $key);
$firstKeySegment = array_shift($keySegments);
if ($keySegments && $this->offsetExists($firstKeySegment)) {
return parent::offsetGet($firstKeySegment)->items()->offsetExists(implode('.', $keySegments));
} else {
return parent::offsetExists($key);
}
}
示例3: isRegistered
/**
* Verify whether a module has been registered
*
* @param ModuleInterface $module
* @return mixed
*/
public function isRegistered(ModuleInterface $module)
{
return $this->modules->offsetExists(get_class($module));
}
示例4: testArrayAccessOffsetExists
public function testArrayAccessOffsetExists()
{
$c = new Collection(['foo', 'bar']);
$this->assertTrue($c->offsetExists(0));
$this->assertTrue($c->offsetExists(1));
$this->assertFalse($c->offsetExists(1000));
}
示例5: hasHandlerForType
/**
* @param $type
* @return bool
*/
public function hasHandlerForType($type)
{
return $this->handlers->offsetExists($type);
}
示例6: has
/**
* Ask if a setting key exists or not.
*
* @param string $key The setting key
*
* @return boolean
*
* @api
*/
public function has($key)
{
return $this->defaults->offsetExists($key);
}
示例7: offsetExists
/**
* @param mixed $offset
* @return bool
*/
public function offsetExists($offset)
{
return $this->results->offsetExists($offset);
}
示例8: 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)
{
return $this->fields->offsetExists($offset);
}
示例9: offsetExists
public function offsetExists($key)
{
return parent::offsetExists(strtoupper($key));
}