find() 공개 정적인 메소드

Returns null if element was not found.
public static find ( array $elements, callable $function ) : mixed
$elements array
$function callable
리턴 mixed
예제 #1
0
파일: Router.php 프로젝트: letsdrink/ouzo
 /**
  * @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));
 }