Exemplo n.º 1
0
 /**
  * Determine if an item exists in the collection.
  *
  * @param  mixed $key
  * @param  mixed $value
  *
  * @return bool
  */
 public function contains($key, $value = NULL)
 {
     if (func_num_args() === 2) {
         return $this->contains(function ($item) use($key, $value) {
             return Lib::array_query($item, $key) === $value;
         });
     }
     if ($this->useAsCallable($key)) {
         return NULL !== $this->first($key);
     }
     return in_array($key, $this->items, TRUE);
 }
Exemplo n.º 2
0
 /**
  * **TRUE if an indexed value exists.**
  *
  * @param mixed $key
  *
  * @return bool
  */
 public function has($key) : bool
 {
     return NULL !== Lib::array_query($this->items, $key);
 }
Exemplo n.º 3
0
 /**
  * Get a configuration attribute or return $default value if not found.
  *
  * @param string     $key
  * @param null|mixed $default
  *
  * @return null
  */
 public function getConfig(string $key, $default = NULL)
 {
     return Lib::array_query($this->config, $key, $default);
 }