public function execute(): void
    {
        $path = '';
        
        try {
            $path = $this->getPath();
            
            if ($this->config->cache) {
                try {
                    $this->setCache();
                } catch (StorageNotSupportedException $e) {
                    $this->cache = null;
                } catch (StorageConnectException $e) {
                    $this->cache = null;
                }
            }
            
            if (null !== $this->cache 
            && !$this->cache->expired($path, $this->config->cacheTtlWholePage)) {
                $result = $this->getCacheResult($this->cache->get($path, ''));
            } else {
                $result = $this->compose($this->parse($path));
            }
            
        } catch (BadPathException $e) {
            $result = $this->getError(500, 'Bad path');
            
        } catch (RouteStorageNotSetException $e) {
            $result = $this->getError(500, 'Route storage not set');
            
        } catch (RouteStorageEmptyException $e) {
            $result = $this->getError(500, 'Route storage empty');
            
        } catch (DbConnectException $e) {
            if (null !== $this->cache && $this->cache->has($path)) {
                // @codeCoverageIgnoreStart
                // passed in local tests, but skipped in travis
                $result = $this->getCacheResult($this->cache->get($path, ''));
                // @codeCoverageIgnoreEnd
            } else {
                $result = $this->getError(500, 'DataBase connection error');
            }
            
        } catch (SectionNotExistsException $e) {
            $result = $this->getError(404, 'Section not exists');
            
        } catch (SectionDisabledException $e) {
            $result = $this->getError(403, 'Section disabled');
            
        } catch (ModuleDisabledException $e) {
            $result = $this->getError(403, 'Section module disabled');
            
        } catch (ModuleParameterConflictException $e) {
            $result = $this->getError(404, 'Module parameter conflict with another');
            
        } catch (ModuleParameterFormatException $e) {
            $result = $this->getError(404, 'Module parameter bad format');
            
        } catch (ModuleParameterUnknownException $e) {
            $result = $this->getError(404, 'Module parameter unknown');
            
        } catch (\Throwable $e) {
            $result = $this->getError(500, 'Unexpected exception: ' . $e->getMessage());
            
        }
        
        $this->sendHeaders($result->getHeaders());
        
        $this->render($result->getView());
    }
public function execute(): void
    {
        $path = '';
        
        try {
            $path = $this->getPath();
            
            if ($this->config->cache) {
                try {
                    $this->setCache();
                } catch (StorageNotSupportedException $e) {
                    $this->cache = null;
                } catch (StorageConnectException $e) {
                    $this->cache = null;
                }
            }
            
            if (null !== $this->cache 
            && !$this->cache->expired($path, $this->config->cacheTtlWholePage)) {
                $result = $this->getCacheResult($this->cache->get($path, ''));
            } else {
                $result = $this->compose($this->parse($path));
            }
            
        } catch (BadPathException $e) {
            $result = $this->getError(500, 'Bad path');
            
        } catch (RouteStorageNotSetException $e) {
            $result = $this->getError(500, 'Route storage not set');
            
        } catch (RouteStorageEmptyException $e) {
            $result = $this->getError(500, 'Route storage empty');
            
        } catch (DbConnectException $e) {
            if (null !== $this->cache && $this->cache->has($path)) {
                // @codeCoverageIgnoreStart
                // passed in local tests, but skipped in travis
                $result = $this->getCacheResult($this->cache->get($path, ''));
                // @codeCoverageIgnoreEnd
            } else {
                $result = $this->getError(500, 'DataBase connection error');
            }
            
        } catch (SectionNotExistsException $e) {
            $result = $this->getError(404, 'Section not exists');
            
        } catch (SectionDisabledException $e) {
            $result = $this->getError(403, 'Section disabled');
            
        } catch (ModuleDisabledException $e) {
            $result = $this->getError(403, 'Section module disabled');
            
        } catch (ModuleParameterConflictException $e) {
            $result = $this->getError(404, 'Module parameter conflict with another');
            
        } catch (ModuleParameterFormatException $e) {
            $result = $this->getError(404, 'Module parameter bad format');
            
        } catch (ModuleParameterUnknownException $e) {
            $result = $this->getError(404, 'Module parameter unknown');
            
        } catch (\Throwable $e) {
            $result = $this->getError(500, 'Unexpected exception: ' . $e->getMessage());
            
        }
        
        $this->sendHeaders($result->getHeaders());
        
        $this->render($result->getView());
    }
public function execute ( ) : void { $ path = '' ; try { $ path = $ this -> getPath ( ) ; if ( $ this -> config -> cache ) { try { $ this -> setCache ( ) ; } catch ( StorageNotSupportedException $ e ) { $ this -> cache = null ; } catch ( StorageConnectException $ e ) { $ this -> cache = null ; } } if ( null !== $ this -> cache && ! $ this -> cache -> expired ( $ path , $ this -> config -> cacheTtlWholePage ) ) { $ result = $ this -> getCacheResult ( $ this -> cache -> get ( $ path , '' ) ) ; } else { $ result = $ this -> compose ( $ this -> parse ( $ path ) ) ; } } catch ( BadPathException $ e ) { $ result = $ this -> getError ( 500 , 'Bad path' ) ; } catch ( RouteStorageNotSetException $ e ) { $ result = $ this -> getError ( 500 , 'Route storage not set' ) ; } catch ( RouteStorageEmptyException $ e ) { $ result = $ this -> getError ( 500 , 'Route storage empty' ) ; } catch ( DbConnectException $ e ) { if ( null !== $ this -> cache && $ this -> cache -> has ( $ path ) ) { // @codeCoverageIgnoreStart // passed in local tests, but skipped in travis $ result = $ this -> getCacheResult ( $ this -> cache -> get ( $ path , '' ) ) ; // @codeCoverageIgnoreEnd } else { $ result = $ this -> getError ( 500 , 'DataBase connection error' ) ; } } catch ( SectionNotExistsException $ e ) { $ result = $ this -> getError ( 404 , 'Section not exists' ) ; } catch ( SectionDisabledException $ e ) { $ result = $ this -> getError ( 403 , 'Section disabled' ) ; } catch ( ModuleDisabledException $ e ) { $ result = $ this -> getError ( 403 , 'Section module disabled' ) ; } catch ( ModuleParameterConflictException $ e ) { $ result = $ this -> getError ( 404 , 'Module parameter conflict with another' ) ; } catch ( ModuleParameterFormatException $ e ) { $ result = $ this -> getError ( 404 , 'Module parameter bad format' ) ; } catch ( ModuleParameterUnknownException $ e ) { $ result = $ this -> getError ( 404 , 'Module parameter unknown' ) ; } catch ( \ Throwable $ e ) { $ result = $ this -> getError ( 500 , 'Unexpected exception: ' . $ e -> getMessage ( ) ) ; } $ this -> sendHeaders ( $ result -> getHeaders ( ) ) ; $ this -> render ( $ result -> getView ( ) ) ; }
Application main workflow.
@return void
Application main workflow .