Phprest\Config::isDebug PHP Method

isDebug() public method

public isDebug ( ) : boolean
return boolean
    public function isDebug()
    {
        return $this->debug;
    }

Usage Example

コード例 #1
0
ファイル: JsonXml.php プロジェクト: phprest/phprest
 /**
  * @param \Exception $exception
  *
  * @return string
  */
 public function format(\Exception $exception)
 {
     $response = new Response();
     try {
         $response = $this->serialize($this->config->isDebug() ? new Entity\DebugError($exception) : new Entity\Error($exception), is_null($this->request) ? Request::createFromGlobals() : $this->request, $response);
     } catch (\Exception $e) {
         $response->setContent($this->serviceHateoas()->getSerializer()->serialize($this->config->isDebug() ? new Entity\DebugError($e) : new Entity\Error($e), 'json'));
         $vendor = $this->getContainer()->get(Application::CONTAINER_ID_VENDOR);
         $apiVersion = $this->getContainer()->get(Application::CONTAINER_ID_API_VERSION);
         $response->headers->set('Content-Type', 'application/vnd.' . $vendor . '-v' . $apiVersion . '+json');
     }
     $response->setStatusCode(method_exists($exception, 'getStatusCode') ? $exception->getStatusCode() : 500);
     $response->sendHeaders();
     return $response->getContent();
 }
All Usage Examples Of Phprest\Config::isDebug