offsetExists() public method

Determine if an item exists at an offset.
public offsetExists ( mixed $key ) : boolean
$key mixed
return boolean
Example #1
0
 /**
  * @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');
 }
Example #2
0
 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);
     }
 }
Example #3
0
 /**
  * Verify whether a module has been registered
  *
  * @param ModuleInterface $module
  * @return mixed
  */
 public function isRegistered(ModuleInterface $module)
 {
     return $this->modules->offsetExists(get_class($module));
 }
Example #4
0
 public function testArrayAccessOffsetExists()
 {
     $c = new Collection(['foo', 'bar']);
     $this->assertTrue($c->offsetExists(0));
     $this->assertTrue($c->offsetExists(1));
     $this->assertFalse($c->offsetExists(1000));
 }
Example #5
0
 /**
  * @param $type
  * @return bool
  */
 public function hasHandlerForType($type)
 {
     return $this->handlers->offsetExists($type);
 }
Example #6
0
 /**
  * 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);
 }
Example #7
0
 /**
  * @param mixed $offset
  * @return bool
  */
 public function offsetExists($offset)
 {
     return $this->results->offsetExists($offset);
 }
 /**
  * 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);
 }
Example #9
0
 public function offsetExists($key)
 {
     return parent::offsetExists(strtoupper($key));
 }