本文整理匯總了PHP中Slim\Slim::settings方法的典型用法代碼示例。如果您正苦於以下問題:PHP Slim::settings方法的具體用法?PHP Slim::settings怎麽用?PHP Slim::settings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Slim\Slim
的用法示例。
在下文中一共展示了Slim::settings方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getMiddleware
public function getMiddleware(Slim $app)
{
if (!$this->auth) {
$auth = $app->config('api.classes.auth.adapter');
if (!$auth || !class_exists($auth)) {
throw new \InvalidArgumentException('Config value api.classes.auth.adapter="' . $auth . '" which does not exist');
}
$storage = $app->config('api.classes.auth.storage');
if (!$storage || !class_exists($storage)) {
throw new \InvalidArgumentException('Config value api.classes.auth.storage="' . $storage . '" which does not exist');
}
$storage = new $storage($app->settings());
if (!$storage instanceof StorageInterface) {
throw new \InvalidArgumentException('Class ' . get_class($storage) . ' must implement StorageInterface');
}
$auth = $this->auth = new $auth($storage, $app);
if (!$auth instanceof AuthInterface) {
throw new \InvalidArgumentException('Class ' . get_class($auth) . ' must implement AuthInterface');
}
}
return array($this->auth, 'authenticate');
// this notation is lighter in the engine than a closure
}