public function before($methods, $pattern, $fn)
    {
        $pattern = $this->baseRoute . '/' . trim($pattern, '/');
        $pattern = $this->baseRoute ? rtrim($pattern, '/') : $pattern;

        foreach (explode('|', $methods) as $method) {
            $this->beforeRoutes[$method][] = [
                'pattern' => $pattern,
                'fn' => $fn,
            ];
        }
    }
public function before($methods, $pattern, $fn)
    {
        $pattern = $this->baseRoute . '/' . trim($pattern, '/');
        $pattern = $this->baseRoute ? rtrim($pattern, '/') : $pattern;

        foreach (explode('|', $methods) as $method) {
            $this->beforeRoutes[$method][] = [
                'pattern' => $pattern,
                'fn' => $fn,
            ];
        }
    }
public function before ( $ methods , $ pattern , $ fn ) { $ pattern = $ this -> baseRoute . '/' . trim ( $ pattern , '/' ) ; $ pattern = $ this -> baseRoute ? rtrim ( $ pattern , '/' ) : $ pattern ; foreach ( explode ( '|' , $ methods ) as $ method ) { $ this -> beforeRoutes [ $ method ] [ ] = [ 'pattern' => $ pattern , 'fn' => $ fn , ] ; } }
Store a before middleware route and a handling function to be executed when accessed using one of the specified methods.

@param string          $methods Allowed methods, | delimited
@param string          $pattern A route pattern such as /about/system
@param object|callable $fn      The handling function to be executed
Store a before middleware route and a handling function to be executed when accessed using one of the specified methods .