public function testGetEntity()
 {
     $controller = new JsonApiController();
     $meta = $this->getMockBuilder("Doctrine\\ORM\\Mapping\\ClassMetadata")->setConstructorArgs(["NwApi\\Entities\\User"])->getMock();
     $di = Di::getInstance();
     $di->em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $di->em->expects($this->any())->method('find')->willReturn(new NwApi\Entities\User());
     $meta->identifier = ['id'];
     $controller->getEntity($meta, [$this->faker->randomDigit()]);
 }
 /**
  * handler Json Response when everything is ok.
  */
 protected function handleJsonResponse()
 {
     $acceptContentType = $this->app->request->headers->get('Accept');
     $body = $this->app->response->getBody();
     if (strpos($acceptContentType, 'text/html') !== false) {
         $di = Di::getInstance();
         $this->app->response->headers->set('Content-Type', 'text/html');
         $this->app->response->setBody('');
         $responseStatus = $this->app->response->getStatus();
         $this->app->render('JsonMiddleware.php', ['requestUri' => $this->app->request->getResourceUri(), 'requestHeaders' => $this->app->request->headers->all(), 'requestBody' => $this->app->request->getBody(), 'responseHeaders' => $this->app->response->headers->all(), 'responseBody' => $body, 'responseStatusMessage' => $this->app->response->getMessageForCode($responseStatus), 'sqlQueries' => $di->sqlLogger->queries]);
     }
 }
 protected function __construct($instanceId)
 {
     parent::__construct($instanceId);
     $di = \NwApi\Di::getInstance();
     require $di->configPath . $instanceId . '.php';
     $vars = get_defined_vars();
     unset($vars['instanceId']);
     unset($vars['di']);
     foreach ($vars as $name => $value) {
         $this->{$name} = $value;
     }
 }
<?php

require '../vendor/autoload.php';
\NwApi\Di::getInstance()->slim->run();
<?php

return \NwApi\Di::getInstance()->srcPath . 'Templates/';
<?php

return \NwApi\Di::getInstance()->srcPath . 'Entities/';
<?php

use NwApi\Di;
use NwApi\Middlewares\JsonApiMiddleware;
$di = Di::getInstance();
if ($di->env === ENV_DEVELOPMENT) {
    $slimMode = 'development';
    $debug = true;
} else {
    $slimMode = 'production';
    $debug = false;
}
$app = new Slim\Slim(['mode' => $slimMode, 'debug' => false, 'templates.path' => $di->templatesPath]);
$app->add(new JsonApiMiddleware());
if ($debug === true) {
    $app->add(new \Slim\Middleware\PrettyExceptions());
    $app->error(function (\Exception $e) {
        throw $e;
    });
}
$app->get('/hello/:name', function ($name) {
    echo "Hello, {$name}";
});
return $app;
 private function responseEntities($entities, $filters, $orders, $limit, $offset)
 {
     $links = [];
     if ($limit > 0) {
         if ($offset > 0) {
             $links['prev'] = $this->getEntitiesUrl($filters, $orders, $limit, max($offset - $limit, 0));
         }
         if (count($entities) === $limit) {
             $links['next'] = $this->getEntitiesUrl($filters, $orders, $limit, $offset + $limit);
         }
     }
     $di = Di::getInstance();
     $di->slim->response->header('X-Json-Api', json_encode(['links' => $links]));
     $this->response($entities);
 }
 /**
  * Gets the class metadata descriptor for a class.
  *
  * @param string $className The name of the class.
  *
  * @return ClassMetadata
  */
 private function getEntityMeta($className)
 {
     $di = Di::getInstance();
     return $di->em->getMetadataFactory()->getMetadataFor($className);
 }
<?php

return \NwApi\Di::getInstance()->rootPath . 'config/';
<?php

return \NwApi\Di::getInstance()->rootPath . 'src/';