src/Burp.php
private static function fixParams($method, $params)
    {
        if (! in_array(strtolower($method), array('get','post','patch','put','delete','any','head')))
            throw new \BadMethodCallException("valid methods are 'get','post','patch','put','delete','any','head'");


        //fix closures / controllers 
        if  (is_array($params) && isset($params[2]) && is_array($params[2])) {

            
            //controller@method
            if (isset($params[2]['uses']) && is_string($params[2]['uses']) && strpos($params[2]['uses'], '@'))
            {
               
                $callback = explode('@', $params[2]['uses']);
                $params[2] = array('as'=>$params[2]['as'], 'uses'=> $callback);
            }
            
            //closure fix
            if (isset($params[2]['as']) && isset($params[2][0]) && ($params[2][0] instanceof \Closure))
            {
                $params[2] = array('as'=>$params[2]['as'], 'uses'=> $params[2][0]);
            }
        }
        
        //no route name given, so route_name will be the first parameter
        if  (is_array($params) && isset($params[2]) && ($params[2] instanceof \Closure)) {
            $params[2] = array('as'=>$params[0], 'uses'=>$params[2]);
        }
        
        if (count($params)<3 ||
            !is_array($params[2]) ||
            !array_key_exists('as', $params[2]) ||
            !array_key_exists('uses', $params[2]) ||
            !($params[2]['uses'] instanceof \Closure  || is_array($params[2]['uses'])) )
            throw new \InvalidArgumentException('third parameter should be an array containing a
                                                   valid callback : array(\'as\'=>\'routename\', function () { })  ');
        
        return $params;
    }
private static function fixParams($method, $params)
    {
        if (! in_array(strtolower($method), array('get','post','patch','put','delete','any','head')))
            throw new \BadMethodCallException("valid methods are 'get','post','patch','put','delete','any','head'");


        //fix closures / controllers 
        if  (is_array($params) && isset($params[2]) && is_array($params[2])) {

            
            //controller@method
            if (isset($params[2]['uses']) && is_string($params[2]['uses']) && strpos($params[2]['uses'], '@'))
            {
               
                $callback = explode('@', $params[2]['uses']);
                $params[2] = array('as'=>$params[2]['as'], 'uses'=> $callback);
            }
            
            //closure fix
            if (isset($params[2]['as']) && isset($params[2][0]) && ($params[2][0] instanceof \Closure))
            {
                $params[2] = array('as'=>$params[2]['as'], 'uses'=> $params[2][0]);
            }
        }
        
        //no route name given, so route_name will be the first parameter
        if  (is_array($params) && isset($params[2]) && ($params[2] instanceof \Closure)) {
            $params[2] = array('as'=>$params[0], 'uses'=>$params[2]);
        }
        
        if (count($params)<3 ||
            !is_array($params[2]) ||
            !array_key_exists('as', $params[2]) ||
            !array_key_exists('uses', $params[2]) ||
            !($params[2]['uses'] instanceof \Closure  || is_array($params[2]['uses'])) )
            throw new \InvalidArgumentException('third parameter should be an array containing a
                                                   valid callback : array(\'as\'=>\'routename\', function () { })  ');
        
        return $params;
    }
private static function fixParams ( $ method , $ params ) { if ( ! in_array ( strtolower ( $ method ) , array ( 'get' , 'post' , 'patch' , 'put' , 'delete' , 'any' , 'head' ) ) ) throw new \ BadMethodCallException ( "valid methods are 'get','post','patch','put','delete','any','head'" ) ; //fix closures / controllers  if ( is_array ( $ params ) && isset ( $ params [ 2 ] ) && is_array ( $ params [ 2 ] ) ) { //controller@method if ( isset ( $ params [ 2 ] [ 'uses' ] ) && is_string ( $ params [ 2 ] [ 'uses' ] ) && strpos ( $ params [ 2 ] [ 'uses' ] , '@' ) ) { $ callback = explode ( '@' , $ params [ 2 ] [ 'uses' ] ) ; $ params [ 2 ] = array ( 'as' => $ params [ 2 ] [ 'as' ] , 'uses' => $ callback ) ; } //closure fix if ( isset ( $ params [ 2 ] [ 'as' ] ) && isset ( $ params [ 2 ] [ 0 ] ) && ( $ params [ 2 ] [ 0 ] instanceof \ Closure ) ) { $ params [ 2 ] = array ( 'as' => $ params [ 2 ] [ 'as' ] , 'uses' => $ params [ 2 ] [ 0 ] ) ; } } //no route name given, so route_name will be the first parameter if ( is_array ( $ params ) && isset ( $ params [ 2 ] ) && ( $ params [ 2 ] instanceof \ Closure ) ) { $ params [ 2 ] = array ( 'as' => $ params [ 0 ] , 'uses' => $ params [ 2 ] ) ; } if ( count ( $ params ) < 3 || ! is_array ( $ params [ 2 ] ) || ! array_key_exists ( 'as' , $ params [ 2 ] ) || ! array_key_exists ( 'uses' , $ params [ 2 ] ) || ! ( $ params [ 2 ] [ 'uses' ] instanceof \ Closure || is_array ( $ params [ 2 ] [ 'uses' ] ) ) ) throw new \ InvalidArgumentException ( 'third parameter should be an array containing a
                                                   valid callback : array(\'as\'=>\'routename\', function () { })  ' ) ; return $ params ; }
check if route method call is correct, and try to fix if not
@param $method
@param $params
check if route method call is correct and try to fix if not