private function beforeAfterControllerAction(string $when): void
    {
        $method = $when.\ucfirst($this->routeAction);

        if (\method_exists($this->controller, $method) && $method !== $when) {
            \call_user_func([$this->controller, $method]);
        }
    }
private function beforeAfterControllerAction(string $when): void
    {
        $method = $when.\ucfirst($this->routeAction);

        if (\method_exists($this->controller, $method) && $method !== $when) {
            \call_user_func([$this->controller, $method]);
        }
    }
private function beforeAfterControllerAction ( string $ when ) : void { $ method = $ when . \ ucfirst ( $ this -> routeAction ) ; if ( \ method_exists ( $ this -> controller , $ method ) && $ method !== $ when ) { \ call_user_func ( [ $ this -> controller , $ method ] ) ; } }
Run action before or after controller action execution.

@param string $when

@return void
Run action before or after controller action execution .