Ouzo\Utilities\Arrays::find PHP Метод

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

Returns null if element was not found.
public static find ( array $elements, callable $function ) : mixed
$elements array
$function callable
Результат mixed
    public static function find(array $elements, $function)
    {
        foreach ($elements as $element) {
            if ($function($element)) {
                return $element;
            }
        }
        return null;
    }

Usage Example

Пример #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);
     });
 }
All Usage Examples Of Ouzo\Utilities\Arrays::find