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

Returns null if element was not found.
public static find ( array $elements, callable $function ) : mixed
$elements array
$function callable
Результат mixed
Пример #1
0
 /**
  * @param $path
  * @param $requestType
  * @return RouteRule
  */
 private function findRouteRule($path, $requestType)
 {
     return Arrays::find(Route::getRoutes(), function (RouteRule $rule) use($path, $requestType) {
         return $rule->matches($path, $requestType);
     });
 }
Пример #2
0
 /**
  * @test
  */
 public function findShouldReturnNullWhenElementWasNotFound()
 {
     //when
     $value = Arrays::find(array('a', 'c'), function ($element) {
         return $element == 'b';
     });
     //then
     $this->assertNull($value);
 }
Пример #3
0
 /**
  * @return Parameter|null
  */
 public function getHeaderParameter()
 {
     return Arrays::find($this->parameters, function (Parameter $parameter) {
         return $parameter->isHeader();
     });
 }
Пример #4
0
 protected function _wasCalled($name, $arguments)
 {
     return Arrays::find($this->mock->_called_methods, new MethodCallMatcher($name, $arguments));
 }