Пример #1
0
 public function runPlatform()
 {
     try {
         $this->getDebugger();
         $this->setErrorHandler();
         $this->setShutdownHandler();
         /**
          * Register Cluster
          */
         Platform::registerCluster();
         People::registerCluster();
         Corporation::registerCluster();
         Education::registerCluster();
         Billing::registerCluster();
         Transfer::registerCluster();
         Availability::registerCluster();
         Contact::registerCluster();
         /**
          * Execute Request
          */
         if ($this->runAuthenticator()) {
             self::getDisplay()->setContent(self::getDispatcher()->fetchRoute($this->getRequest()->getPathInfo()));
         }
     } catch (PDOException $Exception) {
         $this->runSelfHeal($Exception);
     } catch (TableNotFoundException $Exception) {
         $this->runSelfHeal($Exception);
     } catch (\PDOException $Exception) {
         $this->runSelfHeal($Exception);
     } catch (\ErrorException $Exception) {
         self::getDisplay()->setException($Exception, 'Error');
     } catch (\Exception $Exception) {
         self::getDisplay()->setException($Exception, 'Exception');
     }
     try {
         echo self::getDisplay()->getContent();
         exit(0);
     } catch (\Exception $Exception) {
         $this->runSelfHeal($Exception);
     }
 }
Пример #2
0
 public function runPlatform()
 {
     /**
      * REST-API
      */
     if (preg_match('!^/Api/!is', $this->getRequest()->getPathInfo())) {
         try {
             $this->getDebugger();
             $this->setErrorHandler();
             $this->setShutdownHandler();
             /**
              * Register Cluster
              */
             Platform::registerCluster();
             Api::registerCluster();
             if ($this->runAuthenticator()) {
                 echo self::getDispatcher()->fetchRoute($this->getRequest()->getPathInfo());
             } else {
                 header('HTTP/1.0 400 Bad Request');
             }
             exit(0);
         } catch (\Exception $Exception) {
             $this->runSelfHeal($Exception);
         }
     }
     /**
      * APPLICATION
      */
     try {
         $this->getDebugger();
         $this->setErrorHandler();
         $this->setShutdownHandler();
         /**
          * Register Cluster
          */
         Platform::registerCluster();
         People::registerCluster();
         Corporation::registerCluster();
         Education::registerCluster();
         //            Billing::registerCluster();
         //            Transfer::registerCluster();
         Contact::registerCluster();
         Setting::registerCluster();
         //            Generator::registerCluster();
         /**
          * Execute Request
          */
         if ($this->runAuthenticator()) {
             self::getDisplay()->setContent(self::getDispatcher()->fetchRoute($this->getRequest()->getPathInfo()));
         }
     } catch (PDOException $Exception) {
         $this->runSelfHeal($Exception);
     } catch (InvalidFieldNameException $Exception) {
         (new Cache(new ApcSma()))->getCache()->clearCache();
         (new Cache(new Apcu()))->getCache()->clearCache();
         (new Cache(new ApcUser()))->getCache()->clearCache();
         (new Cache(new Memcached()))->getCache()->clearCache();
         (new Cache(new Memory()))->getCache()->clearCache();
         (new Cache(new OpCache()))->getCache()->clearCache();
         $this->runSelfHeal($Exception);
     } catch (TableNotFoundException $Exception) {
         $this->runSelfHeal($Exception);
     } catch (\PDOException $Exception) {
         $this->runSelfHeal($Exception);
     } catch (\ErrorException $Exception) {
         self::getDisplay()->setException($Exception, 'Error');
     } catch (\Exception $Exception) {
         self::getDisplay()->setException($Exception, get_class($Exception));
     }
     try {
         echo self::getDisplay()->getContent();
         exit(0);
     } catch (\Exception $Exception) {
         $this->runSelfHeal($Exception);
     }
 }