engelsystem/src/Controllers/SettingsController.php

49 lines
998 B
PHP
Raw Normal View History

2020-11-15 18:47:30 +01:00
<?php
namespace Engelsystem\Controllers;
use Engelsystem\Config\Config;
use Engelsystem\Http\Exceptions\HttpNotFound;
use Engelsystem\Http\Response;
class SettingsController extends BaseController
{
use HasUserNotifications;
/** @var Config */
protected $config;
/** @var Response */
protected $response;
/**
* @param Config $config
* @param Response $response
*/
public function __construct(
Config $config,
Response $response
) {
$this->config = $config;
$this->response = $response;
}
/**
* @return Response
*/
public function oauth(): Response
{
$providers = $this->config->get('oauth');
if (empty($providers)) {
throw new HttpNotFound();
}
return $this->response->withView(
'pages/settings/oauth.twig',
[
'providers' => $providers,
] + $this->getNotifications(),
);
}
}