Constructor
public __construct ( array $settings = [] ) | ||
$settings | array | optional Application settings |
/** * {@inheritdoc} * @see \Scalr\Api\Rest\Application::__construct() */ public function __construct(array $settings = []) { parent::__construct($settings); $cont = $this->getContainer(); $cont->api->setShared('meta', function ($cont) { return new Meta(); }); }
/** * {@inheritdoc} * @see \Scalr\Api\Rest\Application::__construct() */ public function __construct(array $settings = []) { parent::__construct($settings); $cont = $this->getContainer(); $cont->api->setShared('meta', function ($cont) { return new Meta(); }); $cont->api->setShared('warnings', function () { return new Warnings(); }); $this->pathPreprocessor = function ($method, $pathInfo) { if (preg_match("#^/api/(user|admin|account)/#", $pathInfo)) { $pathInfo = preg_replace("#/(user|admin|account)/(v\\d.*?)/#", '/$2/$1/', $pathInfo); $this->warnings->appendWarnings(Response::getCodeMessage(301), sprintf('Location %s', $pathInfo)); } return [$method, $pathInfo]; }; $this->limiter = new Limiter(\Scalr::getContainer()->config->{'scalr.system.api.limits'}); }