Use constructor property promotion
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
This commit is contained in:
parent
b004f865b4
commit
61139e03c3
|
@ -36,5 +36,6 @@
|
|||
<exclude-pattern>/includes</exclude-pattern>
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification" />
|
||||
</rule>
|
||||
<rule ref="SlevomatCodingStandard.Classes.RequireConstructorPropertyPromotion" />
|
||||
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment" />
|
||||
</ruleset>
|
||||
|
|
|
@ -11,16 +11,9 @@ class SetAdminPassword extends Migration
|
|||
{
|
||||
use Reference;
|
||||
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected Config $config;
|
||||
|
||||
public function __construct(SchemaBuilder $schemaBuilder, Authenticator $auth, Config $config)
|
||||
public function __construct(SchemaBuilder $schemaBuilder, protected Authenticator $auth, protected Config $config)
|
||||
{
|
||||
parent::__construct($schemaBuilder);
|
||||
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,22 +13,14 @@ use Symfony\Component\Mailer\Exception\TransportException;
|
|||
|
||||
class Shift
|
||||
{
|
||||
/** @var LoggerInterface */
|
||||
protected LoggerInterface $log;
|
||||
|
||||
/** @var EngelsystemMailer */
|
||||
protected EngelsystemMailer $mailer;
|
||||
|
||||
/**
|
||||
* @param LoggerInterface $log
|
||||
* @param EngelsystemMailer $mailer
|
||||
*/
|
||||
public function __construct(
|
||||
LoggerInterface $log,
|
||||
EngelsystemMailer $mailer
|
||||
protected LoggerInterface $log,
|
||||
protected EngelsystemMailer $mailer
|
||||
) {
|
||||
$this->log = $log;
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,9 +53,6 @@ class ShiftSignupState
|
|||
*/
|
||||
public const NOT_ARRIVED = 'NOT_ARRIVED';
|
||||
|
||||
/** @var string */
|
||||
private $state;
|
||||
|
||||
/** @var int */
|
||||
private $freeEntries;
|
||||
|
||||
|
@ -65,9 +62,8 @@ class ShiftSignupState
|
|||
* @param string $state
|
||||
* @param int $free_entries
|
||||
*/
|
||||
public function __construct($state, $free_entries)
|
||||
public function __construct(private $state, $free_entries)
|
||||
{
|
||||
$this->state = $state;
|
||||
$this->freeEntries = $free_entries;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,9 +29,6 @@ class ShiftsFilter
|
|||
/** @var int[] */
|
||||
private $filled;
|
||||
|
||||
/** @var int[] */
|
||||
private $rooms;
|
||||
|
||||
/** @var int[] */
|
||||
private $types;
|
||||
|
||||
|
@ -48,9 +45,8 @@ class ShiftsFilter
|
|||
* @param int[] $rooms
|
||||
* @param int[] $angelTypes
|
||||
*/
|
||||
public function __construct($user_shifts_admin = false, $rooms = [], $angelTypes = [])
|
||||
public function __construct($user_shifts_admin = false, private $rooms = [], $angelTypes = [])
|
||||
{
|
||||
$this->rooms = $rooms;
|
||||
$this->types = $angelTypes;
|
||||
|
||||
$this->filled = [
|
||||
|
|
|
@ -8,20 +8,12 @@ namespace Engelsystem;
|
|||
*/
|
||||
class ValidationResult
|
||||
{
|
||||
/** @var bool */
|
||||
private $valid;
|
||||
|
||||
/** @var mixed */
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @param boolean $valid Is the value valid?
|
||||
* @param mixed $value The validated value
|
||||
*/
|
||||
public function __construct($valid, $value)
|
||||
public function __construct(private $valid, private $value)
|
||||
{
|
||||
$this->valid = $valid;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,15 +9,6 @@ use Exception;
|
|||
*/
|
||||
class ShiftCalendarLane
|
||||
{
|
||||
/** @var int */
|
||||
private $firstBlockStartTime;
|
||||
|
||||
/** @var int */
|
||||
private $blockCount;
|
||||
|
||||
/** @var string */
|
||||
private $header;
|
||||
|
||||
/** @var array[] */
|
||||
private $shifts = [];
|
||||
|
||||
|
@ -28,11 +19,8 @@ class ShiftCalendarLane
|
|||
* @param int $firstBlockStartTime Unix timestamp
|
||||
* @param int $blockCount
|
||||
*/
|
||||
public function __construct($header, $firstBlockStartTime, $blockCount)
|
||||
public function __construct(private $header, private $firstBlockStartTime, private $blockCount)
|
||||
{
|
||||
$this->header = $header;
|
||||
$this->firstBlockStartTime = $firstBlockStartTime;
|
||||
$this->blockCount = $blockCount;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,12 +42,6 @@ class ShiftCalendarRenderer
|
|||
/** @var int */
|
||||
private $blocksPerSlot = null;
|
||||
|
||||
/** @var array[] */
|
||||
private $needed_angeltypes;
|
||||
|
||||
/** @var array[] */
|
||||
private $shift_entries;
|
||||
|
||||
/**
|
||||
* ShiftCalendarRenderer constructor.
|
||||
*
|
||||
|
@ -56,14 +50,12 @@ class ShiftCalendarRenderer
|
|||
* @param array[] $shift_entries
|
||||
* @param ShiftsFilter $shiftsFilter
|
||||
*/
|
||||
public function __construct($shifts, $needed_angeltypes, $shift_entries, ShiftsFilter $shiftsFilter)
|
||||
public function __construct($shifts, private $needed_angeltypes, private $shift_entries, ShiftsFilter $shiftsFilter)
|
||||
{
|
||||
$this->shiftsFilter = $shiftsFilter;
|
||||
$this->firstBlockStartTime = $this->calcFirstBlockStartTime($shifts);
|
||||
$this->lastBlockEndTime = $this->calcLastBlockEndTime($shifts);
|
||||
$this->lanes = $this->assignShiftsToLanes($shifts);
|
||||
$this->needed_angeltypes = $needed_angeltypes;
|
||||
$this->shift_entries = $shift_entries;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,15 +6,12 @@ use Engelsystem\Application;
|
|||
|
||||
abstract class ServiceProvider
|
||||
{
|
||||
protected Application $app;
|
||||
|
||||
/**
|
||||
* ServiceProvider constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(Application $app)
|
||||
public function __construct(protected Application $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,14 +14,8 @@ class FaqController extends BaseController
|
|||
{
|
||||
use HasUserNotifications;
|
||||
|
||||
protected LoggerInterface $log;
|
||||
|
||||
protected Faq $faq;
|
||||
|
||||
protected Redirector $redirect;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
/** @var array */
|
||||
protected array $permissions = [
|
||||
'faq.view',
|
||||
|
@ -29,15 +23,12 @@ class FaqController extends BaseController
|
|||
];
|
||||
|
||||
public function __construct(
|
||||
LoggerInterface $log,
|
||||
Faq $faq,
|
||||
protected LoggerInterface $log,
|
||||
protected Faq $faq,
|
||||
Redirector $redirector,
|
||||
Response $response
|
||||
protected Response $response
|
||||
) {
|
||||
$this->log = $log;
|
||||
$this->faq = $faq;
|
||||
$this->redirect = $redirector;
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function edit(Request $request): Response
|
||||
|
|
|
@ -9,19 +9,13 @@ use Engelsystem\Models\LogEntry;
|
|||
|
||||
class LogsController extends BaseController
|
||||
{
|
||||
protected LogEntry $log;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
/** @var array */
|
||||
protected array $permissions = [
|
||||
'admin_log',
|
||||
];
|
||||
|
||||
public function __construct(LogEntry $log, Response $response)
|
||||
public function __construct(protected LogEntry $log, protected Response $response)
|
||||
{
|
||||
$this->log = $log;
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function index(Request $request): Response
|
||||
|
|
|
@ -15,33 +15,21 @@ class NewsController extends BaseController
|
|||
{
|
||||
use HasUserNotifications;
|
||||
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected LoggerInterface $log;
|
||||
|
||||
protected News $news;
|
||||
|
||||
protected Redirector $redirect;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
/** @var array */
|
||||
protected array $permissions = [
|
||||
'admin_news',
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
Authenticator $auth,
|
||||
LoggerInterface $log,
|
||||
News $news,
|
||||
protected Authenticator $auth,
|
||||
protected LoggerInterface $log,
|
||||
protected News $news,
|
||||
Redirector $redirector,
|
||||
Response $response
|
||||
protected Response $response
|
||||
) {
|
||||
$this->auth = $auth;
|
||||
$this->log = $log;
|
||||
$this->news = $news;
|
||||
$this->redirect = $redirector;
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function edit(Request $request): Response
|
||||
|
|
|
@ -16,16 +16,8 @@ class QuestionsController extends BaseController
|
|||
{
|
||||
use HasUserNotifications;
|
||||
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected LoggerInterface $log;
|
||||
|
||||
protected Question $question;
|
||||
|
||||
protected Redirector $redirect;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
/** @var array */
|
||||
protected array $permissions = [
|
||||
'question.add',
|
||||
|
@ -33,17 +25,13 @@ class QuestionsController extends BaseController
|
|||
];
|
||||
|
||||
public function __construct(
|
||||
Authenticator $auth,
|
||||
LoggerInterface $log,
|
||||
Question $question,
|
||||
protected Authenticator $auth,
|
||||
protected LoggerInterface $log,
|
||||
protected Question $question,
|
||||
Redirector $redirector,
|
||||
Response $response
|
||||
protected Response $response
|
||||
) {
|
||||
$this->auth = $auth;
|
||||
$this->log = $log;
|
||||
$this->question = $question;
|
||||
$this->redirect = $redirector;
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function index(): Response
|
||||
|
|
|
@ -16,18 +16,8 @@ class UserShirtController extends BaseController
|
|||
{
|
||||
use HasUserNotifications;
|
||||
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected Config $config;
|
||||
|
||||
protected LoggerInterface $log;
|
||||
|
||||
protected Redirector $redirect;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
protected User $user;
|
||||
|
||||
/** @var array */
|
||||
protected array $permissions = [
|
||||
'editShirt' => 'user.edit.shirt',
|
||||
|
@ -35,19 +25,14 @@ class UserShirtController extends BaseController
|
|||
];
|
||||
|
||||
public function __construct(
|
||||
Authenticator $auth,
|
||||
Config $config,
|
||||
LoggerInterface $log,
|
||||
protected Authenticator $auth,
|
||||
protected Config $config,
|
||||
protected LoggerInterface $log,
|
||||
Redirector $redirector,
|
||||
Response $response,
|
||||
User $user
|
||||
protected Response $response,
|
||||
protected User $user
|
||||
) {
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
$this->log = $log;
|
||||
$this->redirect = $redirector;
|
||||
$this->response = $response;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function editShirt(Request $request): Response
|
||||
|
|
|
@ -19,41 +19,23 @@ class UserWorkLogController extends BaseController
|
|||
{
|
||||
use HasUserNotifications;
|
||||
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected Config $config;
|
||||
|
||||
protected LoggerInterface $log;
|
||||
|
||||
protected Worklog $worklog;
|
||||
|
||||
protected Redirector $redirect;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
protected User $user;
|
||||
|
||||
/** @var array */
|
||||
protected array $permissions = [
|
||||
'admin_user_worklog',
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
Authenticator $auth,
|
||||
Config $config,
|
||||
LoggerInterface $log,
|
||||
Worklog $worklog,
|
||||
protected Authenticator $auth,
|
||||
protected Config $config,
|
||||
protected LoggerInterface $log,
|
||||
protected Worklog $worklog,
|
||||
Redirector $redirector,
|
||||
Response $response,
|
||||
User $user
|
||||
protected Response $response,
|
||||
protected User $user
|
||||
) {
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
$this->log = $log;
|
||||
$this->worklog = $worklog;
|
||||
$this->redirect = $redirector;
|
||||
$this->response = $response;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function editWorklog(Request $request): Response
|
||||
|
|
|
@ -6,11 +6,8 @@ use Engelsystem\Http\Response;
|
|||
|
||||
class ApiController extends BaseController
|
||||
{
|
||||
protected Response $response;
|
||||
|
||||
public function __construct(Response $response)
|
||||
public function __construct(protected Response $response)
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function index(): Response
|
||||
|
|
|
@ -15,16 +15,6 @@ class AuthController extends BaseController
|
|||
{
|
||||
use HasUserNotifications;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
protected SessionInterface $session;
|
||||
|
||||
protected Redirector $redirect;
|
||||
|
||||
protected Config $config;
|
||||
|
||||
protected Authenticator $auth;
|
||||
|
||||
/** @var array */
|
||||
protected array $permissions = [
|
||||
'login' => 'login',
|
||||
|
@ -32,17 +22,12 @@ class AuthController extends BaseController
|
|||
];
|
||||
|
||||
public function __construct(
|
||||
Response $response,
|
||||
SessionInterface $session,
|
||||
Redirector $redirect,
|
||||
Config $config,
|
||||
Authenticator $auth
|
||||
protected Response $response,
|
||||
protected SessionInterface $session,
|
||||
protected Redirector $redirect,
|
||||
protected Config $config,
|
||||
protected Authenticator $auth
|
||||
) {
|
||||
$this->response = $response;
|
||||
$this->session = $session;
|
||||
$this->redirect = $redirect;
|
||||
$this->config = $config;
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
public function login(): Response
|
||||
|
|
|
@ -8,17 +8,8 @@ use Engelsystem\Http\Response;
|
|||
|
||||
class CreditsController extends BaseController
|
||||
{
|
||||
protected Config $config;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
protected Version $version;
|
||||
|
||||
public function __construct(Response $response, Config $config, Version $version)
|
||||
public function __construct(protected Response $response, protected Config $config, protected Version $version)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->response = $response;
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
public function index(): Response
|
||||
|
|
|
@ -11,14 +11,8 @@ use Engelsystem\Models\User\User;
|
|||
|
||||
class DesignController extends BaseController
|
||||
{
|
||||
protected Response $response;
|
||||
|
||||
protected Config $config;
|
||||
|
||||
public function __construct(Response $response, Config $config)
|
||||
public function __construct(protected Response $response, protected Config $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,25 +10,16 @@ class FaqController extends BaseController
|
|||
{
|
||||
use HasUserNotifications;
|
||||
|
||||
protected Config $config;
|
||||
|
||||
protected Faq $faq;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
/** @var string[] */
|
||||
protected array $permissions = [
|
||||
'faq.view',
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
Config $config,
|
||||
Faq $faq,
|
||||
Response $response
|
||||
protected Config $config,
|
||||
protected Faq $faq,
|
||||
protected Response $response
|
||||
) {
|
||||
$this->config = $config;
|
||||
$this->faq = $faq;
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function index(): Response
|
||||
|
|
|
@ -6,11 +6,8 @@ use Engelsystem\Http\Response;
|
|||
|
||||
class HealthController extends BaseController
|
||||
{
|
||||
protected Response $response;
|
||||
|
||||
public function __construct(Response $response)
|
||||
public function __construct(protected Response $response)
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function index(): Response
|
||||
|
|
|
@ -9,17 +9,8 @@ use Engelsystem\Http\Response;
|
|||
|
||||
class HomeController extends BaseController
|
||||
{
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected Config $config;
|
||||
|
||||
protected Redirector $redirect;
|
||||
|
||||
public function __construct(Authenticator $auth, Config $config, Redirector $redirect)
|
||||
public function __construct(protected Authenticator $auth, protected Config $config, protected Redirector $redirect)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
$this->redirect = $redirect;
|
||||
}
|
||||
|
||||
public function index(): Response
|
||||
|
|
|
@ -16,41 +16,23 @@ use Psr\Http\Message\RequestInterface;
|
|||
|
||||
class MessagesController extends BaseController
|
||||
{
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected Redirector $redirect;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
protected RequestInterface $request;
|
||||
|
||||
protected Database $db;
|
||||
|
||||
protected Message $message;
|
||||
|
||||
protected User $user;
|
||||
|
||||
/** @var string[] */
|
||||
protected array $permissions = [
|
||||
'user_messages',
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
Authenticator $auth,
|
||||
Redirector $redirect,
|
||||
Response $response,
|
||||
protected Authenticator $auth,
|
||||
protected Redirector $redirect,
|
||||
protected Response $response,
|
||||
Request $request,
|
||||
Database $db,
|
||||
Message $message,
|
||||
User $user
|
||||
protected Database $db,
|
||||
protected Message $message,
|
||||
protected User $user
|
||||
) {
|
||||
$this->auth = $auth;
|
||||
$this->redirect = $redirect;
|
||||
$this->response = $response;
|
||||
$this->request = $request;
|
||||
$this->db = $db;
|
||||
$this->message = $message;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function index(): Response
|
||||
|
|
|
@ -13,32 +13,14 @@ use Psr\Log\LogLevel;
|
|||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
protected Config $config;
|
||||
|
||||
protected MetricsEngine $engine;
|
||||
|
||||
protected Request $request;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
protected Stats $stats;
|
||||
|
||||
protected Version $version;
|
||||
|
||||
public function __construct(
|
||||
Response $response,
|
||||
MetricsEngine $engine,
|
||||
Config $config,
|
||||
Request $request,
|
||||
Stats $stats,
|
||||
Version $version
|
||||
protected Response $response,
|
||||
protected MetricsEngine $engine,
|
||||
protected Config $config,
|
||||
protected Request $request,
|
||||
protected Stats $stats,
|
||||
protected Version $version
|
||||
) {
|
||||
$this->config = $config;
|
||||
$this->engine = $engine;
|
||||
$this->request = $request;
|
||||
$this->response = $response;
|
||||
$this->stats = $stats;
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
public function metrics(): Response
|
||||
|
|
|
@ -30,11 +30,8 @@ use Illuminate\Support\Collection;
|
|||
|
||||
class Stats
|
||||
{
|
||||
protected Database $db;
|
||||
|
||||
public function __construct(Database $db)
|
||||
public function __construct(protected Database $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,22 +16,8 @@ class NewsController extends BaseController
|
|||
{
|
||||
use HasUserNotifications;
|
||||
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected NewsComment $comment;
|
||||
|
||||
protected Config $config;
|
||||
|
||||
protected LoggerInterface $log;
|
||||
|
||||
protected News $news;
|
||||
|
||||
protected Redirector $redirect;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
protected Request $request;
|
||||
|
||||
/** @var array */
|
||||
protected array $permissions = [
|
||||
'news',
|
||||
|
@ -41,23 +27,16 @@ class NewsController extends BaseController
|
|||
];
|
||||
|
||||
public function __construct(
|
||||
Authenticator $auth,
|
||||
NewsComment $comment,
|
||||
Config $config,
|
||||
LoggerInterface $log,
|
||||
News $news,
|
||||
protected Authenticator $auth,
|
||||
protected NewsComment $comment,
|
||||
protected Config $config,
|
||||
protected LoggerInterface $log,
|
||||
protected News $news,
|
||||
Redirector $redirector,
|
||||
Response $response,
|
||||
Request $request
|
||||
protected Response $response,
|
||||
protected Request $request
|
||||
) {
|
||||
$this->auth = $auth;
|
||||
$this->comment = $comment;
|
||||
$this->config = $config;
|
||||
$this->log = $log;
|
||||
$this->news = $news;
|
||||
$this->redirect = $redirector;
|
||||
$this->response = $response;
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function index(): Response
|
||||
|
|
|
@ -25,40 +25,16 @@ class OAuthController extends BaseController
|
|||
{
|
||||
use HasUserNotifications;
|
||||
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected AuthController $authController;
|
||||
|
||||
protected Config $config;
|
||||
|
||||
protected LoggerInterface $log;
|
||||
|
||||
protected OAuth $oauth;
|
||||
|
||||
protected Redirector $redirector;
|
||||
|
||||
protected Session $session;
|
||||
|
||||
protected UrlGenerator $url;
|
||||
|
||||
public function __construct(
|
||||
Authenticator $auth,
|
||||
AuthController $authController,
|
||||
Config $config,
|
||||
LoggerInterface $log,
|
||||
OAuth $oauth,
|
||||
Redirector $redirector,
|
||||
Session $session,
|
||||
UrlGenerator $url
|
||||
protected Authenticator $auth,
|
||||
protected AuthController $authController,
|
||||
protected Config $config,
|
||||
protected LoggerInterface $log,
|
||||
protected OAuth $oauth,
|
||||
protected Redirector $redirector,
|
||||
protected Session $session,
|
||||
protected UrlGenerator $url
|
||||
) {
|
||||
$this->auth = $auth;
|
||||
$this->authController = $authController;
|
||||
$this->config = $config;
|
||||
$this->log = $log;
|
||||
$this->redirector = $redirector;
|
||||
$this->oauth = $oauth;
|
||||
$this->session = $session;
|
||||
$this->url = $url;
|
||||
}
|
||||
|
||||
public function index(Request $request): Response
|
||||
|
|
|
@ -15,14 +15,6 @@ class PasswordResetController extends BaseController
|
|||
{
|
||||
use HasUserNotifications;
|
||||
|
||||
protected LoggerInterface $log;
|
||||
|
||||
protected EngelsystemMailer $mail;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
protected SessionInterface $session;
|
||||
|
||||
/** @var array */
|
||||
protected array $permissions = [
|
||||
'reset' => 'login',
|
||||
|
@ -32,15 +24,11 @@ class PasswordResetController extends BaseController
|
|||
];
|
||||
|
||||
public function __construct(
|
||||
Response $response,
|
||||
SessionInterface $session,
|
||||
EngelsystemMailer $mail,
|
||||
LoggerInterface $log
|
||||
protected Response $response,
|
||||
protected SessionInterface $session,
|
||||
protected EngelsystemMailer $mail,
|
||||
protected LoggerInterface $log
|
||||
) {
|
||||
$this->log = $log;
|
||||
$this->mail = $mail;
|
||||
$this->response = $response;
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
public function reset(): Response
|
||||
|
|
|
@ -14,33 +14,18 @@ class QuestionsController extends BaseController
|
|||
{
|
||||
use HasUserNotifications;
|
||||
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected LoggerInterface $log;
|
||||
|
||||
protected Question $question;
|
||||
|
||||
protected Redirector $redirect;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
/** @var string[] */
|
||||
protected array $permissions = [
|
||||
'question.add',
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
Authenticator $auth,
|
||||
LoggerInterface $log,
|
||||
Question $question,
|
||||
Redirector $redirect,
|
||||
Response $response
|
||||
protected Authenticator $auth,
|
||||
protected LoggerInterface $log,
|
||||
protected Question $question,
|
||||
protected Redirector $redirect,
|
||||
protected Response $response
|
||||
) {
|
||||
$this->auth = $auth;
|
||||
$this->log = $log;
|
||||
$this->question = $question;
|
||||
$this->redirect = $redirect;
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function index(): Response
|
||||
|
|
|
@ -15,33 +15,21 @@ class SettingsController extends BaseController
|
|||
use HasUserNotifications;
|
||||
use ChecksArrivalsAndDepartures;
|
||||
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected Config $config;
|
||||
|
||||
protected LoggerInterface $log;
|
||||
|
||||
protected Redirector $redirect;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
/** @var string[] */
|
||||
protected array $permissions = [
|
||||
'user_settings',
|
||||
];
|
||||
|
||||
public function __construct(
|
||||
Authenticator $auth,
|
||||
Config $config,
|
||||
LoggerInterface $log,
|
||||
protected Authenticator $auth,
|
||||
protected Config $config,
|
||||
protected LoggerInterface $log,
|
||||
Redirector $redirector,
|
||||
Response $response
|
||||
protected Response $response
|
||||
) {
|
||||
$this->auth = $auth;
|
||||
$this->config = $config;
|
||||
$this->log = $log;
|
||||
$this->redirect = $redirector;
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
public function profile(): Response
|
||||
|
|
|
@ -7,11 +7,8 @@ use PDO;
|
|||
|
||||
class Database
|
||||
{
|
||||
protected DatabaseConnection $connection;
|
||||
|
||||
public function __construct(DatabaseConnection $connection)
|
||||
public function __construct(protected DatabaseConnection $connection)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,10 +19,6 @@ class Migrate
|
|||
/** @var string */
|
||||
public const DOWN = 'down';
|
||||
|
||||
protected Application $app;
|
||||
|
||||
protected SchemaBuilder $schema;
|
||||
|
||||
/** @var callable */
|
||||
protected $output;
|
||||
|
||||
|
@ -32,10 +28,8 @@ class Migrate
|
|||
* Migrate constructor
|
||||
*
|
||||
*/
|
||||
public function __construct(SchemaBuilder $schema, Application $app)
|
||||
public function __construct(protected SchemaBuilder $schema, protected Application $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->schema = $schema;
|
||||
$this->output = function (): void {
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,20 +12,11 @@ use Symfony\Component\Mailer\Exception\TransportException;
|
|||
|
||||
class News
|
||||
{
|
||||
protected LoggerInterface $log;
|
||||
|
||||
protected EngelsystemMailer $mailer;
|
||||
|
||||
protected UserSettings $settings;
|
||||
|
||||
public function __construct(
|
||||
LoggerInterface $log,
|
||||
EngelsystemMailer $mailer,
|
||||
UserSettings $settings
|
||||
protected LoggerInterface $log,
|
||||
protected EngelsystemMailer $mailer,
|
||||
protected UserSettings $settings
|
||||
) {
|
||||
$this->log = $log;
|
||||
$this->mailer = $mailer;
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
public function created(NewsModel $news): void
|
||||
|
|
|
@ -12,18 +12,12 @@ use Psr\Log\LoggerInterface;
|
|||
|
||||
class OAuth2
|
||||
{
|
||||
protected Authenticator $auth;
|
||||
|
||||
/** @var array */
|
||||
protected array $config;
|
||||
|
||||
protected LoggerInterface $log;
|
||||
|
||||
public function __construct(Config $config, LoggerInterface $log, Authenticator $auth)
|
||||
public function __construct(Config $config, protected LoggerInterface $log, protected Authenticator $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->config = $config->get('oauth');
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,8 +10,6 @@ use Throwable;
|
|||
|
||||
class Handler
|
||||
{
|
||||
protected string $environment;
|
||||
|
||||
/** @var HandlerInterface[] */
|
||||
protected array $handler = [];
|
||||
|
||||
|
@ -28,9 +26,8 @@ class Handler
|
|||
*
|
||||
* @param string $environment prod|dev
|
||||
*/
|
||||
public function __construct(string $environment = self::ENV_PRODUCTION)
|
||||
public function __construct(protected string $environment = self::ENV_PRODUCTION)
|
||||
{
|
||||
$this->environment = $environment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,16 +4,13 @@ namespace Engelsystem\Helpers;
|
|||
|
||||
class Assets
|
||||
{
|
||||
protected string $assetsPath;
|
||||
|
||||
protected string $manifestFile = 'manifest.json';
|
||||
|
||||
/**
|
||||
* @param string $assetsPath Directory containing assets
|
||||
*/
|
||||
public function __construct(string $assetsPath)
|
||||
public function __construct(protected string $assetsPath)
|
||||
{
|
||||
$this->assetsPath = $assetsPath;
|
||||
}
|
||||
|
||||
public function getAssetPath(string $asset): string
|
||||
|
|
|
@ -13,12 +13,6 @@ class Authenticator
|
|||
{
|
||||
protected ?User $user = null;
|
||||
|
||||
protected ServerRequestInterface $request;
|
||||
|
||||
protected Session $session;
|
||||
|
||||
protected UserRepository $userRepository;
|
||||
|
||||
/** @var string[] */
|
||||
protected array $permissions = [];
|
||||
|
||||
|
@ -28,11 +22,11 @@ class Authenticator
|
|||
|
||||
protected int $guestRole = 10;
|
||||
|
||||
public function __construct(ServerRequestInterface $request, Session $session, UserRepository $userRepository)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->session = $session;
|
||||
$this->userRepository = $userRepository;
|
||||
public function __construct(
|
||||
protected ServerRequestInterface $request,
|
||||
protected Session $session,
|
||||
protected UserRepository $userRepository
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,42 +8,19 @@ class Conference
|
|||
{
|
||||
use CalculatesTime;
|
||||
|
||||
/** @var string required */
|
||||
protected string $title;
|
||||
|
||||
/** @var string required */
|
||||
protected string $acronym;
|
||||
|
||||
protected ?string $start = null;
|
||||
|
||||
protected ?string $end = null;
|
||||
|
||||
protected ?int $days = null;
|
||||
|
||||
protected ?string $timeslotDuration = null;
|
||||
|
||||
protected ?string $baseUrl = null;
|
||||
|
||||
/**
|
||||
* Event constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(
|
||||
string $title,
|
||||
string $acronym,
|
||||
?string $start = null,
|
||||
?string $end = null,
|
||||
?int $days = null,
|
||||
?string $timeslotDuration = null,
|
||||
?string $baseUrl = null
|
||||
protected string $title,
|
||||
protected string $acronym,
|
||||
protected ?string $start = null,
|
||||
protected ?string $end = null,
|
||||
protected ?int $days = null,
|
||||
protected ?string $timeslotDuration = null,
|
||||
protected ?string $baseUrl = null
|
||||
) {
|
||||
$this->title = $title;
|
||||
$this->acronym = $acronym;
|
||||
$this->start = $start;
|
||||
$this->end = $end;
|
||||
$this->days = $days;
|
||||
$this->timeslotDuration = $timeslotDuration;
|
||||
$this->baseUrl = $baseUrl;
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
|
|
|
@ -10,121 +10,46 @@ class Event
|
|||
{
|
||||
use CalculatesTime;
|
||||
|
||||
/** @var string required globally unique */
|
||||
protected string $guid;
|
||||
|
||||
/** @var int required globally unique */
|
||||
protected int $id;
|
||||
|
||||
/** @var Room required, string in XML */
|
||||
protected Room $room;
|
||||
|
||||
/** @var string required */
|
||||
protected string $title;
|
||||
|
||||
/** @var string required */
|
||||
protected string $subtitle;
|
||||
|
||||
/** @var string required */
|
||||
protected string $type;
|
||||
|
||||
/** @var Carbon required */
|
||||
protected Carbon $date;
|
||||
|
||||
/** @var string required time (hh:mm:ss || hh:mm) */
|
||||
protected string $start;
|
||||
|
||||
/** @var string required (h?h:mm:ss || h?h:mm) */
|
||||
protected string $duration;
|
||||
|
||||
/** @var string required */
|
||||
protected string $abstract;
|
||||
|
||||
/** @var string required globally unique */
|
||||
protected string $slug;
|
||||
|
||||
/** @var string required */
|
||||
protected string $track;
|
||||
|
||||
protected ?string $logo = null;
|
||||
|
||||
/** @var string[] id => name */
|
||||
protected array $persons;
|
||||
|
||||
/** @var string|null two letter code */
|
||||
protected ?string $language = null;
|
||||
|
||||
protected ?string $description = null;
|
||||
|
||||
/** @var string|null license (and opt out in XML, null if not recorded, empty if no license defined) */
|
||||
protected ?string $recording = null;
|
||||
|
||||
/** @var array href => title */
|
||||
protected array $links;
|
||||
|
||||
/** @var array href => name */
|
||||
protected array $attachments;
|
||||
|
||||
protected ?string $url = null;
|
||||
|
||||
protected ?string $videoDownloadUrl = null;
|
||||
|
||||
/** @var Carbon Calculated */
|
||||
protected Carbon $endDate;
|
||||
|
||||
/**
|
||||
* Event constructor.
|
||||
*
|
||||
* @param string[] $persons
|
||||
* @param string|null $recording license
|
||||
* @param array $links
|
||||
* @param array $attachments
|
||||
* @param string $guid globally unique
|
||||
* @param int $id globally unique
|
||||
* @param string $start time (hh:mm:ss || hh:mm)
|
||||
* @param string $duration (h?h:mm:ss || h?h:mm)
|
||||
* @param string $slug globally unique
|
||||
* @param string[] $persons id => name
|
||||
* @param string|null $language two letter code
|
||||
* @param string|null $recording license (and opt out in XML, null if not recorded, empty if no license defined)/
|
||||
* @param array $links href => title
|
||||
* @param array $attachments href => title
|
||||
*/
|
||||
public function __construct(
|
||||
string $guid,
|
||||
int $id,
|
||||
Room $room,
|
||||
string $title,
|
||||
string $subtitle,
|
||||
string $type,
|
||||
Carbon $date,
|
||||
string $start,
|
||||
string $duration,
|
||||
string $abstract,
|
||||
string $slug,
|
||||
string $track,
|
||||
?string $logo = null,
|
||||
array $persons = [],
|
||||
?string $language = null,
|
||||
?string $description = null,
|
||||
string $recording = '',
|
||||
array $links = [],
|
||||
array $attachments = [],
|
||||
?string $url = null,
|
||||
?string $videoDownloadUrl = null
|
||||
protected string $guid,
|
||||
protected int $id,
|
||||
protected Room $room,
|
||||
protected string $title,
|
||||
protected string $subtitle,
|
||||
protected string $type,
|
||||
protected Carbon $date,
|
||||
protected string $start,
|
||||
protected string $duration,
|
||||
protected string $abstract,
|
||||
protected string $slug,
|
||||
protected string $track,
|
||||
protected ?string $logo = null,
|
||||
protected array $persons = [],
|
||||
protected ?string $language = null,
|
||||
protected ?string $description = null,
|
||||
protected string $recording = '',
|
||||
protected array $links = [],
|
||||
protected array $attachments = [],
|
||||
protected ?string $url = null,
|
||||
protected ?string $videoDownloadUrl = null
|
||||
) {
|
||||
$this->guid = $guid;
|
||||
$this->id = $id;
|
||||
$this->room = $room;
|
||||
$this->title = $title;
|
||||
$this->subtitle = $subtitle;
|
||||
$this->type = $type;
|
||||
$this->date = $date;
|
||||
$this->start = $start;
|
||||
$this->duration = $duration;
|
||||
$this->abstract = $abstract;
|
||||
$this->slug = $slug;
|
||||
$this->track = $track;
|
||||
$this->logo = $logo;
|
||||
$this->persons = $persons;
|
||||
$this->language = $language;
|
||||
$this->description = $description;
|
||||
$this->recording = $recording;
|
||||
$this->links = $links;
|
||||
$this->attachments = $attachments;
|
||||
$this->url = $url;
|
||||
$this->videoDownloadUrl = $videoDownloadUrl;
|
||||
|
||||
$this->endDate = $this->date
|
||||
->copy()
|
||||
->addSeconds($this->getDurationSeconds());
|
||||
|
|
|
@ -8,10 +8,6 @@ use Carbon\Carbon;
|
|||
|
||||
class Schedule
|
||||
{
|
||||
protected string $version;
|
||||
|
||||
protected Conference $conference;
|
||||
|
||||
/** @var Day[] */
|
||||
protected array $day;
|
||||
|
||||
|
@ -19,12 +15,10 @@ class Schedule
|
|||
* @param Day[] $days
|
||||
*/
|
||||
public function __construct(
|
||||
string $version,
|
||||
Conference $conference,
|
||||
protected string $version,
|
||||
protected Conference $conference,
|
||||
array $days
|
||||
) {
|
||||
$this->version = $version;
|
||||
$this->conference = $conference;
|
||||
$this->day = $days;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,13 +4,8 @@ namespace Engelsystem\Helpers\Translation;
|
|||
|
||||
class Translator
|
||||
{
|
||||
/** @var string[] */
|
||||
protected array $locales;
|
||||
|
||||
protected string $locale;
|
||||
|
||||
protected string $fallbackLocale;
|
||||
|
||||
/** @var callable */
|
||||
protected $getTranslatorCallback;
|
||||
|
||||
|
@ -24,17 +19,15 @@ class Translator
|
|||
*/
|
||||
public function __construct(
|
||||
string $locale,
|
||||
string $fallbackLocale,
|
||||
protected string $fallbackLocale,
|
||||
callable $getTranslatorCallback,
|
||||
array $locales = [],
|
||||
protected array $locales = [],
|
||||
callable $localeChangeCallback = null
|
||||
) {
|
||||
$this->localeChangeCallback = $localeChangeCallback;
|
||||
$this->getTranslatorCallback = $getTranslatorCallback;
|
||||
|
||||
$this->setLocale($locale);
|
||||
$this->fallbackLocale = $fallbackLocale;
|
||||
$this->locales = $locales;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,16 +6,10 @@ use Engelsystem\Config\Config;
|
|||
|
||||
class Version
|
||||
{
|
||||
protected Config $config;
|
||||
|
||||
protected string $storage;
|
||||
|
||||
protected string $versionFile = 'VERSION';
|
||||
|
||||
public function __construct(string $storage, Config $config)
|
||||
public function __construct(protected string $storage, protected Config $config)
|
||||
{
|
||||
$this->storage = $storage;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function getVersion(): string
|
||||
|
|
|
@ -7,24 +7,17 @@ use Throwable;
|
|||
|
||||
class HttpException extends RuntimeException
|
||||
{
|
||||
protected int $statusCode;
|
||||
|
||||
/** @var array */
|
||||
protected array $headers = [];
|
||||
|
||||
/**
|
||||
* @param array $headers
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
public function __construct(
|
||||
int $statusCode,
|
||||
protected int $statusCode,
|
||||
string $message = '',
|
||||
array $headers = [],
|
||||
protected array $headers = [],
|
||||
int $code = 0,
|
||||
Throwable $previous = null
|
||||
) {
|
||||
$this->headers = $headers;
|
||||
$this->statusCode = $statusCode;
|
||||
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
|
|
@ -8,18 +8,15 @@ use Throwable;
|
|||
|
||||
class ValidationException extends RuntimeException
|
||||
{
|
||||
protected Validator $validator;
|
||||
|
||||
/**
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
public function __construct(
|
||||
Validator $validator,
|
||||
protected Validator $validator,
|
||||
string $message = '',
|
||||
int $code = 0,
|
||||
Throwable $previous = null
|
||||
) {
|
||||
$this->validator = $validator;
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,17 +4,11 @@ namespace Engelsystem\Http;
|
|||
|
||||
class Redirector
|
||||
{
|
||||
protected Request $request;
|
||||
|
||||
protected Response $response;
|
||||
|
||||
protected UrlGeneratorInterface $url;
|
||||
|
||||
public function __construct(Request $request, Response $response, UrlGeneratorInterface $url)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->response = $response;
|
||||
$this->url = $url;
|
||||
public function __construct(
|
||||
protected Request $request,
|
||||
protected Response $response,
|
||||
protected UrlGeneratorInterface $url
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,11 +7,8 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
|
|||
|
||||
class DatabaseHandler extends AbstractHandler
|
||||
{
|
||||
protected Database $database;
|
||||
|
||||
public function __construct(Database $database)
|
||||
public function __construct(protected Database $database)
|
||||
{
|
||||
$this->database = $database;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,11 +23,8 @@ class Logger extends AbstractLogger
|
|||
LogLevel::WARNING,
|
||||
];
|
||||
|
||||
protected LogEntry $log;
|
||||
|
||||
public function __construct(LogEntry $log)
|
||||
public function __construct(protected LogEntry $log)
|
||||
{
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,15 +7,12 @@ use Symfony\Component\Mime\Email;
|
|||
|
||||
class Mailer
|
||||
{
|
||||
protected MailerInterface $mailer;
|
||||
|
||||
protected string $fromAddress = '';
|
||||
|
||||
protected ?string $fromName = null;
|
||||
|
||||
public function __construct(MailerInterface $mailer)
|
||||
public function __construct(protected MailerInterface $mailer)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,11 +8,8 @@ use Symfony\Component\Mailer\Transport\AbstractTransport;
|
|||
|
||||
class LogTransport extends AbstractTransport
|
||||
{
|
||||
protected LoggerInterface $logger;
|
||||
|
||||
public function __construct(LoggerInterface $logger)
|
||||
public function __construct(protected LoggerInterface $logger)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
|
|
@ -10,11 +10,8 @@ use Psr\Http\Server\RequestHandlerInterface;
|
|||
|
||||
class AddHeaders implements MiddlewareInterface
|
||||
{
|
||||
protected Config $config;
|
||||
|
||||
public function __construct(Config $config)
|
||||
public function __construct(protected Config $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,17 +14,13 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface
|
|||
{
|
||||
use ResolvesMiddlewareTrait;
|
||||
|
||||
/** @var MiddlewareInterface[]|string[] */
|
||||
protected array $stack;
|
||||
|
||||
protected RequestHandlerInterface $next;
|
||||
|
||||
/**
|
||||
* @param MiddlewareInterface[]|string[] $stack
|
||||
*/
|
||||
public function __construct(array $stack = [], protected ?Application $container = null)
|
||||
public function __construct(protected array $stack = [], protected ?Application $container = null)
|
||||
{
|
||||
$this->stack = $stack;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,8 +16,6 @@ use Twig\Loader\LoaderInterface as TwigLoader;
|
|||
|
||||
class ErrorHandler implements MiddlewareInterface
|
||||
{
|
||||
protected TwigLoader $loader;
|
||||
|
||||
protected string $viewPrefix = 'errors/';
|
||||
|
||||
/**
|
||||
|
@ -36,9 +34,8 @@ class ErrorHandler implements MiddlewareInterface
|
|||
'_token',
|
||||
];
|
||||
|
||||
public function __construct(TwigLoader $loader)
|
||||
public function __construct(protected TwigLoader $loader)
|
||||
{
|
||||
$this->loader = $loader;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,11 +12,8 @@ use Throwable;
|
|||
|
||||
class ExceptionHandler implements MiddlewareInterface
|
||||
{
|
||||
protected ContainerInterface $container;
|
||||
|
||||
public function __construct(ContainerInterface $container)
|
||||
public function __construct(protected ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,14 +29,8 @@ class LegacyMiddleware implements MiddlewareInterface
|
|||
'admin_shifts_history',
|
||||
];
|
||||
|
||||
protected ContainerInterface $container;
|
||||
|
||||
protected Authenticator $auth;
|
||||
|
||||
public function __construct(ContainerInterface $container, Authenticator $auth)
|
||||
public function __construct(protected ContainerInterface $container, protected Authenticator $auth)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,11 +16,8 @@ class RequestHandler implements MiddlewareInterface
|
|||
{
|
||||
use ResolvesMiddlewareTrait;
|
||||
|
||||
protected Application $container;
|
||||
|
||||
public function __construct(Application $container)
|
||||
public function __construct(protected Application $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,10 +12,6 @@ use Psr\Http\Server\RequestHandlerInterface;
|
|||
|
||||
class RouteDispatcher implements MiddlewareInterface
|
||||
{
|
||||
protected FastRouteDispatcher $dispatcher;
|
||||
|
||||
protected ResponseInterface $response;
|
||||
|
||||
protected ?MiddlewareInterface $notFound = null;
|
||||
|
||||
/**
|
||||
|
@ -23,12 +19,10 @@ class RouteDispatcher implements MiddlewareInterface
|
|||
* @param MiddlewareInterface|null $notFound Handles any requests if the route can't be found
|
||||
*/
|
||||
public function __construct(
|
||||
FastRouteDispatcher $dispatcher,
|
||||
ResponseInterface $response,
|
||||
protected FastRouteDispatcher $dispatcher,
|
||||
protected ResponseInterface $response,
|
||||
MiddlewareInterface $notFound = null
|
||||
) {
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->response = $response;
|
||||
$this->notFound = $notFound;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,18 +11,11 @@ use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface;
|
|||
|
||||
class SessionHandler implements MiddlewareInterface
|
||||
{
|
||||
protected SessionStorageInterface $session;
|
||||
|
||||
/** @var string[] */
|
||||
protected array $paths = [];
|
||||
|
||||
/**
|
||||
* @param array $paths
|
||||
*/
|
||||
public function __construct(SessionStorageInterface $session, array $paths = [])
|
||||
public function __construct(protected SessionStorageInterface $session, protected array $paths = [])
|
||||
{
|
||||
$this->paths = $paths;
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
|
|
|
@ -12,17 +12,11 @@ use Symfony\Component\HttpFoundation\Session\Session;
|
|||
|
||||
class SetLocale implements MiddlewareInterface
|
||||
{
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected Translator $translator;
|
||||
|
||||
protected Session $session;
|
||||
|
||||
public function __construct(Translator $translator, Session $session, Authenticator $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->translator = $translator;
|
||||
$this->session = $session;
|
||||
public function __construct(
|
||||
protected Translator $translator,
|
||||
protected Session $session,
|
||||
protected Authenticator $auth
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,11 +11,8 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
|||
|
||||
class VerifyCsrfToken implements MiddlewareInterface
|
||||
{
|
||||
protected SessionInterface $session;
|
||||
|
||||
public function __construct(SessionInterface $session)
|
||||
public function __construct(protected SessionInterface $session)
|
||||
{
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,14 +10,8 @@ use Twig\TwigFunction;
|
|||
|
||||
class Assets extends TwigExtension
|
||||
{
|
||||
protected AssetsProvider $assets;
|
||||
|
||||
protected UrlGeneratorInterface $urlGenerator;
|
||||
|
||||
public function __construct(AssetsProvider $assets, UrlGeneratorInterface $urlGenerator)
|
||||
public function __construct(protected AssetsProvider $assets, protected UrlGeneratorInterface $urlGenerator)
|
||||
{
|
||||
$this->assets = $assets;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,11 +8,8 @@ use Twig\TwigFunction;
|
|||
|
||||
class Authentication extends TwigExtension
|
||||
{
|
||||
protected Authenticator $auth;
|
||||
|
||||
public function __construct(Authenticator $auth)
|
||||
public function __construct(protected Authenticator $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,11 +8,8 @@ use Twig\TwigFunction;
|
|||
|
||||
class Config extends TwigExtension
|
||||
{
|
||||
protected EngelsystemConfig $config;
|
||||
|
||||
public function __construct(EngelsystemConfig $config)
|
||||
public function __construct(protected EngelsystemConfig $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,11 +8,8 @@ use Twig\TwigFunction;
|
|||
|
||||
class Csrf extends TwigExtension
|
||||
{
|
||||
protected SessionInterface $session;
|
||||
|
||||
public function __construct(SessionInterface $session)
|
||||
public function __construct(protected SessionInterface $session)
|
||||
{
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,13 +9,10 @@ use Twig\TwigFunction;
|
|||
|
||||
class Develop extends TwigExtension
|
||||
{
|
||||
protected Config $config;
|
||||
|
||||
protected ?VarDumper $dumper = null;
|
||||
|
||||
public function __construct(Config $config)
|
||||
public function __construct(protected Config $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,14 +11,8 @@ use function array_key_exists;
|
|||
|
||||
class Globals extends TwigExtension implements GlobalsInterface
|
||||
{
|
||||
protected Authenticator $auth;
|
||||
|
||||
protected Request $request;
|
||||
|
||||
public function __construct(Authenticator $auth, Request $request)
|
||||
public function __construct(protected Authenticator $auth, protected Request $request)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,11 +8,8 @@ use Twig\TwigFunction;
|
|||
|
||||
class Legacy extends TwigExtension
|
||||
{
|
||||
protected Request $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
public function __construct(protected Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,11 +8,8 @@ use Twig\TwigFilter;
|
|||
|
||||
class Markdown extends TwigExtension
|
||||
{
|
||||
protected Parsedown $renderer;
|
||||
|
||||
public function __construct(Parsedown $renderer)
|
||||
public function __construct(protected Parsedown $renderer)
|
||||
{
|
||||
$this->renderer = $renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,11 +8,8 @@ use Twig\TwigFunction;
|
|||
|
||||
class Session extends TwigExtension
|
||||
{
|
||||
protected SymfonySession $session;
|
||||
|
||||
public function __construct(SymfonySession $session)
|
||||
public function __construct(protected SymfonySession $session)
|
||||
{
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,11 +9,8 @@ use Twig\TwigFunction;
|
|||
|
||||
class Translation extends TwigExtension
|
||||
{
|
||||
protected Translator $translator;
|
||||
|
||||
public function __construct(Translator $translator)
|
||||
public function __construct(protected Translator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,11 +8,8 @@ use Twig\TwigFunction;
|
|||
|
||||
class Url extends TwigExtension
|
||||
{
|
||||
protected UrlGeneratorInterface $urlGenerator;
|
||||
|
||||
public function __construct(UrlGeneratorInterface $urlGenerator)
|
||||
public function __construct(protected UrlGeneratorInterface $urlGenerator)
|
||||
{
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,11 +9,8 @@ use Twig\Error\SyntaxError as SyntaxError;
|
|||
|
||||
class TwigEngine extends Engine
|
||||
{
|
||||
protected Twig $twig;
|
||||
|
||||
public function __construct(Twig $twig)
|
||||
public function __construct(protected Twig $twig)
|
||||
{
|
||||
$this->twig = $twig;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,11 +9,8 @@ use Psr\Http\Server\RequestHandlerInterface;
|
|||
|
||||
class ReturnResponseMiddleware implements MiddlewareInterface
|
||||
{
|
||||
protected ResponseInterface $response;
|
||||
|
||||
public function __construct(ResponseInterface $response)
|
||||
public function __construct(protected ResponseInterface $response)
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,11 +9,8 @@ use Psr\Http\Server\RequestHandlerInterface;
|
|||
|
||||
class ReturnResponseMiddlewareHandler implements RequestHandlerInterface
|
||||
{
|
||||
protected ResponseInterface $response;
|
||||
|
||||
public function __construct(ResponseInterface $response)
|
||||
public function __construct(protected ResponseInterface $response)
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue