final public function getHandleStack($request=null)
    {
        if (!is_array($this->handleStack)) {
            $this->handleStack = [];
            
            $request || $request = static::getApp()->getRequest();
            
            $handler = $this->getHandler();
            $requestMethod = ucfirst(strtolower($request->getMethod()));
            $action = $this->getCamelCaseAction();
            
            // 1. 调用栈 handleStack
            if (!$this->handleStack) {
                if ($requestMethod === 'Options') {
                    array_push($this->handleStack, 'doOptions');
                } else {
                    // do<Get|Post>Action or <action>(only for GET), if not exist then notFound()
                    $actions = [];
                    
                    $actions[]  = 'do' . $requestMethod . ($action && $action!=='index' ? ucfirst($action) : '');
                    
                    if ($requestMethod === 'Get') {
                        if (!$action || $action == 'index') {
                            $actions[]  = 'index';
                        } else {
                            if (!$this->isForbiddenMethod($action)) {
                                $actions[] = $action;
                            }
                        }
                    }
                    
                    foreach ($actions as $method) {
                        if (method_exists($handler, $method)) {
                            array_push($this->handleStack, $method);
                            break;
                        }
                    }
                }
                
                if ($this->handleStack && in_array($requestMethod, ['Get', 'Post']) && $this->getHandler() instanceof \Wslim\Common\Controller) {
                    // before<RequestMethod>
                    $this->handleStack = array_merge(['init', 'before' . $requestMethod], $this->handleStack);
                }
            }
        }
        
        return $this->handleStack;
    }
final public function getHandleStack($request=null)
    {
        if (!is_array($this->handleStack)) {
            $this->handleStack = [];
            
            $request || $request = static::getApp()->getRequest();
            
            $handler = $this->getHandler();
            $requestMethod = ucfirst(strtolower($request->getMethod()));
            $action = $this->getCamelCaseAction();
            
            // 1. 调用栈 handleStack
            if (!$this->handleStack) {
                if ($requestMethod === 'Options') {
                    array_push($this->handleStack, 'doOptions');
                } else {
                    // do<Get|Post>Action or <action>(only for GET), if not exist then notFound()
                    $actions = [];
                    
                    $actions[]  = 'do' . $requestMethod . ($action && $action!=='index' ? ucfirst($action) : '');
                    
                    if ($requestMethod === 'Get') {
                        if (!$action || $action == 'index') {
                            $actions[]  = 'index';
                        } else {
                            if (!$this->isForbiddenMethod($action)) {
                                $actions[] = $action;
                            }
                        }
                    }
                    
                    foreach ($actions as $method) {
                        if (method_exists($handler, $method)) {
                            array_push($this->handleStack, $method);
                            break;
                        }
                    }
                }
                
                if ($this->handleStack && in_array($requestMethod, ['Get', 'Post']) && $this->getHandler() instanceof \Wslim\Common\Controller) {
                    // before<RequestMethod>
                    $this->handleStack = array_merge(['init', 'before' . $requestMethod], $this->handleStack);
                }
            }
        }
        
        return $this->handleStack;
    }
final public function getHandleStack ( $ request = null ) { if ( ! is_array ( $ this -> handleStack ) ) { $ this -> handleStack = [ ] ; $ request || $ request = static :: getApp ( ) -> getRequest ( ) ; $ handler = $ this -> getHandler ( ) ; $ requestMethod = ucfirst ( strtolower ( $ request -> getMethod ( ) ) ) ; $ action = $ this -> getCamelCaseAction ( ) ; // 1. 调用栈 handleStack if ( ! $ this -> handleStack ) { if ( $ requestMethod === 'Options' ) { array_push ( $ this -> handleStack , 'doOptions' ) ; } else { // do<Get|Post>Action or <action>(only for GET), if not exist then notFound() $ actions = [ ] ; $ actions [ ] = 'do' . $ requestMethod . ( $ action && $ action !== 'index' ? ucfirst ( $ action ) : '' ) ; if ( $ requestMethod === 'Get' ) { if ( ! $ action || $ action == 'index' ) { $ actions [ ] = 'index' ; } else { if ( ! $ this -> isForbiddenMethod ( $ action ) ) { $ actions [ ] = $ action ; } } } foreach ( $ actions as $ method ) { if ( method_exists ( $ handler , $ method ) ) { array_push ( $ this -> handleStack , $ method ) ; break ; } } } if ( $ this -> handleStack && in_array ( $ requestMethod , [ 'Get' , 'Post' ] ) && $ this -> getHandler ( ) instanceof \ Wslim \ Common \ Controller ) { // before<RequestMethod> $ this -> handleStack = array_merge ( [ 'init' , 'before' . $ requestMethod ] , $ this -> handleStack ) ; } } } return $ this -> handleStack ; }
get handle stack
@param  RequestInterface $request
@return array
get handle stack