keyExists() публичный статический Метод

Example: $array = array('id' => 1, 'name' => 'john'); $return = Arrays::keyExists($array, 'name'); Result: true
public static keyExists ( array $elements, string | integer $key ) : boolean
$elements array
$key string | integer
Результат boolean
Пример #1
0
 /**
  * @test
  */
 public function shouldCheckIsKeyExists()
 {
     //given
     $array = array('id' => 1, 'name' => 'john');
     //when
     $return = Arrays::keyExists($array, 'name');
     //then
     $this->assertTrue($return);
 }
Пример #2
0
 private static function existRouteRule($methods, $uri)
 {
     $routeKeys = Route::$routeKeys;
     return Arrays::any($methods, function ($method) use($routeKeys, $uri) {
         return Arrays::keyExists($routeKeys, $method . $uri);
     });
 }