public function before($callback, $group = null, $methods = array())
    {
        $methods = array_map('strtoupper', $methods);
        if ($group === null) {
            if (self::$group !== null) {
                $group = self::$group;
            } else {
                $group = 'global';
            }
        }

        $this->addMiddleware(new Middleware($callback, 'before', $methods, $group));
    }
public function before($callback, $group = null, $methods = array())
    {
        $methods = array_map('strtoupper', $methods);
        if ($group === null) {
            if (self::$group !== null) {
                $group = self::$group;
            } else {
                $group = 'global';
            }
        }

        $this->addMiddleware(new Middleware($callback, 'before', $methods, $group));
    }
public function before ( $ callback , $ group = null , $ methods = array ( ) ) { $ methods = array_map ( 'strtoupper' , $ methods ) ; if ( $ group === null ) { if ( self :: $ group !== null ) { $ group = self :: $ group ; } else { $ group = 'global' ; } } $ this -> addMiddleware ( new Middleware ( $ callback , 'before' , $ methods , $ group ) ) ; }
Add before middleware.

@param string|callable $callback
@param string $group Optional group. leave empty for global. When in group define it will be filled with the active group name!
@param array $methods Array of methods, leave undefined for all methods, 'GET'/'POST'/'PUT'/'DELETE'.
Add before middleware .