/**
  * Kernel constructor.
  */
 public function __construct()
 {
     try {
         $this->Request = new Request();
         $this->Router = new Router($this->Request);
         $ControllerLoader = new ControllerLoader($this->Request->getController());
         if ($ControllerLoader->exist()) {
             $this->Controller = $ControllerLoader->getInstance($this->Request);
             if (method_exists($this->Controller, $this->Request->getAction())) {
                 call_user_func([$this->Controller, $this->Request->getAction()], $this->Request->getParams());
                 $Logger = new Logger('/logs/access.log');
                 $Date = new \DateTime('now');
                 $Logger->writeLine('[' . $Date->getTimestamp() . '] Path:' . $this->Request->getPath() . ' type:' . $this->Request->getMethod());
             } else {
                 $exception = new NotFoundException('Path:' . $this->Request->getPath() . ', Action ' . $this->Request->getAction() . ' not found in Controller ' . ucfirst($this->Request->getController() . 'Controller'));
                 throw $exception;
             }
         } else {
             $exception = new NotFoundException('Path:' . $this->Request->getPath() . ', Controller ' . ucfirst($this->Request->getController()) . 'Controller not found');
             throw $exception;
         }
     } catch (NotFoundException $e) {
         echo $e->cry();
     }
 }
 /**
  * Exception constructor.
  * @param string $message
  * @param int $code
  * @param \Exception|null $previous
  */
 public function __construct($message, $code = 0, \Exception $previous = null)
 {
     parent::__construct($message, $code, $previous);
     $Date = new \DateTime();
     $Logger = new Logger('/logs/error.log');
     $Logger->writeLine('[' . $Date->getTimestamp() . '] ' . $message);
 }
Example #3
0
 /**
  * @param null $message
  * @param null $file
  * @param null $line
  * @throws \Exception
  */
 private static function errorLogNotice($message = null, $file = null, $line = null)
 {
     /** @var \Zend\Log\Logger $logger */
     $logger = \Core\Service\Logger::getLogger();
     $logger->err('##NOTICE START##');
     $logger->err('##File## ' . $file);
     $logger->err('##Line## ' . $line);
     $logger->err('##Message## ' . $message);
     $logger->err('##NOTICE ERROR END##');
 }