Exemplo n.º 1
0
 public function __unset($name)
 {
     $this->container->remove($name);
 }
Exemplo n.º 2
0
        $client->map([$app->config('database')['db_name'] => '\\API\\Collection']);
        $client->useDatabase($app->config('database')['db_name']);
        return $client;
    });
});
// CORS compatibility layer (Internet Explorer)
$app->hook('slim.before.router', function () use($app) {
    if ($app->request->isPost() && $app->request->get('method')) {
        $method = $app->request->get('method');
        $app->environment()['REQUEST_METHOD'] = strtoupper($method);
        mb_parse_str($app->request->getBody(), $postData);
        $parameters = new Set($postData);
        if ($parameters->has('content')) {
            $content = $parameters->get('content');
            $app->environment()['slim.input'] = $content;
            $parameters->remove('content');
        } else {
            // Content is the only valid body parameter...everything else are either headers or query parameters
            $app->environment()['slim.input'] = '';
        }
        $app->request->headers->replace($parameters->all());
        $app->environment()['slim.request.query_hash'] = $parameters->all();
    }
});
// Parse version
$app->hook('slim.before.dispatch', function () use($app) {
    // Version
    $app->container->singleton('version', function () use($app) {
        if ($app->request->isOptions() || $app->request->getPathInfo() === '/about' || strpos(strtolower($app->request->getPathInfo()), '/oauth') === 0) {
            $versionString = $app->config('xAPI')['latest_version'];
        } else {