protected function isAjax() : bool 
    {
        $header = $this->request->getHeaders()->get('X-Requested-With');

        if ($header === null) {
            return false;
        }
        
        return $header->getValue() === 'XMLHttpRequest';
    }
protected function isAjax() : bool 
    {
        $header = $this->request->getHeaders()->get('X-Requested-With');

        if ($header === null) {
            return false;
        }
        
        return $header->getValue() === 'XMLHttpRequest';
    }
protected function isAjax ( ) : bool { $ header = $ this -> request -> getHeaders ( ) -> get ( 'X-Requested-With' ) ; if ( $ header === null ) { return false ; } return $ header -> getValue ( ) === 'XMLHttpRequest' ; }
Is the current request done with ajax?

@return bool
Is the current request done with ajax?