Example #1
0
 /**
  * This method executed on shutdown after the response is sent.
  */
 public function terminate()
 {
     if (!$this->application || false === $this->application->isStarted()) {
         return;
     }
     ob_implicit_flush(true);
     flush();
     // $response may not be set
     if ($this->response instanceof Response) {
         $this->application->getEventDispatcher()->dispatch(KernelEvents::TERMINATE, new PostResponseEvent($this, $this->getRequest(), $this->response));
     }
 }
 public function getRelativeUrl($uri)
 {
     $url = $uri;
     if ($this->application->isStarted() && null !== $this->application->getRequest()) {
         $request = $this->application->getRequest();
         $baseurl = str_replace('\\', '/', $request->getSchemeAndHttpHost() . dirname($request->getBaseUrl()));
         $url = str_replace($baseurl, '', $uri);
         if (false !== ($ext = strrpos($url, '.'))) {
             $url = substr($url, 0, $ext);
         }
         if ('/' != substr($url, 0, 1)) {
             $url = '/' . $url;
         }
     }
     return $url;
 }
 /**
  * @see BackBee\Cache\Validator\ValidatorInterface::isValid
  */
 public function isValid($object = null)
 {
     return false === $this->application->isDebugMode() && null === $this->application->getBBUserToken() && true === $this->application->isStarted() && false === $this->application->isClientSAPI();
 }