Set native parameter types
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
This commit is contained in:
parent
f835a7538c
commit
2b88322c0c
13
.phpcs.xml
13
.phpcs.xml
|
@ -19,8 +19,13 @@
|
||||||
<properties>
|
<properties>
|
||||||
<property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true" />
|
<property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true" />
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="Generic.Files.LineLength.TooLong">
|
<rule ref="Generic.Files.LineLength.TooLong">
|
||||||
<exclude-pattern>/includes</exclude-pattern>
|
<exclude-pattern>/includes</exclude-pattern>
|
||||||
</rule>
|
</rule>
|
||||||
|
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
|
||||||
|
<exclude-pattern>/includes</exclude-pattern>
|
||||||
|
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
|
||||||
|
</rule>
|
||||||
|
<rule ref="SlevomatCodingStandard.Commenting.EmptyComment" />
|
||||||
</ruleset>
|
</ruleset>
|
||||||
|
|
|
@ -53,10 +53,9 @@ class AddAngelSupporterPermissions extends Migration
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $type
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getQuery($type)
|
protected function getQuery(string $type)
|
||||||
{
|
{
|
||||||
return sprintf('
|
return sprintf('
|
||||||
%s FROM GroupPrivileges
|
%s FROM GroupPrivileges
|
||||||
|
|
|
@ -113,8 +113,6 @@ class CreateEventConfigTable extends Migration
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $config
|
|
||||||
* @param string $name
|
|
||||||
* @return mixed|null
|
* @return mixed|null
|
||||||
*/
|
*/
|
||||||
protected function getConfigValue(Collection $config, string $name)
|
protected function getConfigValue(Collection $config, string $name)
|
||||||
|
|
|
@ -29,9 +29,6 @@ class ChangeUsersContactDectFieldSize extends Migration
|
||||||
$this->changeDectTo(5);
|
$this->changeDectTo(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $length
|
|
||||||
*/
|
|
||||||
protected function changeDectTo(int $length)
|
protected function changeDectTo(int $length)
|
||||||
{
|
{
|
||||||
foreach ($this->tables as $table => $column) {
|
foreach ($this->tables as $table => $column) {
|
||||||
|
|
|
@ -17,11 +17,6 @@ class SetAdminPassword extends Migration
|
||||||
/** @var Config */
|
/** @var Config */
|
||||||
protected Config $config;
|
protected Config $config;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param SchemaBuilder $schemaBuilder
|
|
||||||
* @param Authenticator $auth
|
|
||||||
* @param Config $config
|
|
||||||
*/
|
|
||||||
public function __construct(SchemaBuilder $schemaBuilder, Authenticator $auth, Config $config)
|
public function __construct(SchemaBuilder $schemaBuilder, Authenticator $auth, Config $config)
|
||||||
{
|
{
|
||||||
parent::__construct($schemaBuilder);
|
parent::__construct($schemaBuilder);
|
||||||
|
|
|
@ -7,13 +7,6 @@ use stdClass;
|
||||||
|
|
||||||
trait ChangesReferences
|
trait ChangesReferences
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param string $fromTable
|
|
||||||
* @param string $fromColumn
|
|
||||||
* @param string $targetTable
|
|
||||||
* @param string $targetColumn
|
|
||||||
* @param string $type
|
|
||||||
*/
|
|
||||||
protected function changeReferences(
|
protected function changeReferences(
|
||||||
string $fromTable,
|
string $fromTable,
|
||||||
string $fromColumn,
|
string $fromColumn,
|
||||||
|
@ -44,8 +37,6 @@ trait ChangesReferences
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $table
|
|
||||||
* @param string $column
|
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -9,8 +9,6 @@ use Illuminate\Support\Str;
|
||||||
trait Reference
|
trait Reference
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param Blueprint $table
|
|
||||||
* @param bool $setPrimary
|
|
||||||
* @return ColumnDefinition
|
* @return ColumnDefinition
|
||||||
*/
|
*/
|
||||||
protected function referencesUser(Blueprint $table, bool $setPrimary = false): ColumnDefinition
|
protected function referencesUser(Blueprint $table, bool $setPrimary = false): ColumnDefinition
|
||||||
|
@ -19,12 +17,6 @@ trait Reference
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Blueprint $table
|
|
||||||
* @param string $targetTable
|
|
||||||
* @param string|null $fromColumn
|
|
||||||
* @param string|null $targetColumn
|
|
||||||
* @param bool $setPrimary
|
|
||||||
* @param string $type
|
|
||||||
* @return ColumnDefinition
|
* @return ColumnDefinition
|
||||||
*/
|
*/
|
||||||
protected function references(
|
protected function references(
|
||||||
|
@ -47,12 +39,6 @@ trait Reference
|
||||||
return $col;
|
return $col;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Blueprint $table
|
|
||||||
* @param string $fromColumn
|
|
||||||
* @param string $targetTable
|
|
||||||
* @param string|null $targetColumn
|
|
||||||
*/
|
|
||||||
protected function addReference(
|
protected function addReference(
|
||||||
Blueprint $table,
|
Blueprint $table,
|
||||||
string $fromColumn,
|
string $fromColumn,
|
||||||
|
|
|
@ -31,9 +31,8 @@ class Application extends Container
|
||||||
/**
|
/**
|
||||||
* Application constructor.
|
* Application constructor.
|
||||||
*
|
*
|
||||||
* @param string $appPath
|
|
||||||
*/
|
*/
|
||||||
public function __construct($appPath = null)
|
public function __construct(string $appPath = null)
|
||||||
{
|
{
|
||||||
if (!is_null($appPath)) {
|
if (!is_null($appPath)) {
|
||||||
$this->setAppPath($appPath);
|
$this->setAppPath($appPath);
|
||||||
|
@ -56,10 +55,9 @@ class Application extends Container
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|ServiceProvider $provider
|
|
||||||
* @return ServiceProvider
|
* @return ServiceProvider
|
||||||
*/
|
*/
|
||||||
public function register($provider)
|
public function register(string|ServiceProvider $provider)
|
||||||
{
|
{
|
||||||
if (is_string($provider)) {
|
if (is_string($provider)) {
|
||||||
$provider = $this->make($provider);
|
$provider = $this->make($provider);
|
||||||
|
@ -124,10 +122,9 @@ class Application extends Container
|
||||||
/**
|
/**
|
||||||
* Set app base path
|
* Set app base path
|
||||||
*
|
*
|
||||||
* @param string $appPath
|
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setAppPath($appPath)
|
public function setAppPath(string $appPath)
|
||||||
{
|
{
|
||||||
$appPath = realpath($appPath);
|
$appPath = realpath($appPath);
|
||||||
$appPath = rtrim($appPath, DIRECTORY_SEPARATOR);
|
$appPath = rtrim($appPath, DIRECTORY_SEPARATOR);
|
||||||
|
|
|
@ -14,11 +14,9 @@ class Config extends Fluent
|
||||||
protected $attributes = [];
|
protected $attributes = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|null $key
|
* @param string|array $key
|
||||||
* @param mixed $default
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function get($key, $default = null)
|
public function get(mixed $key, mixed $default = null)
|
||||||
{
|
{
|
||||||
if (is_null($key)) {
|
if (is_null($key)) {
|
||||||
return $this->attributes;
|
return $this->attributes;
|
||||||
|
@ -33,9 +31,8 @@ class Config extends Fluent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|array $key
|
* @param string|array $key
|
||||||
* @param mixed $value
|
|
||||||
*/
|
*/
|
||||||
public function set($key, $value = null)
|
public function set(mixed $key, mixed $value = null)
|
||||||
{
|
{
|
||||||
if (is_array($key)) {
|
if (is_array($key)) {
|
||||||
foreach ($key as $configKey => $configValue) {
|
foreach ($key as $configKey => $configValue) {
|
||||||
|
@ -52,7 +49,7 @@ class Config extends Fluent
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function has($key)
|
public function has(mixed $key)
|
||||||
{
|
{
|
||||||
return $this->offsetExists($key);
|
return $this->offsetExists($key);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +57,7 @@ class Config extends Fluent
|
||||||
/**
|
/**
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*/
|
*/
|
||||||
public function remove($key)
|
public function remove(mixed $key)
|
||||||
{
|
{
|
||||||
$this->offsetUnset($key);
|
$this->offsetUnset($key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,6 @@ class ConfigServiceProvider extends ServiceProvider
|
||||||
/** @var EventConfig */
|
/** @var EventConfig */
|
||||||
protected $eventConfig;
|
protected $eventConfig;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Application $app
|
|
||||||
* @param EventConfig $eventConfig
|
|
||||||
*/
|
|
||||||
public function __construct(Application $app, EventConfig $eventConfig = null)
|
public function __construct(Application $app, EventConfig $eventConfig = null)
|
||||||
{
|
{
|
||||||
parent::__construct($app);
|
parent::__construct($app);
|
||||||
|
@ -84,10 +80,9 @@ class ConfigServiceProvider extends ServiceProvider
|
||||||
/**
|
/**
|
||||||
* Get the config path
|
* Get the config path
|
||||||
*
|
*
|
||||||
* @param string $path
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getConfigPath($path = ''): string
|
protected function getConfigPath(string $path = ''): string
|
||||||
{
|
{
|
||||||
return config_path($path);
|
return config_path($path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ abstract class ServiceProvider
|
||||||
/**
|
/**
|
||||||
* ServiceProvider constructor.
|
* ServiceProvider constructor.
|
||||||
*
|
*
|
||||||
* @param Application $app
|
|
||||||
*/
|
*/
|
||||||
public function __construct(Application $app)
|
public function __construct(Application $app)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,12 +32,6 @@ class FaqController extends BaseController
|
||||||
'faq.edit',
|
'faq.edit',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param LoggerInterface $log
|
|
||||||
* @param Faq $faq
|
|
||||||
* @param Redirector $redirector
|
|
||||||
* @param Response $response
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
LoggerInterface $log,
|
LoggerInterface $log,
|
||||||
Faq $faq,
|
Faq $faq,
|
||||||
|
@ -51,7 +45,6 @@ class FaqController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -65,7 +58,6 @@ class FaqController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -110,7 +102,6 @@ class FaqController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Faq|null $faq
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,10 +20,6 @@ class LogsController extends BaseController
|
||||||
'admin_log',
|
'admin_log',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param LogEntry $log
|
|
||||||
* @param Response $response
|
|
||||||
*/
|
|
||||||
public function __construct(LogEntry $log, Response $response)
|
public function __construct(LogEntry $log, Response $response)
|
||||||
{
|
{
|
||||||
$this->log = $log;
|
$this->log = $log;
|
||||||
|
@ -31,7 +27,6 @@ class LogsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function index(Request $request): Response
|
public function index(Request $request): Response
|
||||||
|
|
|
@ -35,13 +35,6 @@ class NewsController extends BaseController
|
||||||
'admin_news',
|
'admin_news',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Authenticator $auth
|
|
||||||
* @param LoggerInterface $log
|
|
||||||
* @param News $news
|
|
||||||
* @param Redirector $redirector
|
|
||||||
* @param Response $response
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Authenticator $auth,
|
Authenticator $auth,
|
||||||
LoggerInterface $log,
|
LoggerInterface $log,
|
||||||
|
@ -57,7 +50,6 @@ class NewsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -72,8 +64,6 @@ class NewsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param News|null $news
|
|
||||||
* @param bool $isMeetingDefault
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -90,7 +80,6 @@ class NewsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -37,13 +37,6 @@ class QuestionsController extends BaseController
|
||||||
'question.edit',
|
'question.edit',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Authenticator $auth
|
|
||||||
* @param LoggerInterface $log
|
|
||||||
* @param Question $question
|
|
||||||
* @param Redirector $redirector
|
|
||||||
* @param Response $response
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Authenticator $auth,
|
Authenticator $auth,
|
||||||
LoggerInterface $log,
|
LoggerInterface $log,
|
||||||
|
@ -75,7 +68,6 @@ class QuestionsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -96,7 +88,6 @@ class QuestionsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -110,7 +101,6 @@ class QuestionsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -160,7 +150,6 @@ class QuestionsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Question|null $question
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -40,14 +40,6 @@ class UserShirtController extends BaseController
|
||||||
'saveShirt' => 'user.edit.shirt',
|
'saveShirt' => 'user.edit.shirt',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Authenticator $auth
|
|
||||||
* @param Config $config
|
|
||||||
* @param LoggerInterface $log
|
|
||||||
* @param Redirector $redirector
|
|
||||||
* @param Response $response
|
|
||||||
* @param User $user
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Authenticator $auth,
|
Authenticator $auth,
|
||||||
Config $config,
|
Config $config,
|
||||||
|
@ -65,7 +57,6 @@ class UserShirtController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -82,7 +73,6 @@ class UserShirtController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -45,15 +45,6 @@ class UserWorkLogController extends BaseController
|
||||||
'admin_user_worklog',
|
'admin_user_worklog',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Authenticator $auth
|
|
||||||
* @param Config $config
|
|
||||||
* @param LoggerInterface $log
|
|
||||||
* @param Worklog $worklog
|
|
||||||
* @param Redirector $redirector
|
|
||||||
* @param Response $response
|
|
||||||
* @param User $user
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Authenticator $auth,
|
Authenticator $auth,
|
||||||
Config $config,
|
Config $config,
|
||||||
|
@ -73,7 +64,6 @@ class UserWorkLogController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function editWorklog(Request $request): Response
|
public function editWorklog(Request $request): Response
|
||||||
|
@ -96,7 +86,6 @@ class UserWorkLogController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function saveWorklog(Request $request): Response
|
public function saveWorklog(Request $request): Response
|
||||||
|
@ -135,7 +124,6 @@ class UserWorkLogController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function showDeleteWorklog(Request $request): Response
|
public function showDeleteWorklog(Request $request): Response
|
||||||
|
@ -157,7 +145,6 @@ class UserWorkLogController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function deleteWorklog(Request $request): Response
|
public function deleteWorklog(Request $request): Response
|
||||||
|
|
|
@ -9,9 +9,6 @@ class ApiController extends BaseController
|
||||||
/** @var Response */
|
/** @var Response */
|
||||||
protected $response;
|
protected $response;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Response $response
|
|
||||||
*/
|
|
||||||
public function __construct(Response $response)
|
public function __construct(Response $response)
|
||||||
{
|
{
|
||||||
$this->response = $response;
|
$this->response = $response;
|
||||||
|
|
|
@ -36,13 +36,6 @@ class AuthController extends BaseController
|
||||||
'postLogin' => 'login',
|
'postLogin' => 'login',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Response $response
|
|
||||||
* @param SessionInterface $session
|
|
||||||
* @param Redirector $redirect
|
|
||||||
* @param Config $config
|
|
||||||
* @param Authenticator $auth
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Response $response,
|
Response $response,
|
||||||
SessionInterface $session,
|
SessionInterface $session,
|
||||||
|
@ -79,7 +72,6 @@ class AuthController extends BaseController
|
||||||
/**
|
/**
|
||||||
* Posted login form
|
* Posted login form
|
||||||
*
|
*
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function postLogin(Request $request): Response
|
public function postLogin(Request $request): Response
|
||||||
|
@ -101,7 +93,6 @@ class AuthController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,8 +8,6 @@ use DateTime;
|
||||||
trait ChecksArrivalsAndDepartures
|
trait ChecksArrivalsAndDepartures
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string|null $arrival
|
|
||||||
* @param string|null $departure
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function isArrivalDateValid(?string $arrival, ?string $departure): bool
|
protected function isArrivalDateValid(?string $arrival, ?string $departure): bool
|
||||||
|
@ -29,8 +27,6 @@ trait ChecksArrivalsAndDepartures
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|null $arrival
|
|
||||||
* @param string|null $departure
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function isDepartureDateValid(?string $arrival, ?string $departure): bool
|
protected function isDepartureDateValid(?string $arrival, ?string $departure): bool
|
||||||
|
|
|
@ -17,11 +17,6 @@ class CreditsController extends BaseController
|
||||||
/** @var Version */
|
/** @var Version */
|
||||||
protected $version;
|
protected $version;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Response $response
|
|
||||||
* @param Config $config
|
|
||||||
* @param Version $version
|
|
||||||
*/
|
|
||||||
public function __construct(Response $response, Config $config, Version $version)
|
public function __construct(Response $response, Config $config, Version $version)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
|
|
@ -17,10 +17,6 @@ class DesignController extends BaseController
|
||||||
/** @var Config */
|
/** @var Config */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Response $response
|
|
||||||
* @param Config $config
|
|
||||||
*/
|
|
||||||
public function __construct(Response $response, Config $config)
|
public function __construct(Response $response, Config $config)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
|
|
@ -24,11 +24,6 @@ class FaqController extends BaseController
|
||||||
'faq.view',
|
'faq.view',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Config $config
|
|
||||||
* @param Faq $faq
|
|
||||||
* @param Response $response
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Config $config,
|
Config $config,
|
||||||
Faq $faq,
|
Faq $faq,
|
||||||
|
|
|
@ -7,11 +7,7 @@ use Illuminate\Support\Collection;
|
||||||
|
|
||||||
trait HasUserNotifications
|
trait HasUserNotifications
|
||||||
{
|
{
|
||||||
/**
|
protected function addNotification(string|array $value, string $type = 'messages')
|
||||||
* @param string|array $value
|
|
||||||
* @param string $type
|
|
||||||
*/
|
|
||||||
protected function addNotification($value, $type = 'messages')
|
|
||||||
{
|
{
|
||||||
session()->set(
|
session()->set(
|
||||||
$type,
|
$type,
|
||||||
|
|
|
@ -9,9 +9,6 @@ class HealthController extends BaseController
|
||||||
/** @var Response */
|
/** @var Response */
|
||||||
protected $response;
|
protected $response;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Response $response
|
|
||||||
*/
|
|
||||||
public function __construct(Response $response)
|
public function __construct(Response $response)
|
||||||
{
|
{
|
||||||
$this->response = $response;
|
$this->response = $response;
|
||||||
|
|
|
@ -18,11 +18,6 @@ class HomeController extends BaseController
|
||||||
/** @var Redirector */
|
/** @var Redirector */
|
||||||
protected $redirect;
|
protected $redirect;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Authenticator $auth
|
|
||||||
* @param Config $config
|
|
||||||
* @param Redirector $redirect
|
|
||||||
*/
|
|
||||||
public function __construct(Authenticator $auth, Config $config, Redirector $redirect)
|
public function __construct(Authenticator $auth, Config $config, Redirector $redirect)
|
||||||
{
|
{
|
||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
|
|
|
@ -41,15 +41,6 @@ class MessagesController extends BaseController
|
||||||
'user_messages',
|
'user_messages',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Authenticator $auth
|
|
||||||
* @param Redirector $redirect
|
|
||||||
* @param Response $response
|
|
||||||
* @param Request $request
|
|
||||||
* @param Database $db
|
|
||||||
* @param Message $message
|
|
||||||
* @param User $user
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Authenticator $auth,
|
Authenticator $auth,
|
||||||
Redirector $redirect,
|
Redirector $redirect,
|
||||||
|
@ -211,7 +202,7 @@ class MessagesController extends BaseController
|
||||||
* The number of unread messages per conversation of the current user.
|
* The number of unread messages per conversation of the current user.
|
||||||
* @return Collection of unread message amounts. Each object with key=other user, value=amount of unread messages
|
* @return Collection of unread message amounts. Each object with key=other user, value=amount of unread messages
|
||||||
*/
|
*/
|
||||||
protected function numberOfUnreadMessagesPerConversation($currentUser): Collection
|
protected function numberOfUnreadMessagesPerConversation(User $currentUser): Collection
|
||||||
{
|
{
|
||||||
return $currentUser->messagesReceived()
|
return $currentUser->messagesReceived()
|
||||||
->select('user_id', $this->raw('count(*) as amount'))
|
->select('user_id', $this->raw('count(*) as amount'))
|
||||||
|
@ -228,7 +219,7 @@ class MessagesController extends BaseController
|
||||||
* which were either send by or addressed to the current user.
|
* which were either send by or addressed to the current user.
|
||||||
* @return Collection of messages
|
* @return Collection of messages
|
||||||
*/
|
*/
|
||||||
protected function latestMessagePerConversation($currentUser): Collection
|
protected function latestMessagePerConversation(User $currentUser): Collection
|
||||||
{
|
{
|
||||||
/* requesting the IDs first, grouped by "conversation".
|
/* requesting the IDs first, grouped by "conversation".
|
||||||
The more complex grouping is required for associating the messages to the correct conversations.
|
The more complex grouping is required for associating the messages to the correct conversations.
|
||||||
|
@ -252,10 +243,9 @@ class MessagesController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $value
|
|
||||||
* @return QueryExpression
|
* @return QueryExpression
|
||||||
*/
|
*/
|
||||||
protected function raw($value): QueryExpression
|
protected function raw(mixed $value): QueryExpression
|
||||||
{
|
{
|
||||||
return $this->db->getConnection()->raw($value);
|
return $this->db->getConnection()->raw($value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,6 @@ class Controller extends BaseController
|
||||||
/** @var Version */
|
/** @var Version */
|
||||||
protected $version;
|
protected $version;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Response $response
|
|
||||||
* @param MetricsEngine $engine
|
|
||||||
* @param Config $config
|
|
||||||
* @param Request $request
|
|
||||||
* @param Stats $stats
|
|
||||||
* @param Version $version
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Response $response,
|
Response $response,
|
||||||
MetricsEngine $engine,
|
MetricsEngine $engine,
|
||||||
|
@ -242,9 +234,8 @@ class Controller extends BaseController
|
||||||
/**
|
/**
|
||||||
* Ensure that the if the request is authorized
|
* Ensure that the if the request is authorized
|
||||||
*
|
*
|
||||||
* @param bool $isJson
|
|
||||||
*/
|
*/
|
||||||
protected function checkAuth($isJson = false)
|
protected function checkAuth(bool $isJson = false)
|
||||||
{
|
{
|
||||||
$apiKey = $this->config->get('api_key');
|
$apiKey = $this->config->get('api_key');
|
||||||
if (empty($apiKey) || $this->request->get('api_key') == $apiKey) {
|
if (empty($apiKey) || $this->request->get('api_key') == $apiKey) {
|
||||||
|
@ -265,10 +256,6 @@ class Controller extends BaseController
|
||||||
/**
|
/**
|
||||||
* Formats the stats collection as stats data
|
* Formats the stats collection as stats data
|
||||||
*
|
*
|
||||||
* @param Collection $data
|
|
||||||
* @param string $config
|
|
||||||
* @param string $dataField
|
|
||||||
* @param string|null $label
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function formatStats(Collection $data, string $config, string $dataField, ?string $label = null): array
|
protected function formatStats(Collection $data, string $config, string $dataField, ?string $label = null): array
|
||||||
|
|
|
@ -12,7 +12,6 @@ class MetricsEngine implements EngineInterface
|
||||||
/**
|
/**
|
||||||
* Render metrics
|
* Render metrics
|
||||||
*
|
*
|
||||||
* @param string $path
|
|
||||||
* @param mixed[] $data
|
* @param mixed[] $data
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -62,7 +61,6 @@ class MetricsEngine implements EngineInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $row
|
* @param array $row
|
||||||
* @param string $name
|
|
||||||
*
|
*
|
||||||
* @return array[]
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
|
@ -94,11 +92,9 @@ class MetricsEngine implements EngineInterface
|
||||||
/**
|
/**
|
||||||
* Expand the value to be an array
|
* Expand the value to be an array
|
||||||
*
|
*
|
||||||
* @param $data
|
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function expandData($data): array
|
protected function expandData(mixed $data): array
|
||||||
{
|
{
|
||||||
$data = is_array($data) ? $data : [$data];
|
$data = is_array($data) ? $data : [$data];
|
||||||
$return = ['labels' => [], 'value' => null];
|
$return = ['labels' => [], 'value' => null];
|
||||||
|
@ -124,13 +120,11 @@ class MetricsEngine implements EngineInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
|
||||||
* @param array|mixed $row
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* @see https://prometheus.io/docs/instrumenting/exposition_formats/
|
* @see https://prometheus.io/docs/instrumenting/exposition_formats/
|
||||||
*/
|
*/
|
||||||
protected function formatData($name, $row): string
|
protected function formatData(string $name, mixed $row): string
|
||||||
{
|
{
|
||||||
return sprintf(
|
return sprintf(
|
||||||
'%s%s %s',
|
'%s%s %s',
|
||||||
|
@ -159,11 +153,10 @@ class MetricsEngine implements EngineInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array|mixed $row
|
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
protected function renderValue($row)
|
protected function renderValue(mixed $row)
|
||||||
{
|
{
|
||||||
if (is_array($row)) {
|
if (is_array($row)) {
|
||||||
$row = array_pop($row);
|
$row = array_pop($row);
|
||||||
|
@ -173,11 +166,10 @@ class MetricsEngine implements EngineInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $value
|
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
protected function formatValue($value)
|
protected function formatValue(mixed $value)
|
||||||
{
|
{
|
||||||
if (is_bool($value)) {
|
if (is_bool($value)) {
|
||||||
return (int)$value;
|
return (int)$value;
|
||||||
|
@ -187,11 +179,10 @@ class MetricsEngine implements EngineInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $value
|
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
protected function escape($value)
|
protected function escape(mixed $value)
|
||||||
{
|
{
|
||||||
$replace = [
|
$replace = [
|
||||||
'\\' => '\\\\',
|
'\\' => '\\\\',
|
||||||
|
@ -207,7 +198,6 @@ class MetricsEngine implements EngineInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $path
|
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -220,9 +210,8 @@ class MetricsEngine implements EngineInterface
|
||||||
* Does nothing as shared data will only result in unexpected behaviour
|
* Does nothing as shared data will only result in unexpected behaviour
|
||||||
*
|
*
|
||||||
* @param string|mixed[] $key
|
* @param string|mixed[] $key
|
||||||
* @param mixed $value
|
|
||||||
*/
|
*/
|
||||||
public function share($key, $value = null): void
|
public function share(string|array $key, mixed $value = null): void
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ use Engelsystem\Models\User\Settings;
|
||||||
use Engelsystem\Models\User\State;
|
use Engelsystem\Models\User\State;
|
||||||
use Engelsystem\Models\User\User;
|
use Engelsystem\Models\User\User;
|
||||||
use Engelsystem\Models\Worklog;
|
use Engelsystem\Models\Worklog;
|
||||||
|
use Illuminate\Contracts\Database\Query\Builder as BuilderContract;
|
||||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||||
use Illuminate\Database\Query\Expression as QueryExpression;
|
use Illuminate\Database\Query\Expression as QueryExpression;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
@ -31,9 +32,6 @@ class Stats
|
||||||
/** @var Database */
|
/** @var Database */
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Database $db
|
|
||||||
*/
|
|
||||||
public function __construct(Database $db)
|
public function __construct(Database $db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
@ -103,7 +101,6 @@ class Stats
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $type
|
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
|
@ -315,16 +312,17 @@ class Stats
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $buckets
|
* @param array $buckets
|
||||||
* @param QueryBuilder $basicQuery
|
|
||||||
* @param string $groupBy
|
|
||||||
* @param string $having
|
|
||||||
* @param string $count
|
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @codeCoverageIgnore As long as its only used for old tables
|
* @codeCoverageIgnore As long as its only used for old tables
|
||||||
*/
|
*/
|
||||||
protected function getBuckets(array $buckets, $basicQuery, string $groupBy, string $having, string $count): array
|
protected function getBuckets(
|
||||||
{
|
array $buckets,
|
||||||
|
BuilderContract $basicQuery,
|
||||||
|
string $groupBy,
|
||||||
|
string $having,
|
||||||
|
string $count
|
||||||
|
): array {
|
||||||
$return = [];
|
$return = [];
|
||||||
|
|
||||||
foreach ($buckets as $bucket) {
|
foreach ($buckets as $bucket) {
|
||||||
|
@ -512,7 +510,6 @@ class Stats
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $table
|
|
||||||
* @return QueryBuilder
|
* @return QueryBuilder
|
||||||
*/
|
*/
|
||||||
protected function getQuery(string $table): QueryBuilder
|
protected function getQuery(string $table): QueryBuilder
|
||||||
|
@ -523,10 +520,9 @@ class Stats
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $value
|
|
||||||
* @return QueryExpression
|
* @return QueryExpression
|
||||||
*/
|
*/
|
||||||
protected function raw($value): QueryExpression
|
protected function raw(mixed $value): QueryExpression
|
||||||
{
|
{
|
||||||
return $this->db->getConnection()->raw($value);
|
return $this->db->getConnection()->raw($value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,16 +48,6 @@ class NewsController extends BaseController
|
||||||
'deleteComment' => 'news_comments',
|
'deleteComment' => 'news_comments',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Authenticator $auth
|
|
||||||
* @param Config $config
|
|
||||||
* @param NewsComment $comment
|
|
||||||
* @param LoggerInterface $log
|
|
||||||
* @param News $news
|
|
||||||
* @param Redirector $redirector
|
|
||||||
* @param Response $response
|
|
||||||
* @param Request $request
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Authenticator $auth,
|
Authenticator $auth,
|
||||||
NewsComment $comment,
|
NewsComment $comment,
|
||||||
|
@ -95,7 +85,6 @@ class NewsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function show(Request $request): Response
|
public function show(Request $request): Response
|
||||||
|
@ -111,7 +100,6 @@ class NewsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function comment(Request $request): Response
|
public function comment(Request $request): Response
|
||||||
|
@ -144,7 +132,6 @@ class NewsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -180,7 +167,6 @@ class NewsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $onlyMeetings
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
protected function showOverview(bool $onlyMeetings = false): Response
|
protected function showOverview(bool $onlyMeetings = false): Response
|
||||||
|
@ -216,7 +202,6 @@ class NewsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $page
|
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -49,16 +49,6 @@ class OAuthController extends BaseController
|
||||||
/** @var UrlGenerator */
|
/** @var UrlGenerator */
|
||||||
protected $url;
|
protected $url;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Authenticator $auth
|
|
||||||
* @param AuthController $authController
|
|
||||||
* @param Config $config
|
|
||||||
* @param LoggerInterface $log
|
|
||||||
* @param OAuth $oauth
|
|
||||||
* @param Redirector $redirector
|
|
||||||
* @param Session $session
|
|
||||||
* @param UrlGenerator $url
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Authenticator $auth,
|
Authenticator $auth,
|
||||||
AuthController $authController,
|
AuthController $authController,
|
||||||
|
@ -80,7 +70,6 @@ class OAuthController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -213,7 +202,6 @@ class OAuthController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -229,7 +217,6 @@ class OAuthController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -249,7 +236,6 @@ class OAuthController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
|
||||||
*
|
*
|
||||||
* @return AbstractProvider
|
* @return AbstractProvider
|
||||||
*/
|
*/
|
||||||
|
@ -272,8 +258,6 @@ class OAuthController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $providerName
|
|
||||||
* @param ResourceOwner $resourceOwner
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
protected function getId(string $providerName, ResourceOwner $resourceOwner)
|
protected function getId(string $providerName, ResourceOwner $resourceOwner)
|
||||||
|
@ -287,9 +271,6 @@ class OAuthController extends BaseController
|
||||||
return $data[$config['id']];
|
return $data[$config['id']];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $provider
|
|
||||||
*/
|
|
||||||
protected function requireProvider(string $provider): void
|
protected function requireProvider(string $provider): void
|
||||||
{
|
{
|
||||||
if (!$this->isValidProvider($provider)) {
|
if (!$this->isValidProvider($provider)) {
|
||||||
|
@ -298,7 +279,6 @@ class OAuthController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -309,11 +289,6 @@ class OAuthController extends BaseController
|
||||||
return isset($config[$name]);
|
return isset($config[$name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param OAuth $auth
|
|
||||||
* @param string $providerName
|
|
||||||
* @param ResourceOwner $resourceOwner
|
|
||||||
*/
|
|
||||||
protected function handleArrive(
|
protected function handleArrive(
|
||||||
string $providerName,
|
string $providerName,
|
||||||
OAuth $auth,
|
OAuth $auth,
|
||||||
|
@ -342,8 +317,6 @@ class OAuthController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param IdentityProviderException $e
|
|
||||||
* @param string $providerName
|
|
||||||
*
|
*
|
||||||
* @throws HttpNotFound
|
* @throws HttpNotFound
|
||||||
*/
|
*/
|
||||||
|
@ -364,11 +337,7 @@ class OAuthController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $providerName
|
|
||||||
* @param string $providerUserIdentifier
|
|
||||||
* @param AccessTokenInterface $accessToken
|
|
||||||
* @param array $config
|
* @param array $config
|
||||||
* @param Collection $userdata
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -35,12 +35,6 @@ class PasswordResetController extends BaseController
|
||||||
'postResetPassword' => 'login',
|
'postResetPassword' => 'login',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Response $response
|
|
||||||
* @param SessionInterface $session
|
|
||||||
* @param EngelsystemMailer $mail
|
|
||||||
* @param LoggerInterface $log
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Response $response,
|
Response $response,
|
||||||
SessionInterface $session,
|
SessionInterface $session,
|
||||||
|
@ -62,7 +56,6 @@ class PasswordResetController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function postReset(Request $request): Response
|
public function postReset(Request $request): Response
|
||||||
|
@ -96,7 +89,6 @@ class PasswordResetController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function resetPassword(Request $request): Response
|
public function resetPassword(Request $request): Response
|
||||||
|
@ -110,7 +102,6 @@ class PasswordResetController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function postResetPassword(Request $request): Response
|
public function postResetPassword(Request $request): Response
|
||||||
|
@ -135,11 +126,10 @@ class PasswordResetController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $view
|
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
protected function showView($view = 'pages/password/reset', $data = []): Response
|
protected function showView(string $view = 'pages/password/reset', array $data = []): Response
|
||||||
{
|
{
|
||||||
return $this->response->withView(
|
return $this->response->withView(
|
||||||
$view,
|
$view,
|
||||||
|
@ -148,7 +138,6 @@ class PasswordResetController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return PasswordReset
|
* @return PasswordReset
|
||||||
*/
|
*/
|
||||||
protected function requireToken(Request $request): PasswordReset
|
protected function requireToken(Request $request): PasswordReset
|
||||||
|
|
|
@ -34,13 +34,6 @@ class QuestionsController extends BaseController
|
||||||
'question.add',
|
'question.add',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Authenticator $auth
|
|
||||||
* @param LoggerInterface $log
|
|
||||||
* @param Question $question
|
|
||||||
* @param Redirector $redirect
|
|
||||||
* @param Response $response
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Authenticator $auth,
|
Authenticator $auth,
|
||||||
LoggerInterface $log,
|
LoggerInterface $log,
|
||||||
|
@ -84,7 +77,6 @@ class QuestionsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -112,7 +104,6 @@ class QuestionsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -35,13 +35,6 @@ class SettingsController extends BaseController
|
||||||
'user_settings',
|
'user_settings',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Authenticator $auth
|
|
||||||
* @param Config $config
|
|
||||||
* @param LoggerInterface $log
|
|
||||||
* @param Redirector $redirector
|
|
||||||
* @param Response $response
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Authenticator $auth,
|
Authenticator $auth,
|
||||||
Config $config,
|
Config $config,
|
||||||
|
@ -73,7 +66,6 @@ class SettingsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function saveProfile(Request $request): Response
|
public function saveProfile(Request $request): Response
|
||||||
|
@ -151,7 +143,6 @@ class SettingsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function savePassword(Request $request): Response
|
public function savePassword(Request $request): Response
|
||||||
|
@ -201,7 +192,6 @@ class SettingsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function saveTheme(Request $request): Response
|
public function saveTheme(Request $request): Response
|
||||||
|
@ -242,7 +232,6 @@ class SettingsController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function saveLanguage(Request $request): Response
|
public function saveLanguage(Request $request): Response
|
||||||
|
|
|
@ -10,9 +10,6 @@ class Database
|
||||||
/** @var DatabaseConnection */
|
/** @var DatabaseConnection */
|
||||||
protected $connection;
|
protected $connection;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param DatabaseConnection $connection
|
|
||||||
*/
|
|
||||||
public function __construct(DatabaseConnection $connection)
|
public function __construct(DatabaseConnection $connection)
|
||||||
{
|
{
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
|
@ -21,11 +18,10 @@ class Database
|
||||||
/**
|
/**
|
||||||
* Run a select query
|
* Run a select query
|
||||||
*
|
*
|
||||||
* @param string $query
|
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return object[]
|
* @return object[]
|
||||||
*/
|
*/
|
||||||
public function select($query, array $bindings = [])
|
public function select(string $query, array $bindings = [])
|
||||||
{
|
{
|
||||||
return $this->connection->select($query, $bindings);
|
return $this->connection->select($query, $bindings);
|
||||||
}
|
}
|
||||||
|
@ -33,11 +29,10 @@ class Database
|
||||||
/**
|
/**
|
||||||
* Run a select query and return only the first result or null if no result is found.
|
* Run a select query and return only the first result or null if no result is found.
|
||||||
*
|
*
|
||||||
* @param string $query
|
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return object|null
|
* @return object|null
|
||||||
*/
|
*/
|
||||||
public function selectOne($query, array $bindings = [])
|
public function selectOne(string $query, array $bindings = [])
|
||||||
{
|
{
|
||||||
return $this->connection->selectOne($query, $bindings);
|
return $this->connection->selectOne($query, $bindings);
|
||||||
}
|
}
|
||||||
|
@ -45,11 +40,10 @@ class Database
|
||||||
/**
|
/**
|
||||||
* Run an insert query
|
* Run an insert query
|
||||||
*
|
*
|
||||||
* @param string $query
|
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function insert($query, array $bindings = [])
|
public function insert(string $query, array $bindings = [])
|
||||||
{
|
{
|
||||||
return $this->connection->insert($query, $bindings);
|
return $this->connection->insert($query, $bindings);
|
||||||
}
|
}
|
||||||
|
@ -57,11 +51,10 @@ class Database
|
||||||
/**
|
/**
|
||||||
* Run an update query
|
* Run an update query
|
||||||
*
|
*
|
||||||
* @param string $query
|
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function update($query, array $bindings = [])
|
public function update(string $query, array $bindings = [])
|
||||||
{
|
{
|
||||||
return $this->connection->update($query, $bindings);
|
return $this->connection->update($query, $bindings);
|
||||||
}
|
}
|
||||||
|
@ -69,11 +62,10 @@ class Database
|
||||||
/**
|
/**
|
||||||
* Run a delete query
|
* Run a delete query
|
||||||
*
|
*
|
||||||
* @param string $query
|
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function delete($query, array $bindings = [])
|
public function delete(string $query, array $bindings = [])
|
||||||
{
|
{
|
||||||
return $this->connection->delete($query, $bindings);
|
return $this->connection->delete($query, $bindings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,6 @@ class DatabaseServiceProvider extends ServiceProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Throwable $exception
|
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,9 +15,8 @@ class Db
|
||||||
/**
|
/**
|
||||||
* Set the database connection manager
|
* Set the database connection manager
|
||||||
*
|
*
|
||||||
* @param CapsuleManager $dbManager
|
|
||||||
*/
|
*/
|
||||||
public static function setDbManager($dbManager)
|
public static function setDbManager(CapsuleManager $dbManager)
|
||||||
{
|
{
|
||||||
self::$dbManager = $dbManager;
|
self::$dbManager = $dbManager;
|
||||||
}
|
}
|
||||||
|
@ -25,11 +24,10 @@ class Db
|
||||||
/**
|
/**
|
||||||
* Run a select query
|
* Run a select query
|
||||||
*
|
*
|
||||||
* @param string $query
|
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return array[]
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
public static function select($query, array $bindings = [])
|
public static function select(string $query, array $bindings = [])
|
||||||
{
|
{
|
||||||
$return = self::connection()->select($query, $bindings);
|
$return = self::connection()->select($query, $bindings);
|
||||||
|
|
||||||
|
@ -44,11 +42,10 @@ class Db
|
||||||
/**
|
/**
|
||||||
* Run a select query and return only the first result or null if no result is found.
|
* Run a select query and return only the first result or null if no result is found.
|
||||||
*
|
*
|
||||||
* @param string $query
|
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return array|null
|
* @return array|null
|
||||||
*/
|
*/
|
||||||
public static function selectOne($query, array $bindings = [])
|
public static function selectOne(string $query, array $bindings = [])
|
||||||
{
|
{
|
||||||
$result = self::connection()->selectOne($query, $bindings);
|
$result = self::connection()->selectOne($query, $bindings);
|
||||||
|
|
||||||
|
@ -64,11 +61,10 @@ class Db
|
||||||
/**
|
/**
|
||||||
* Run an insert query
|
* Run an insert query
|
||||||
*
|
*
|
||||||
* @param string $query
|
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function insert($query, array $bindings = [])
|
public static function insert(string $query, array $bindings = [])
|
||||||
{
|
{
|
||||||
return self::connection()->insert($query, $bindings);
|
return self::connection()->insert($query, $bindings);
|
||||||
}
|
}
|
||||||
|
@ -76,11 +72,10 @@ class Db
|
||||||
/**
|
/**
|
||||||
* Run an update query
|
* Run an update query
|
||||||
*
|
*
|
||||||
* @param string $query
|
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public static function update($query, array $bindings = [])
|
public static function update(string $query, array $bindings = [])
|
||||||
{
|
{
|
||||||
return self::connection()->update($query, $bindings);
|
return self::connection()->update($query, $bindings);
|
||||||
}
|
}
|
||||||
|
@ -88,11 +83,10 @@ class Db
|
||||||
/**
|
/**
|
||||||
* Run a delete query
|
* Run a delete query
|
||||||
*
|
*
|
||||||
* @param string $query
|
|
||||||
* @param array $bindings
|
* @param array $bindings
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public static function delete($query, array $bindings = [])
|
public static function delete(string $query, array $bindings = [])
|
||||||
{
|
{
|
||||||
return self::connection()->delete($query, $bindings);
|
return self::connection()->delete($query, $bindings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,6 @@ class Migrate
|
||||||
/**
|
/**
|
||||||
* Migrate constructor
|
* Migrate constructor
|
||||||
*
|
*
|
||||||
* @param SchemaBuilder $schema
|
|
||||||
* @param Application $app
|
|
||||||
*/
|
*/
|
||||||
public function __construct(SchemaBuilder $schema, Application $app)
|
public function __construct(SchemaBuilder $schema, Application $app)
|
||||||
{
|
{
|
||||||
|
@ -48,12 +46,9 @@ class Migrate
|
||||||
/**
|
/**
|
||||||
* Run a migration
|
* Run a migration
|
||||||
*
|
*
|
||||||
* @param string $path
|
|
||||||
* @param string $type (up|down)
|
* @param string $type (up|down)
|
||||||
* @param bool $oneStep
|
|
||||||
* @param bool $forceMigration
|
|
||||||
*/
|
*/
|
||||||
public function run($path, $type = self::UP, $oneStep = false, $forceMigration = false)
|
public function run(string $path, string $type = self::UP, bool $oneStep = false, bool $forceMigration = false)
|
||||||
{
|
{
|
||||||
$this->initMigration();
|
$this->initMigration();
|
||||||
|
|
||||||
|
@ -118,8 +113,6 @@ class Migrate
|
||||||
/**
|
/**
|
||||||
* Merge file migrations with already migrated tables
|
* Merge file migrations with already migrated tables
|
||||||
*
|
*
|
||||||
* @param Collection $migrations
|
|
||||||
* @param Collection $migrated
|
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
protected function mergeMigrations(Collection $migrations, Collection $migrated)
|
protected function mergeMigrations(Collection $migrations, Collection $migrated)
|
||||||
|
@ -163,11 +156,9 @@ class Migrate
|
||||||
/**
|
/**
|
||||||
* Migrate a migration
|
* Migrate a migration
|
||||||
*
|
*
|
||||||
* @param string $file
|
|
||||||
* @param string $migration
|
|
||||||
* @param string $type (up|down)
|
* @param string $type (up|down)
|
||||||
*/
|
*/
|
||||||
protected function migrate($file, $migration, $type = self::UP)
|
protected function migrate(string $file, string $migration, string $type = self::UP)
|
||||||
{
|
{
|
||||||
require_once $file;
|
require_once $file;
|
||||||
|
|
||||||
|
@ -183,10 +174,9 @@ class Migrate
|
||||||
/**
|
/**
|
||||||
* Set a migration to migrated
|
* Set a migration to migrated
|
||||||
*
|
*
|
||||||
* @param string $migration
|
|
||||||
* @param string $type (up|down)
|
* @param string $type (up|down)
|
||||||
*/
|
*/
|
||||||
protected function setMigrated($migration, $type = self::UP)
|
protected function setMigrated(string $migration, string $type = self::UP)
|
||||||
{
|
{
|
||||||
$table = $this->getTableQuery();
|
$table = $this->getTableQuery();
|
||||||
|
|
||||||
|
@ -201,11 +191,10 @@ class Migrate
|
||||||
/**
|
/**
|
||||||
* Lock the migrations table
|
* Lock the migrations table
|
||||||
*
|
*
|
||||||
* @param bool $forceMigration
|
|
||||||
*
|
*
|
||||||
* @throws Throwable
|
* @throws Throwable
|
||||||
*/
|
*/
|
||||||
protected function lockTable($forceMigration = false)
|
protected function lockTable(bool $forceMigration = false)
|
||||||
{
|
{
|
||||||
$this->schema->getConnection()->transaction(function () use ($forceMigration) {
|
$this->schema->getConnection()->transaction(function () use ($forceMigration) {
|
||||||
$lock = $this->getTableQuery()
|
$lock = $this->getTableQuery()
|
||||||
|
@ -235,11 +224,10 @@ class Migrate
|
||||||
/**
|
/**
|
||||||
* Get a list of migration files
|
* Get a list of migration files
|
||||||
*
|
*
|
||||||
* @param string $dir
|
|
||||||
*
|
*
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
protected function getMigrations($dir)
|
protected function getMigrations(string $dir)
|
||||||
{
|
{
|
||||||
$files = $this->getMigrationFiles($dir);
|
$files = $this->getMigrationFiles($dir);
|
||||||
|
|
||||||
|
@ -260,11 +248,10 @@ class Migrate
|
||||||
/**
|
/**
|
||||||
* List all migration files from the given directory
|
* List all migration files from the given directory
|
||||||
*
|
*
|
||||||
* @param string $dir
|
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getMigrationFiles($dir)
|
protected function getMigrationFiles(string $dir)
|
||||||
{
|
{
|
||||||
return glob($dir . '/*_*.php');
|
return glob($dir . '/*_*.php');
|
||||||
}
|
}
|
||||||
|
@ -282,7 +269,6 @@ class Migrate
|
||||||
/**
|
/**
|
||||||
* Set the output function
|
* Set the output function
|
||||||
*
|
*
|
||||||
* @param callable $output
|
|
||||||
*/
|
*/
|
||||||
public function setOutput(callable $output)
|
public function setOutput(callable $output)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,6 @@ abstract class Migration
|
||||||
/**
|
/**
|
||||||
* Migration constructor.
|
* Migration constructor.
|
||||||
*
|
*
|
||||||
* @param SchemaBuilder $schemaBuilder
|
|
||||||
*/
|
*/
|
||||||
public function __construct(SchemaBuilder $schemaBuilder)
|
public function __construct(SchemaBuilder $schemaBuilder)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,45 +10,33 @@ class EventDispatcher
|
||||||
/** @var callable[] */
|
/** @var callable[] */
|
||||||
protected $listeners;
|
protected $listeners;
|
||||||
|
|
||||||
/**
|
public function listen(array|string $events, callable|string $listener): void
|
||||||
* @param array|string $events
|
|
||||||
* @param callable|string $listener
|
|
||||||
*/
|
|
||||||
public function listen($events, $listener): void
|
|
||||||
{
|
{
|
||||||
foreach ((array)$events as $event) {
|
foreach ((array)$events as $event) {
|
||||||
$this->listeners[$event][] = $listener;
|
$this->listeners[$event][] = $listener;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function forget(string $event): void
|
||||||
* @param string $event
|
|
||||||
*/
|
|
||||||
public function forget($event): void
|
|
||||||
{
|
{
|
||||||
unset($this->listeners[$event]);
|
unset($this->listeners[$event]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|object $event
|
|
||||||
* @param array|mixed $payload
|
|
||||||
* @param bool $halt
|
|
||||||
*
|
*
|
||||||
* @return array|mixed|null
|
* @return array|mixed|null
|
||||||
*/
|
*/
|
||||||
public function fire($event, $payload = [], $halt = false)
|
public function fire(string|object $event, mixed $payload = [], bool $halt = false)
|
||||||
{
|
{
|
||||||
return $this->dispatch($event, $payload, $halt);
|
return $this->dispatch($event, $payload, $halt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|object $event
|
|
||||||
* @param array|mixed $payload
|
|
||||||
* @param bool $halt Stop on first non-null return
|
* @param bool $halt Stop on first non-null return
|
||||||
*
|
*
|
||||||
* @return array|null|mixed
|
* @return array|null|mixed
|
||||||
*/
|
*/
|
||||||
public function dispatch($event, $payload = [], $halt = false)
|
public function dispatch(string|object $event, mixed $payload = [], bool $halt = false)
|
||||||
{
|
{
|
||||||
if (is_object($event)) {
|
if (is_object($event)) {
|
||||||
$payload = $event;
|
$payload = $event;
|
||||||
|
|
|
@ -17,9 +17,6 @@ class EventsServiceProvider extends ServiceProvider
|
||||||
$this->registerEvents($dispatcher);
|
$this->registerEvents($dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param EventDispatcher $dispatcher
|
|
||||||
*/
|
|
||||||
protected function registerEvents(EventDispatcher $dispatcher)
|
protected function registerEvents(EventDispatcher $dispatcher)
|
||||||
{
|
{
|
||||||
/** @var Config $config */
|
/** @var Config $config */
|
||||||
|
|
|
@ -21,11 +21,6 @@ class News
|
||||||
/** @var UserSettings */
|
/** @var UserSettings */
|
||||||
protected $settings;
|
protected $settings;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param LoggerInterface $log
|
|
||||||
* @param EngelsystemMailer $mailer
|
|
||||||
* @param UserSettings $settings
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
LoggerInterface $log,
|
LoggerInterface $log,
|
||||||
EngelsystemMailer $mailer,
|
EngelsystemMailer $mailer,
|
||||||
|
@ -36,9 +31,6 @@ class News
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param NewsModel $news
|
|
||||||
*/
|
|
||||||
public function created(NewsModel $news)
|
public function created(NewsModel $news)
|
||||||
{
|
{
|
||||||
/** @var UserSettings[]|Collection $recipients */
|
/** @var UserSettings[]|Collection $recipients */
|
||||||
|
@ -52,12 +44,6 @@ class News
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param NewsModel $news
|
|
||||||
* @param User $user
|
|
||||||
* @param string $subject
|
|
||||||
* @param string $template
|
|
||||||
*/
|
|
||||||
protected function sendMail(NewsModel $news, User $user, string $subject, string $template)
|
protected function sendMail(NewsModel $news, User $user, string $subject, string $template)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -21,10 +21,6 @@ class OAuth2
|
||||||
/** @var LoggerInterface */
|
/** @var LoggerInterface */
|
||||||
protected LoggerInterface $log;
|
protected LoggerInterface $log;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Config $config
|
|
||||||
* @param LoggerInterface $log
|
|
||||||
*/
|
|
||||||
public function __construct(Config $config, LoggerInterface $log, Authenticator $auth)
|
public function __construct(Config $config, LoggerInterface $log, Authenticator $auth)
|
||||||
{
|
{
|
||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
|
@ -33,7 +29,6 @@ class OAuth2
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $event
|
|
||||||
* @param string $provider OAuth provider name
|
* @param string $provider OAuth provider name
|
||||||
* @param Collection $data OAuth userdata
|
* @param Collection $data OAuth userdata
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,10 +32,7 @@ class ExceptionsServiceProvider extends ServiceProvider
|
||||||
$this->addLogger($handler);
|
$this->addLogger($handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function addProductionHandler(Handler $errorHandler)
|
||||||
* @param Handler $errorHandler
|
|
||||||
*/
|
|
||||||
protected function addProductionHandler($errorHandler)
|
|
||||||
{
|
{
|
||||||
$handler = $this->app->make(Legacy::class);
|
$handler = $this->app->make(Legacy::class);
|
||||||
$this->app->instance('error.handler.production', $handler);
|
$this->app->instance('error.handler.production', $handler);
|
||||||
|
@ -43,10 +40,7 @@ class ExceptionsServiceProvider extends ServiceProvider
|
||||||
$this->app->bind(HandlerInterface::class, 'error.handler.production');
|
$this->app->bind(HandlerInterface::class, 'error.handler.production');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function addDevelopmentHandler(Handler $errorHandler)
|
||||||
* @param Handler $errorHandler
|
|
||||||
*/
|
|
||||||
protected function addDevelopmentHandler($errorHandler)
|
|
||||||
{
|
{
|
||||||
$handler = $this->app->make(LegacyDevelopment::class);
|
$handler = $this->app->make(LegacyDevelopment::class);
|
||||||
|
|
||||||
|
@ -58,9 +52,6 @@ class ExceptionsServiceProvider extends ServiceProvider
|
||||||
$errorHandler->setHandler(Handler::ENV_DEVELOPMENT, $handler);
|
$errorHandler->setHandler(Handler::ENV_DEVELOPMENT, $handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Handler $handler
|
|
||||||
*/
|
|
||||||
protected function addLogger(Handler $handler)
|
protected function addLogger(Handler $handler)
|
||||||
{
|
{
|
||||||
foreach ($handler->getHandler() as $h) {
|
foreach ($handler->getHandler() as $h) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Handler
|
||||||
*
|
*
|
||||||
* @param string $environment prod|dev
|
* @param string $environment prod|dev
|
||||||
*/
|
*/
|
||||||
public function __construct($environment = self::ENV_PRODUCTION)
|
public function __construct(string $environment = self::ENV_PRODUCTION)
|
||||||
{
|
{
|
||||||
$this->environment = $environment;
|
$this->environment = $environment;
|
||||||
}
|
}
|
||||||
|
@ -44,24 +44,16 @@ class Handler
|
||||||
set_exception_handler([$this, 'exceptionHandler']);
|
set_exception_handler([$this, 'exceptionHandler']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function errorHandler(int $number, string $message, string $file, int $line)
|
||||||
* @param int $number
|
|
||||||
* @param string $message
|
|
||||||
* @param string $file
|
|
||||||
* @param int $line
|
|
||||||
*/
|
|
||||||
public function errorHandler($number, $message, $file, $line)
|
|
||||||
{
|
{
|
||||||
$exception = new ErrorException($message, 0, $number, $file, $line);
|
$exception = new ErrorException($message, 0, $number, $file, $line);
|
||||||
$this->exceptionHandler($exception);
|
$this->exceptionHandler($exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Throwable $e
|
|
||||||
* @param bool $return
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function exceptionHandler($e, $return = false)
|
public function exceptionHandler(Throwable $e, bool $return = false)
|
||||||
{
|
{
|
||||||
if (!$this->request instanceof Request) {
|
if (!$this->request instanceof Request) {
|
||||||
$this->request = new Request();
|
$this->request = new Request();
|
||||||
|
@ -90,9 +82,8 @@ class Handler
|
||||||
* Exit the application
|
* Exit the application
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @param string $message
|
|
||||||
*/
|
*/
|
||||||
protected function terminateApplicationImmediately($message = '')
|
protected function terminateApplicationImmediately(string $message = '')
|
||||||
{
|
{
|
||||||
echo $message;
|
echo $message;
|
||||||
die(1);
|
die(1);
|
||||||
|
@ -106,19 +97,15 @@ class Handler
|
||||||
return $this->environment;
|
return $this->environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setEnvironment(string $environment)
|
||||||
* @param string $environment
|
|
||||||
*/
|
|
||||||
public function setEnvironment($environment)
|
|
||||||
{
|
{
|
||||||
$this->environment = $environment;
|
$this->environment = $environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $environment
|
|
||||||
* @return HandlerInterface|HandlerInterface[]
|
* @return HandlerInterface|HandlerInterface[]
|
||||||
*/
|
*/
|
||||||
public function getHandler($environment = null)
|
public function getHandler(string $environment = null)
|
||||||
{
|
{
|
||||||
if (!is_null($environment)) {
|
if (!is_null($environment)) {
|
||||||
return $this->handler[$environment];
|
return $this->handler[$environment];
|
||||||
|
@ -127,11 +114,7 @@ class Handler
|
||||||
return $this->handler;
|
return $this->handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setHandler(string $environment, HandlerInterface $handler)
|
||||||
* @param string $environment
|
|
||||||
* @param HandlerInterface $handler
|
|
||||||
*/
|
|
||||||
public function setHandler($environment, HandlerInterface $handler)
|
|
||||||
{
|
{
|
||||||
$this->handler[$environment] = $handler;
|
$this->handler[$environment] = $handler;
|
||||||
}
|
}
|
||||||
|
@ -144,9 +127,6 @@ class Handler
|
||||||
return $this->request;
|
return $this->request;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Request $request
|
|
||||||
*/
|
|
||||||
public function setRequest(Request $request)
|
public function setRequest(Request $request)
|
||||||
{
|
{
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
|
|
|
@ -7,14 +7,7 @@ use Throwable;
|
||||||
|
|
||||||
interface HandlerInterface
|
interface HandlerInterface
|
||||||
{
|
{
|
||||||
/**
|
public function render(Request $request, Throwable $e);
|
||||||
* @param Request $request
|
|
||||||
* @param Throwable $e
|
|
||||||
*/
|
|
||||||
public function render($request, Throwable $e);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Throwable $e
|
|
||||||
*/
|
|
||||||
public function report(Throwable $e);
|
public function report(Throwable $e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,18 +11,11 @@ class Legacy implements HandlerInterface
|
||||||
/** @var LoggerInterface */
|
/** @var LoggerInterface */
|
||||||
protected $log;
|
protected $log;
|
||||||
|
|
||||||
/**
|
public function render(Request $request, Throwable $e)
|
||||||
* @param Request $request
|
|
||||||
* @param Throwable $e
|
|
||||||
*/
|
|
||||||
public function render($request, Throwable $e)
|
|
||||||
{
|
{
|
||||||
echo 'An <del>un</del>expected error occurred. A team of untrained monkeys has been dispatched to fix it.';
|
echo 'An <del>un</del>expected error occurred. A team of untrained monkeys has been dispatched to fix it.';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Throwable $e
|
|
||||||
*/
|
|
||||||
public function report(Throwable $e)
|
public function report(Throwable $e)
|
||||||
{
|
{
|
||||||
$previous = $e->getPrevious();
|
$previous = $e->getPrevious();
|
||||||
|
@ -46,19 +39,15 @@ class Legacy implements HandlerInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param LoggerInterface $logger
|
|
||||||
*/
|
|
||||||
public function setLogger(LoggerInterface $logger)
|
public function setLogger(LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
$this->log = $logger;
|
$this->log = $logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $path
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function stripBasePath($path)
|
protected function stripBasePath(string $path)
|
||||||
{
|
{
|
||||||
$basePath = realpath(__DIR__ . '/../../..') . '/';
|
$basePath = realpath(__DIR__ . '/../../..') . '/';
|
||||||
return str_replace($basePath, '', $path);
|
return str_replace($basePath, '', $path);
|
||||||
|
|
|
@ -7,11 +7,7 @@ use Throwable;
|
||||||
|
|
||||||
class LegacyDevelopment extends Legacy
|
class LegacyDevelopment extends Legacy
|
||||||
{
|
{
|
||||||
/**
|
public function render(Request $request, Throwable $e)
|
||||||
* @param Request $request
|
|
||||||
* @param Throwable $e
|
|
||||||
*/
|
|
||||||
public function render($request, Throwable $e)
|
|
||||||
{
|
{
|
||||||
$file = $this->stripBasePath($e->getFile());
|
$file = $this->stripBasePath($e->getFile());
|
||||||
|
|
||||||
|
@ -40,7 +36,7 @@ class LegacyDevelopment extends Legacy
|
||||||
* @param array $stackTrace
|
* @param array $stackTrace
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function formatStackTrace($stackTrace)
|
protected function formatStackTrace(array $stackTrace)
|
||||||
{
|
{
|
||||||
$return = [];
|
$return = [];
|
||||||
$stackTrace = array_reverse($stackTrace);
|
$stackTrace = array_reverse($stackTrace);
|
||||||
|
|
|
@ -7,11 +7,7 @@ use Throwable;
|
||||||
|
|
||||||
class NullHandler extends Legacy
|
class NullHandler extends Legacy
|
||||||
{
|
{
|
||||||
/**
|
public function render(Request $request, Throwable $e)
|
||||||
* @param Request $request
|
|
||||||
* @param Throwable $e
|
|
||||||
*/
|
|
||||||
public function render($request, Throwable $e)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,18 +19,13 @@ class Whoops extends Legacy implements HandlerInterface
|
||||||
/**
|
/**
|
||||||
* Whoops constructor.
|
* Whoops constructor.
|
||||||
*
|
*
|
||||||
* @param Container $app
|
|
||||||
*/
|
*/
|
||||||
public function __construct(Container $app)
|
public function __construct(Container $app)
|
||||||
{
|
{
|
||||||
$this->app = $app;
|
$this->app = $app;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function render(Request $request, Throwable $e)
|
||||||
* @param Request $request
|
|
||||||
* @param Throwable $e
|
|
||||||
*/
|
|
||||||
public function render($request, Throwable $e)
|
|
||||||
{
|
{
|
||||||
$whoops = $this->app->make(WhoopsRunner::class);
|
$whoops = $this->app->make(WhoopsRunner::class);
|
||||||
$handler = $this->getPrettyPageHandler($e);
|
$handler = $this->getPrettyPageHandler($e);
|
||||||
|
@ -47,7 +42,6 @@ class Whoops extends Legacy implements HandlerInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Throwable $e
|
|
||||||
* @return PrettyPageHandler
|
* @return PrettyPageHandler
|
||||||
*/
|
*/
|
||||||
protected function getPrettyPageHandler(Throwable $e)
|
protected function getPrettyPageHandler(Throwable $e)
|
||||||
|
|
|
@ -19,7 +19,6 @@ class Assets
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $asset
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAssetPath(string $asset): string
|
public function getAssetPath(string $asset): string
|
||||||
|
|
|
@ -35,11 +35,6 @@ class Authenticator
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected int $guestRole = 10;
|
protected int $guestRole = 10;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ServerRequestInterface $request
|
|
||||||
* @param Session $session
|
|
||||||
* @param UserRepository $userRepository
|
|
||||||
*/
|
|
||||||
public function __construct(ServerRequestInterface $request, Session $session, UserRepository $userRepository)
|
public function __construct(ServerRequestInterface $request, Session $session, UserRepository $userRepository)
|
||||||
{
|
{
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
|
@ -78,7 +73,6 @@ class Authenticator
|
||||||
/**
|
/**
|
||||||
* Get the user by his api key
|
* Get the user by his api key
|
||||||
*
|
*
|
||||||
* @param string $parameter
|
|
||||||
* @return User|null
|
* @return User|null
|
||||||
*/
|
*/
|
||||||
public function apiUser(string $parameter = 'api_key'): ?User
|
public function apiUser(string $parameter = 'api_key'): ?User
|
||||||
|
@ -110,7 +104,7 @@ class Authenticator
|
||||||
* @param string[]|string $abilities
|
* @param string[]|string $abilities
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function can($abilities): bool
|
public function can(array|string $abilities): bool
|
||||||
{
|
{
|
||||||
$abilities = (array)$abilities;
|
$abilities = (array)$abilities;
|
||||||
|
|
||||||
|
@ -143,8 +137,6 @@ class Authenticator
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $login
|
|
||||||
* @param string $password
|
|
||||||
* @return User|null
|
* @return User|null
|
||||||
*/
|
*/
|
||||||
public function authenticate(string $login, string $password): ?User
|
public function authenticate(string $login, string $password): ?User
|
||||||
|
@ -167,8 +159,6 @@ class Authenticator
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
|
||||||
* @param string $password
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function verifyPassword(User $user, string $password): bool
|
public function verifyPassword(User $user, string $password): bool
|
||||||
|
@ -184,10 +174,6 @@ class Authenticator
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param User $user
|
|
||||||
* @param string $password
|
|
||||||
*/
|
|
||||||
public function setPassword(User $user, string $password)
|
public function setPassword(User $user, string $password)
|
||||||
{
|
{
|
||||||
$user->password = password_hash($password, $this->passwordAlgorithm);
|
$user->password = password_hash($password, $this->passwordAlgorithm);
|
||||||
|
@ -202,10 +188,7 @@ class Authenticator
|
||||||
return $this->passwordAlgorithm;
|
return $this->passwordAlgorithm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setPasswordAlgorithm(int|string|null $passwordAlgorithm)
|
||||||
* @param int|string|null $passwordAlgorithm
|
|
||||||
*/
|
|
||||||
public function setPasswordAlgorithm($passwordAlgorithm)
|
|
||||||
{
|
{
|
||||||
$this->passwordAlgorithm = $passwordAlgorithm;
|
$this->passwordAlgorithm = $passwordAlgorithm;
|
||||||
}
|
}
|
||||||
|
@ -218,9 +201,6 @@ class Authenticator
|
||||||
return $this->defaultRole;
|
return $this->defaultRole;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $defaultRole
|
|
||||||
*/
|
|
||||||
public function setDefaultRole(int $defaultRole)
|
public function setDefaultRole(int $defaultRole)
|
||||||
{
|
{
|
||||||
$this->defaultRole = $defaultRole;
|
$this->defaultRole = $defaultRole;
|
||||||
|
@ -234,9 +214,6 @@ class Authenticator
|
||||||
return $this->guestRole;
|
return $this->guestRole;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $guestRole
|
|
||||||
*/
|
|
||||||
public function setGuestRole(int $guestRole)
|
public function setGuestRole(int $guestRole)
|
||||||
{
|
{
|
||||||
$this->guestRole = $guestRole;
|
$this->guestRole = $guestRole;
|
||||||
|
|
|
@ -18,7 +18,6 @@ class Carbon extends \Carbon\Carbon
|
||||||
/**
|
/**
|
||||||
* Parses HTML datetime-local and ISO date/time strings.
|
* Parses HTML datetime-local and ISO date/time strings.
|
||||||
*
|
*
|
||||||
* @param string $value
|
|
||||||
* @return \Carbon\Carbon|null Carbon if parseable, else null
|
* @return \Carbon\Carbon|null Carbon if parseable, else null
|
||||||
* @see self::DATETIME_FORMATS
|
* @see self::DATETIME_FORMATS
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +35,6 @@ class Carbon extends \Carbon\Carbon
|
||||||
/**
|
/**
|
||||||
* Parses HTML datetime-local and ISO date/time strings.
|
* Parses HTML datetime-local and ISO date/time strings.
|
||||||
*
|
*
|
||||||
* @param string $value
|
|
||||||
* @return int|null Timestamp if parseable, else null
|
* @return int|null Timestamp if parseable, else null
|
||||||
* @see self::DATETIME_FORMATS
|
* @see self::DATETIME_FORMATS
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -27,7 +27,6 @@ class ConfigureEnvironmentServiceProvider extends ServiceProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param CarbonTimeZone $timeZone
|
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
protected function setTimeZone(CarbonTimeZone $timeZone)
|
protected function setTimeZone(CarbonTimeZone $timeZone)
|
||||||
|
@ -37,7 +36,6 @@ class ConfigureEnvironmentServiceProvider extends ServiceProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $displayErrors
|
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
protected function displayErrors(bool $displayErrors)
|
protected function displayErrors(bool $displayErrors)
|
||||||
|
@ -46,7 +44,6 @@ class ConfigureEnvironmentServiceProvider extends ServiceProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $errorReporting
|
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
protected function errorReporting(int $errorReporting)
|
protected function errorReporting(int $errorReporting)
|
||||||
|
|
|
@ -7,7 +7,6 @@ namespace Engelsystem\Helpers\Schedule;
|
||||||
trait CalculatesTime
|
trait CalculatesTime
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $time
|
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
protected function secondsFromTime(string $time): int
|
protected function secondsFromTime(string $time): int
|
||||||
|
|
|
@ -32,13 +32,6 @@ class Conference
|
||||||
/**
|
/**
|
||||||
* Event constructor.
|
* Event constructor.
|
||||||
*
|
*
|
||||||
* @param string $title
|
|
||||||
* @param string $acronym
|
|
||||||
* @param string|null $start
|
|
||||||
* @param string|null $end
|
|
||||||
* @param int|null $days
|
|
||||||
* @param string|null $timeslotDuration
|
|
||||||
* @param string|null $baseUrl
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $title,
|
string $title,
|
||||||
|
|
|
@ -26,10 +26,6 @@ class Day
|
||||||
/**
|
/**
|
||||||
* Day constructor.
|
* Day constructor.
|
||||||
*
|
*
|
||||||
* @param string $date
|
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
* @param int $index
|
|
||||||
* @param Room[] $rooms
|
* @param Room[] $rooms
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -79,27 +79,10 @@ class Event
|
||||||
/**
|
/**
|
||||||
* Event constructor.
|
* Event constructor.
|
||||||
*
|
*
|
||||||
* @param string $guid
|
|
||||||
* @param int $id
|
|
||||||
* @param Room $room
|
|
||||||
* @param string $title
|
|
||||||
* @param string $subtitle
|
|
||||||
* @param string $type
|
|
||||||
* @param Carbon $date
|
|
||||||
* @param string $start
|
|
||||||
* @param string $duration
|
|
||||||
* @param string $abstract
|
|
||||||
* @param string $slug
|
|
||||||
* @param string $track
|
|
||||||
* @param string|null $logo
|
|
||||||
* @param string[] $persons
|
* @param string[] $persons
|
||||||
* @param string|null $language
|
|
||||||
* @param string|null $description
|
|
||||||
* @param string|null $recording license
|
* @param string|null $recording license
|
||||||
* @param array $links
|
* @param array $links
|
||||||
* @param array $attachments
|
* @param array $attachments
|
||||||
* @param string|null $url
|
|
||||||
* @param string|null $videoDownloadUrl
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $guid,
|
string $guid,
|
||||||
|
@ -183,9 +166,6 @@ class Event
|
||||||
return $this->title;
|
return $this->title;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $title
|
|
||||||
*/
|
|
||||||
public function setTitle(string $title): void
|
public function setTitle(string $title): void
|
||||||
{
|
{
|
||||||
$this->title = $title;
|
$this->title = $title;
|
||||||
|
|
|
@ -15,7 +15,6 @@ class Room
|
||||||
/**
|
/**
|
||||||
* Room constructor.
|
* Room constructor.
|
||||||
*
|
*
|
||||||
* @param string $name
|
|
||||||
* @param Event[] $events
|
* @param Event[] $events
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -18,8 +18,6 @@ class Schedule
|
||||||
protected $day;
|
protected $day;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $version
|
|
||||||
* @param Conference $conference
|
|
||||||
* @param Day[] $days
|
* @param Day[] $days
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -16,7 +16,6 @@ class XmlParser
|
||||||
protected $schedule;
|
protected $schedule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $xml
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function load(string $xml): bool
|
public function load(string $xml): bool
|
||||||
|
@ -82,7 +81,6 @@ class XmlParser
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SimpleXMLElement[] $eventElements
|
* @param SimpleXMLElement[] $eventElements
|
||||||
* @param Room $room
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function parseEvents(array $eventElements, Room $room): array
|
protected function parseEvents(array $eventElements, Room $room): array
|
||||||
|
@ -129,8 +127,6 @@ class XmlParser
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $path
|
|
||||||
* @param SimpleXMLElement|null $xml
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getFirstXpathContent(string $path, ?SimpleXMLElement $xml = null): string
|
protected function getFirstXpathContent(string $path, ?SimpleXMLElement $xml = null): string
|
||||||
|
@ -143,10 +139,6 @@ class XmlParser
|
||||||
/**
|
/**
|
||||||
* Resolves a list from a sequence of elements
|
* Resolves a list from a sequence of elements
|
||||||
*
|
*
|
||||||
* @param SimpleXMLElement $element
|
|
||||||
* @param string $firstElement
|
|
||||||
* @param string $secondElement
|
|
||||||
* @param string $idAttribute
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getListFromSequence(
|
protected function getListFromSequence(
|
||||||
|
|
|
@ -10,8 +10,6 @@ class Shifts
|
||||||
/**
|
/**
|
||||||
* Check if a time range is a night shift
|
* Check if a time range is a night shift
|
||||||
*
|
*
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function isNightShift(Carbon $start, Carbon $end): bool
|
public static function isNightShift(Carbon $start, Carbon $end): bool
|
||||||
|
@ -27,8 +25,6 @@ class Shifts
|
||||||
/**
|
/**
|
||||||
* Calculate a shifts night multiplier
|
* Calculate a shifts night multiplier
|
||||||
*
|
*
|
||||||
* @param Carbon $start
|
|
||||||
* @param Carbon $end
|
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public static function getNightShiftMultiplier(Carbon $start, Carbon $end): float
|
public static function getNightShiftMultiplier(Carbon $start, Carbon $end): float
|
||||||
|
|
|
@ -7,9 +7,6 @@ use Gettext\Translator;
|
||||||
class GettextTranslator extends Translator
|
class GettextTranslator extends Translator
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string|null $domain
|
|
||||||
* @param string|null $context
|
|
||||||
* @param string $original
|
|
||||||
* @return string
|
* @return string
|
||||||
* @throws TranslationNotFound
|
* @throws TranslationNotFound
|
||||||
*/
|
*/
|
||||||
|
@ -21,11 +18,6 @@ class GettextTranslator extends Translator
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|null $domain
|
|
||||||
* @param string|null $context
|
|
||||||
* @param string $original
|
|
||||||
* @param string $plural
|
|
||||||
* @param int $value
|
|
||||||
* @return string
|
* @return string
|
||||||
* @throws TranslationNotFound
|
* @throws TranslationNotFound
|
||||||
*/
|
*/
|
||||||
|
@ -42,12 +34,9 @@ class GettextTranslator extends Translator
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $domain
|
|
||||||
* @param string $context
|
|
||||||
* @param string $original
|
|
||||||
* @throws TranslationNotFound
|
* @throws TranslationNotFound
|
||||||
*/
|
*/
|
||||||
protected function assertHasTranslation($domain, $context, $original)
|
protected function assertHasTranslation(?string $domain, ?string $context, string $original)
|
||||||
{
|
{
|
||||||
if ($this->getTranslation($domain, $context, $original)) {
|
if ($this->getTranslation($domain, $context, $original)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -54,7 +54,6 @@ class TranslationServiceProvider extends ServiceProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $locale
|
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function setLocale(string $locale): void
|
public function setLocale(string $locale): void
|
||||||
|
@ -70,7 +69,6 @@ class TranslationServiceProvider extends ServiceProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $locale
|
|
||||||
* @return GettextTranslator
|
* @return GettextTranslator
|
||||||
*/
|
*/
|
||||||
public function getTranslator(string $locale): GettextTranslator
|
public function getTranslator(string $locale): GettextTranslator
|
||||||
|
@ -101,8 +99,6 @@ class TranslationServiceProvider extends ServiceProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $locale
|
|
||||||
* @param string $name
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getFile(string $locale, string $name = 'default'): string
|
protected function getFile(string $locale, string $name = 'default'): string
|
||||||
|
|
|
@ -22,11 +22,7 @@ class Translator
|
||||||
/**
|
/**
|
||||||
* Translator constructor.
|
* Translator constructor.
|
||||||
*
|
*
|
||||||
* @param string $locale
|
|
||||||
* @param string $fallbackLocale
|
|
||||||
* @param callable $getTranslatorCallback
|
|
||||||
* @param string[] $locales
|
* @param string[] $locales
|
||||||
* @param callable $localeChangeCallback
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $locale,
|
string $locale,
|
||||||
|
@ -46,7 +42,6 @@ class Translator
|
||||||
/**
|
/**
|
||||||
* Get the translation for a given key
|
* Get the translation for a given key
|
||||||
*
|
*
|
||||||
* @param string $key
|
|
||||||
* @param array $replace
|
* @param array $replace
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -58,9 +53,6 @@ class Translator
|
||||||
/**
|
/**
|
||||||
* Get the translation for a given key
|
* Get the translation for a given key
|
||||||
*
|
*
|
||||||
* @param string $key
|
|
||||||
* @param string $pluralKey
|
|
||||||
* @param int $number
|
|
||||||
* @param array $replace
|
* @param array $replace
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -70,7 +62,6 @@ class Translator
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $type
|
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @param array $replace
|
* @param array $replace
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
|
@ -96,7 +87,6 @@ class Translator
|
||||||
/**
|
/**
|
||||||
* Replace placeholders
|
* Replace placeholders
|
||||||
*
|
*
|
||||||
* @param string $key
|
|
||||||
* @param array $replace
|
* @param array $replace
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*/
|
*/
|
||||||
|
@ -117,9 +107,6 @@ class Translator
|
||||||
return $this->locale;
|
return $this->locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $locale
|
|
||||||
*/
|
|
||||||
public function setLocale(string $locale)
|
public function setLocale(string $locale)
|
||||||
{
|
{
|
||||||
$this->locale = $locale;
|
$this->locale = $locale;
|
||||||
|
@ -138,7 +125,6 @@ class Translator
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $locale
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasLocale(string $locale): bool
|
public function hasLocale(string $locale): bool
|
||||||
|
|
|
@ -15,10 +15,6 @@ class Version
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $versionFile = 'VERSION';
|
protected $versionFile = 'VERSION';
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $storage
|
|
||||||
* @param Config $config
|
|
||||||
*/
|
|
||||||
public function __construct(string $storage, Config $config)
|
public function __construct(string $storage, Config $config)
|
||||||
{
|
{
|
||||||
$this->storage = $storage;
|
$this->storage = $storage;
|
||||||
|
|
|
@ -7,9 +7,7 @@ use Throwable;
|
||||||
class HttpAuthExpired extends HttpException
|
class HttpAuthExpired extends HttpException
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $message
|
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
* @param int $code
|
|
||||||
* @param Throwable|null $previous
|
* @param Throwable|null $previous
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -14,10 +14,7 @@ class HttpException extends RuntimeException
|
||||||
protected $headers = [];
|
protected $headers = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $statusCode
|
|
||||||
* @param string $message
|
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
* @param int $code
|
|
||||||
* @param Throwable|null $previous
|
* @param Throwable|null $previous
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -7,9 +7,7 @@ use Throwable;
|
||||||
class HttpForbidden extends HttpException
|
class HttpForbidden extends HttpException
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $message
|
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
* @param int $code
|
|
||||||
* @param Throwable|null $previous
|
* @param Throwable|null $previous
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -7,9 +7,7 @@ use Throwable;
|
||||||
class HttpNotFound extends HttpException
|
class HttpNotFound extends HttpException
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $message
|
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
* @param int $code
|
|
||||||
* @param Throwable|null $previous
|
* @param Throwable|null $previous
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Engelsystem\Http\Exceptions;
|
||||||
class HttpPermanentRedirect extends HttpRedirect
|
class HttpPermanentRedirect extends HttpRedirect
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $url
|
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -5,8 +5,6 @@ namespace Engelsystem\Http\Exceptions;
|
||||||
class HttpRedirect extends HttpException
|
class HttpRedirect extends HttpException
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $url
|
|
||||||
* @param int $statusCode
|
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Engelsystem\Http\Exceptions;
|
||||||
class HttpTemporaryRedirect extends HttpRedirect
|
class HttpTemporaryRedirect extends HttpRedirect
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $url
|
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -12,9 +12,6 @@ class ValidationException extends RuntimeException
|
||||||
protected $validator;
|
protected $validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Validator $validator
|
|
||||||
* @param string $message
|
|
||||||
* @param int $code
|
|
||||||
* @param Throwable|null $previous
|
* @param Throwable|null $previous
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
@ -36,10 +36,11 @@ trait MessageTrait
|
||||||
* @param string $version HTTP protocol version
|
* @param string $version HTTP protocol version
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function withProtocolVersion($version)
|
public function withProtocolVersion(mixed $version)
|
||||||
{
|
{
|
||||||
$new = clone $this;
|
$new = clone $this;
|
||||||
if (method_exists($new, 'setProtocolVersion')) {
|
if (method_exists($new, 'setProtocolVersion')) {
|
||||||
|
/** @var MessageTrait */
|
||||||
$new->setProtocolVersion($version);
|
$new->setProtocolVersion($version);
|
||||||
} else {
|
} else {
|
||||||
$new->server->set('SERVER_PROTOCOL', $version);
|
$new->server->set('SERVER_PROTOCOL', $version);
|
||||||
|
@ -90,7 +91,7 @@ trait MessageTrait
|
||||||
* name using a case-insensitive string comparison. Returns false if
|
* name using a case-insensitive string comparison. Returns false if
|
||||||
* no matching header name is found in the message.
|
* no matching header name is found in the message.
|
||||||
*/
|
*/
|
||||||
public function hasHeader($name)
|
public function hasHeader(mixed $name)
|
||||||
{
|
{
|
||||||
return $this->headers->has($name);
|
return $this->headers->has($name);
|
||||||
}
|
}
|
||||||
|
@ -109,7 +110,7 @@ trait MessageTrait
|
||||||
* header. If the header does not appear in the message, this method MUST
|
* header. If the header does not appear in the message, this method MUST
|
||||||
* return an empty array.
|
* return an empty array.
|
||||||
*/
|
*/
|
||||||
public function getHeader($name)
|
public function getHeader(mixed $name)
|
||||||
{
|
{
|
||||||
return $this->headers->all($name);
|
return $this->headers->all($name);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +134,7 @@ trait MessageTrait
|
||||||
* concatenated together using a comma. If the header does not appear in
|
* concatenated together using a comma. If the header does not appear in
|
||||||
* the message, this method MUST return an empty string.
|
* the message, this method MUST return an empty string.
|
||||||
*/
|
*/
|
||||||
public function getHeaderLine($name)
|
public function getHeaderLine(mixed $name)
|
||||||
{
|
{
|
||||||
return implode(',', $this->getHeader($name));
|
return implode(',', $this->getHeader($name));
|
||||||
}
|
}
|
||||||
|
@ -153,7 +154,7 @@ trait MessageTrait
|
||||||
* @return static
|
* @return static
|
||||||
* @throws \InvalidArgumentException for invalid header names or values.
|
* @throws \InvalidArgumentException for invalid header names or values.
|
||||||
*/
|
*/
|
||||||
public function withHeader($name, $value)
|
public function withHeader(mixed $name, mixed $value)
|
||||||
{
|
{
|
||||||
$new = clone $this;
|
$new = clone $this;
|
||||||
$new->headers->set($name, $value);
|
$new->headers->set($name, $value);
|
||||||
|
@ -177,7 +178,7 @@ trait MessageTrait
|
||||||
* @return static
|
* @return static
|
||||||
* @throws \InvalidArgumentException for invalid header names or values.
|
* @throws \InvalidArgumentException for invalid header names or values.
|
||||||
*/
|
*/
|
||||||
public function withAddedHeader($name, $value)
|
public function withAddedHeader(mixed $name, mixed $value)
|
||||||
{
|
{
|
||||||
$new = clone $this;
|
$new = clone $this;
|
||||||
$new->headers->set($name, $value, false);
|
$new->headers->set($name, $value, false);
|
||||||
|
@ -197,7 +198,7 @@ trait MessageTrait
|
||||||
* @param string $name Case-insensitive header field name to remove.
|
* @param string $name Case-insensitive header field name to remove.
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function withoutHeader($name)
|
public function withoutHeader(mixed $name)
|
||||||
{
|
{
|
||||||
$new = clone $this;
|
$new = clone $this;
|
||||||
$new->headers->remove($name);
|
$new->headers->remove($name);
|
||||||
|
|
|
@ -13,11 +13,6 @@ class Redirector
|
||||||
/** @var UrlGeneratorInterface */
|
/** @var UrlGeneratorInterface */
|
||||||
protected $url;
|
protected $url;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Request $request
|
|
||||||
* @param Response $response
|
|
||||||
* @param UrlGeneratorInterface $url
|
|
||||||
*/
|
|
||||||
public function __construct(Request $request, Response $response, UrlGeneratorInterface $url)
|
public function __construct(Request $request, Response $response, UrlGeneratorInterface $url)
|
||||||
{
|
{
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
|
@ -28,8 +23,6 @@ class Redirector
|
||||||
/**
|
/**
|
||||||
* Redirects to a path, generating a full URL
|
* Redirects to a path, generating a full URL
|
||||||
*
|
*
|
||||||
* @param string $path
|
|
||||||
* @param int $status
|
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
@ -39,7 +32,6 @@ class Redirector
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $status
|
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,11 +16,9 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
/**
|
/**
|
||||||
* Get POST input
|
* Get POST input
|
||||||
*
|
*
|
||||||
* @param string $key
|
|
||||||
* @param mixed $default
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function postData($key, $default = null)
|
public function postData(string $key, mixed $default = null)
|
||||||
{
|
{
|
||||||
return $this->request->get($key, $default);
|
return $this->request->get($key, $default);
|
||||||
}
|
}
|
||||||
|
@ -28,11 +26,9 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
/**
|
/**
|
||||||
* Get input data
|
* Get input data
|
||||||
*
|
*
|
||||||
* @param string $key
|
|
||||||
* @param mixed $default
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function input($key, $default = null)
|
public function input(string $key, mixed $default = null)
|
||||||
{
|
{
|
||||||
return $this->get($key, $default);
|
return $this->get($key, $default);
|
||||||
}
|
}
|
||||||
|
@ -40,10 +36,9 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
/**
|
/**
|
||||||
* Checks if the input exists
|
* Checks if the input exists
|
||||||
*
|
*
|
||||||
* @param string $key
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function has($key)
|
public function has(string $key)
|
||||||
{
|
{
|
||||||
$value = $this->input($key);
|
$value = $this->input($key);
|
||||||
|
|
||||||
|
@ -53,10 +48,9 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
/**
|
/**
|
||||||
* Checks if the POST data exists
|
* Checks if the POST data exists
|
||||||
*
|
*
|
||||||
* @param string $key
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasPostData($key)
|
public function hasPostData(string $key)
|
||||||
{
|
{
|
||||||
$value = $this->postData($key);
|
$value = $this->postData($key);
|
||||||
|
|
||||||
|
@ -122,10 +116,9 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
*
|
*
|
||||||
* @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various
|
* @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various
|
||||||
* request-target forms allowed in request messages)
|
* request-target forms allowed in request messages)
|
||||||
* @param mixed $requestTarget
|
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function withRequestTarget($requestTarget)
|
public function withRequestTarget(mixed $requestTarget)
|
||||||
{
|
{
|
||||||
return $this->create($requestTarget);
|
return $this->create($requestTarget);
|
||||||
}
|
}
|
||||||
|
@ -145,7 +138,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
* @return static
|
* @return static
|
||||||
* @throws \InvalidArgumentException for invalid HTTP methods.
|
* @throws \InvalidArgumentException for invalid HTTP methods.
|
||||||
*/
|
*/
|
||||||
public function withMethod($method)
|
public function withMethod(mixed $method)
|
||||||
{
|
{
|
||||||
$new = clone $this;
|
$new = clone $this;
|
||||||
$new->setMethod($method);
|
$new->setMethod($method);
|
||||||
|
@ -183,7 +176,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
* @param bool $preserveHost Preserve the original state of the Host header.
|
* @param bool $preserveHost Preserve the original state of the Host header.
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function withUri(UriInterface $uri, $preserveHost = false)
|
public function withUri(UriInterface $uri, mixed $preserveHost = false)
|
||||||
{
|
{
|
||||||
$new = $this->create($uri);
|
$new = $this->create($uri);
|
||||||
if ($preserveHost) {
|
if ($preserveHost) {
|
||||||
|
@ -409,7 +402,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
* @throws \InvalidArgumentException if an unsupported argument type is
|
* @throws \InvalidArgumentException if an unsupported argument type is
|
||||||
* provided.
|
* provided.
|
||||||
*/
|
*/
|
||||||
public function withParsedBody($data)
|
public function withParsedBody(mixed $data)
|
||||||
{
|
{
|
||||||
$new = clone $this;
|
$new = clone $this;
|
||||||
$new->request = clone $this->request;
|
$new->request = clone $this->request;
|
||||||
|
@ -450,7 +443,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @see getAttributes()
|
* @see getAttributes()
|
||||||
*/
|
*/
|
||||||
public function getAttribute($name, $default = null)
|
public function getAttribute(mixed $name, mixed $default = null)
|
||||||
{
|
{
|
||||||
return $this->attributes->get($name, $default);
|
return $this->attributes->get($name, $default);
|
||||||
}
|
}
|
||||||
|
@ -470,7 +463,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
* @return static
|
* @return static
|
||||||
* @see getAttributes()
|
* @see getAttributes()
|
||||||
*/
|
*/
|
||||||
public function withAttribute($name, $value)
|
public function withAttribute(mixed $name, mixed $value)
|
||||||
{
|
{
|
||||||
$new = clone $this;
|
$new = clone $this;
|
||||||
$new->attributes = clone $this->attributes;
|
$new->attributes = clone $this->attributes;
|
||||||
|
@ -494,7 +487,7 @@ class Request extends SymfonyRequest implements ServerRequestInterface
|
||||||
* @return static
|
* @return static
|
||||||
* @see getAttributes()
|
* @see getAttributes()
|
||||||
*/
|
*/
|
||||||
public function withoutAttribute($name)
|
public function withoutAttribute(mixed $name)
|
||||||
{
|
{
|
||||||
$new = clone $this;
|
$new = clone $this;
|
||||||
$new->attributes = clone $this->attributes;
|
$new->attributes = clone $this->attributes;
|
||||||
|
|
|
@ -53,7 +53,7 @@ class RequestServiceProvider extends ServiceProvider
|
||||||
array $cookies = [],
|
array $cookies = [],
|
||||||
array $files = [],
|
array $files = [],
|
||||||
array $server = [],
|
array $server = [],
|
||||||
$content = null
|
mixed $content = null
|
||||||
): Request {
|
): Request {
|
||||||
if (
|
if (
|
||||||
!empty($this->appUrl['path'])
|
!empty($this->appUrl['path'])
|
||||||
|
@ -81,15 +81,13 @@ class RequestServiceProvider extends ServiceProvider
|
||||||
*
|
*
|
||||||
* Required for unit tests (static methods can't be mocked)
|
* Required for unit tests (static methods can't be mocked)
|
||||||
*
|
*
|
||||||
* @param Request $request
|
|
||||||
* @param array $proxies
|
* @param array $proxies
|
||||||
* @param int $trustedHeadersSet
|
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
protected function setTrustedProxies(
|
protected function setTrustedProxies(
|
||||||
$request,
|
Request $request,
|
||||||
$proxies,
|
array $proxies,
|
||||||
$trustedHeadersSet = Request::HEADER_FORWARDED | Request::HEADER_X_FORWARDED_TRAEFIK
|
int $trustedHeadersSet = Request::HEADER_FORWARDED | Request::HEADER_X_FORWARDED_TRAEFIK
|
||||||
) {
|
) {
|
||||||
$request->setTrustedProxies($proxies, $trustedHeadersSet);
|
$request->setTrustedProxies($proxies, $trustedHeadersSet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,10 @@ class Response extends SymfonyResponse implements ResponseInterface
|
||||||
protected $renderer;
|
protected $renderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $content
|
|
||||||
* @param int $status
|
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
* @param Renderer $renderer
|
|
||||||
* @param SessionInterface $session
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
$content = '',
|
string $content = '',
|
||||||
int $status = 200,
|
int $status = 200,
|
||||||
array $headers = [],
|
array $headers = [],
|
||||||
Renderer $renderer = null,
|
Renderer $renderer = null,
|
||||||
|
@ -60,7 +56,7 @@ class Response extends SymfonyResponse implements ResponseInterface
|
||||||
* @return static
|
* @return static
|
||||||
* @throws InvalidArgumentException For invalid status code arguments.
|
* @throws InvalidArgumentException For invalid status code arguments.
|
||||||
*/
|
*/
|
||||||
public function withStatus($code, $reasonPhrase = '')
|
public function withStatus(mixed $code, mixed $reasonPhrase = '')
|
||||||
{
|
{
|
||||||
$new = clone $this;
|
$new = clone $this;
|
||||||
$new->setStatusCode($code, !empty($reasonPhrase) ? $reasonPhrase : null);
|
$new->setStatusCode($code, !empty($reasonPhrase) ? $reasonPhrase : null);
|
||||||
|
@ -96,7 +92,7 @@ class Response extends SymfonyResponse implements ResponseInterface
|
||||||
* @param mixed $content Content that can be cast to string
|
* @param mixed $content Content that can be cast to string
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function withContent($content)
|
public function withContent(mixed $content)
|
||||||
{
|
{
|
||||||
$new = clone $this;
|
$new = clone $this;
|
||||||
$new->setContent($content);
|
$new->setContent($content);
|
||||||
|
@ -110,13 +106,11 @@ class Response extends SymfonyResponse implements ResponseInterface
|
||||||
* This method retains the immutability of the message and returns
|
* This method retains the immutability of the message and returns
|
||||||
* an instance with the updated status and headers
|
* an instance with the updated status and headers
|
||||||
*
|
*
|
||||||
* @param string $view
|
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param int $status
|
|
||||||
* @param string[]|string[][] $headers
|
* @param string[]|string[][] $headers
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function withView($view, $data = [], $status = 200, $headers = [])
|
public function withView(string $view, array $data = [], int $status = 200, array $headers = [])
|
||||||
{
|
{
|
||||||
if (!$this->renderer instanceof Renderer) {
|
if (!$this->renderer instanceof Renderer) {
|
||||||
throw new InvalidArgumentException('Renderer not defined');
|
throw new InvalidArgumentException('Renderer not defined');
|
||||||
|
@ -139,12 +133,10 @@ class Response extends SymfonyResponse implements ResponseInterface
|
||||||
* This method retains the immutability of the message and returns
|
* This method retains the immutability of the message and returns
|
||||||
* an instance with the updated status and headers
|
* an instance with the updated status and headers
|
||||||
*
|
*
|
||||||
* @param string $path
|
|
||||||
* @param int $status
|
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function redirectTo($path, $status = 302, $headers = [])
|
public function redirectTo(string $path, int $status = 302, array $headers = [])
|
||||||
{
|
{
|
||||||
$response = $this->withStatus($status);
|
$response = $this->withStatus($status);
|
||||||
$response = $response->withHeader('location', $path);
|
$response = $response->withHeader('location', $path);
|
||||||
|
@ -159,7 +151,6 @@ class Response extends SymfonyResponse implements ResponseInterface
|
||||||
/**
|
/**
|
||||||
* Set the renderer to use
|
* Set the renderer to use
|
||||||
*
|
*
|
||||||
* @param Renderer $renderer
|
|
||||||
*/
|
*/
|
||||||
public function setRenderer(Renderer $renderer)
|
public function setRenderer(Renderer $renderer)
|
||||||
{
|
{
|
||||||
|
@ -169,11 +160,9 @@ class Response extends SymfonyResponse implements ResponseInterface
|
||||||
/**
|
/**
|
||||||
* Sets a session attribute (which is mutable)
|
* Sets a session attribute (which is mutable)
|
||||||
*
|
*
|
||||||
* @param string $key
|
|
||||||
* @param mixed|mixed[] $value
|
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function with(string $key, $value)
|
public function with(string $key, mixed $value)
|
||||||
{
|
{
|
||||||
if (!$this->session instanceof SessionInterface) {
|
if (!$this->session instanceof SessionInterface) {
|
||||||
throw new InvalidArgumentException('Session not defined');
|
throw new InvalidArgumentException('Session not defined');
|
||||||
|
|
|
@ -12,7 +12,6 @@ class UrlGenerator implements UrlGeneratorInterface
|
||||||
/**
|
/**
|
||||||
* Create a URL for the given path, using the applications base url if configured
|
* Create a URL for the given path, using the applications base url if configured
|
||||||
*
|
*
|
||||||
* @param string $path
|
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return string url in the form [app url]/[path]?[parameters]
|
* @return string url in the form [app url]/[path]?[parameters]
|
||||||
*/
|
*/
|
||||||
|
@ -35,7 +34,6 @@ class UrlGenerator implements UrlGeneratorInterface
|
||||||
/**
|
/**
|
||||||
* Check if the URL is valid
|
* Check if the URL is valid
|
||||||
*
|
*
|
||||||
* @param string $path
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isValidUrl(string $path): bool
|
public function isValidUrl(string $path): bool
|
||||||
|
|
|
@ -8,7 +8,6 @@ namespace Engelsystem\Http;
|
||||||
interface UrlGeneratorInterface
|
interface UrlGeneratorInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $path
|
|
||||||
* @param array $parameters
|
* @param array $parameters
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,7 +6,7 @@ use Respect\Validation\Rules\AbstractRule;
|
||||||
|
|
||||||
class Checked extends AbstractRule
|
class Checked extends AbstractRule
|
||||||
{
|
{
|
||||||
public function validate($input)
|
public function validate(mixed $input)
|
||||||
{
|
{
|
||||||
return in_array($input, ['yes', 'on', 1, '1', 'true', true], true);
|
return in_array($input, ['yes', 'on', 1, '1', 'true', true], true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,7 @@ use Respect\Validation\Rules\In as RespectIn;
|
||||||
|
|
||||||
class In extends RespectIn
|
class In extends RespectIn
|
||||||
{
|
{
|
||||||
/**
|
public function __construct(mixed $haystack, bool $compareIdentical = false)
|
||||||
* @param mixed $haystack
|
|
||||||
* @param bool $compareIdentical
|
|
||||||
*/
|
|
||||||
public function __construct($haystack, $compareIdentical = false)
|
|
||||||
{
|
{
|
||||||
if (!is_array($haystack)) {
|
if (!is_array($haystack)) {
|
||||||
$haystack = explode(',', $haystack);
|
$haystack = explode(',', $haystack);
|
||||||
|
|
|
@ -5,10 +5,9 @@ namespace Engelsystem\Http\Validation\Rules;
|
||||||
class NotIn extends In
|
class NotIn extends In
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param mixed $input
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function validate($input)
|
public function validate(mixed $input)
|
||||||
{
|
{
|
||||||
return !parent::validate($input);
|
return !parent::validate($input);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,9 @@ trait StringInputLength
|
||||||
/**
|
/**
|
||||||
* Use the input length of a string
|
* Use the input length of a string
|
||||||
*
|
*
|
||||||
* @param mixed $input
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function validate($input): bool
|
public function validate(mixed $input): bool
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
is_string($input)
|
is_string($input)
|
||||||
|
@ -28,10 +27,9 @@ trait StringInputLength
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $input
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function isDateTime($input): bool
|
protected function isDateTime(mixed $input): bool
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
new DateTime($input);
|
new DateTime($input);
|
||||||
|
|
|
@ -11,7 +11,6 @@ trait ValidatesRequest
|
||||||
protected $validator;
|
protected $validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
|
||||||
* @param array $rules
|
* @param array $rules
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -29,9 +28,6 @@ trait ValidatesRequest
|
||||||
return $this->validator->getData();
|
return $this->validator->getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Validator $validator
|
|
||||||
*/
|
|
||||||
public function setValidator(Validator $validator)
|
public function setValidator(Validator $validator)
|
||||||
{
|
{
|
||||||
$this->validator = $validator;
|
$this->validator = $validator;
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Validator
|
||||||
* @param array $rules
|
* @param array $rules
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function validate($data, $rules)
|
public function validate(array $data, array $rules)
|
||||||
{
|
{
|
||||||
$this->errors = [];
|
$this->errors = [];
|
||||||
$this->data = [];
|
$this->data = [];
|
||||||
|
@ -86,19 +86,17 @@ class Validator
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $rule
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function map($rule)
|
protected function map(string $rule)
|
||||||
{
|
{
|
||||||
return $this->mapping[$rule] ?? $rule;
|
return $this->mapping[$rule] ?? $rule;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $rule
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function mapBack($rule)
|
protected function mapBack(string $rule)
|
||||||
{
|
{
|
||||||
$mapping = array_flip($this->mapping);
|
$mapping = array_flip($this->mapping);
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,6 @@ class Logger extends AbstractLogger
|
||||||
/** @var LogEntry */
|
/** @var LogEntry */
|
||||||
protected $log;
|
protected $log;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param LogEntry $log
|
|
||||||
*/
|
|
||||||
public function __construct(LogEntry $log)
|
public function __construct(LogEntry $log)
|
||||||
{
|
{
|
||||||
$this->log = $log;
|
$this->log = $log;
|
||||||
|
@ -36,12 +33,10 @@ class Logger extends AbstractLogger
|
||||||
/**
|
/**
|
||||||
* Logs with an arbitrary level.
|
* Logs with an arbitrary level.
|
||||||
*
|
*
|
||||||
* @param mixed $level
|
|
||||||
* @param string|Stringable $message
|
|
||||||
* @param array $context
|
* @param array $context
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function log($level, string|Stringable $message, array $context = []): void
|
public function log(mixed $level, string|Stringable $message, array $context = []): void
|
||||||
{
|
{
|
||||||
if (!$this->checkLevel($level)) {
|
if (!$this->checkLevel($level)) {
|
||||||
throw new InvalidArgumentException('Unknown log level: ' . $level);
|
throw new InvalidArgumentException('Unknown log level: ' . $level);
|
||||||
|
@ -59,11 +54,10 @@ class Logger extends AbstractLogger
|
||||||
/**
|
/**
|
||||||
* Interpolates context values into the message placeholders.
|
* Interpolates context values into the message placeholders.
|
||||||
*
|
*
|
||||||
* @param string $message
|
|
||||||
* @param array $context
|
* @param array $context
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function interpolate($message, array $context = []): string
|
protected function interpolate(string $message, array $context = []): string
|
||||||
{
|
{
|
||||||
foreach ($context as $key => $val) {
|
foreach ($context as $key => $val) {
|
||||||
// check that the value can be casted to string
|
// check that the value can be casted to string
|
||||||
|
@ -79,7 +73,6 @@ class Logger extends AbstractLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Throwable $e
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function formatException(Throwable $e): string
|
protected function formatException(Throwable $e): string
|
||||||
|
@ -95,10 +88,9 @@ class Logger extends AbstractLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $level
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function checkLevel($level): bool
|
protected function checkLevel(string $level): bool
|
||||||
{
|
{
|
||||||
return in_array($level, $this->allowedLevels);
|
return in_array($level, $this->allowedLevels);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,13 +14,11 @@ class UserAwareLogger extends Logger
|
||||||
/**
|
/**
|
||||||
* Logs with an arbitrary level and prepends the user
|
* Logs with an arbitrary level and prepends the user
|
||||||
*
|
*
|
||||||
* @param mixed $level
|
|
||||||
* @param string|Stringable $message
|
|
||||||
* @param array $context
|
* @param array $context
|
||||||
*
|
*
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function log($level, string|Stringable $message, array $context = []): void
|
public function log(mixed $level, string|Stringable $message, array $context = []): void
|
||||||
{
|
{
|
||||||
if ($this->auth && ($user = $this->auth->user())) {
|
if ($this->auth && ($user = $this->auth->user())) {
|
||||||
$message = sprintf('%s (%u): %s', $user->name, $user->id, $message);
|
$message = sprintf('%s (%u): %s', $user->name, $user->id, $message);
|
||||||
|
@ -29,9 +27,6 @@ class UserAwareLogger extends Logger
|
||||||
parent::log($level, $message, $context);
|
parent::log($level, $message, $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Authenticator $auth
|
|
||||||
*/
|
|
||||||
public function setAuth(Authenticator $auth): void
|
public function setAuth(Authenticator $auth): void
|
||||||
{
|
{
|
||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
|
|
|
@ -19,7 +19,6 @@ class EngelsystemMailer extends Mailer
|
||||||
protected $subjectPrefix = null;
|
protected $subjectPrefix = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param MailerInterface $mailer
|
|
||||||
* @param Renderer|null $view
|
* @param Renderer|null $view
|
||||||
* @param Translator|null $translation
|
* @param Translator|null $translation
|
||||||
*/
|
*/
|
||||||
|
@ -33,13 +32,10 @@ class EngelsystemMailer extends Mailer
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|string[]|User $to
|
* @param string|string[]|User $to
|
||||||
* @param string $subject
|
|
||||||
* @param string $template
|
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param string|null $locale
|
|
||||||
*/
|
*/
|
||||||
public function sendViewTranslated(
|
public function sendViewTranslated(
|
||||||
$to,
|
string|array|User $to,
|
||||||
string $subject,
|
string $subject,
|
||||||
string $template,
|
string $template,
|
||||||
array $data = [],
|
array $data = [],
|
||||||
|
@ -72,11 +68,9 @@ class EngelsystemMailer extends Mailer
|
||||||
* Send a template
|
* Send a template
|
||||||
*
|
*
|
||||||
* @param string|string[] $to
|
* @param string|string[] $to
|
||||||
* @param string $subject
|
|
||||||
* @param string $template
|
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*/
|
*/
|
||||||
public function sendView($to, string $subject, string $template, array $data = []): void
|
public function sendView(string|array $to, string $subject, string $template, array $data = []): void
|
||||||
{
|
{
|
||||||
$body = $this->view->render($template, $data);
|
$body = $this->view->render($template, $data);
|
||||||
|
|
||||||
|
@ -87,10 +81,8 @@ class EngelsystemMailer extends Mailer
|
||||||
* Send the mail
|
* Send the mail
|
||||||
*
|
*
|
||||||
* @param string|string[] $to
|
* @param string|string[] $to
|
||||||
* @param string $subject
|
|
||||||
* @param string $body
|
|
||||||
*/
|
*/
|
||||||
public function send($to, string $subject, string $body): void
|
public function send(string|array $to, string $subject, string $body): void
|
||||||
{
|
{
|
||||||
if ($this->subjectPrefix) {
|
if ($this->subjectPrefix) {
|
||||||
$subject = sprintf('[%s] %s', $this->subjectPrefix, trim($subject));
|
$subject = sprintf('[%s] %s', $this->subjectPrefix, trim($subject));
|
||||||
|
@ -107,9 +99,6 @@ class EngelsystemMailer extends Mailer
|
||||||
return $this->subjectPrefix;
|
return $this->subjectPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $subjectPrefix
|
|
||||||
*/
|
|
||||||
public function setSubjectPrefix(string $subjectPrefix)
|
public function setSubjectPrefix(string $subjectPrefix)
|
||||||
{
|
{
|
||||||
$this->subjectPrefix = $subjectPrefix;
|
$this->subjectPrefix = $subjectPrefix;
|
||||||
|
|
|
@ -25,10 +25,8 @@ class Mailer
|
||||||
* Send the mail
|
* Send the mail
|
||||||
*
|
*
|
||||||
* @param string|string[] $to
|
* @param string|string[] $to
|
||||||
* @param string $subject
|
|
||||||
* @param string $body
|
|
||||||
*/
|
*/
|
||||||
public function send($to, string $subject, string $body): void
|
public function send(string|array $to, string $subject, string $body): void
|
||||||
{
|
{
|
||||||
$message = (new Email())
|
$message = (new Email())
|
||||||
->to(...(array)$to)
|
->to(...(array)$to)
|
||||||
|
@ -47,9 +45,6 @@ class Mailer
|
||||||
return $this->fromAddress;
|
return $this->fromAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $fromAddress
|
|
||||||
*/
|
|
||||||
public function setFromAddress(string $fromAddress)
|
public function setFromAddress(string $fromAddress)
|
||||||
{
|
{
|
||||||
$this->fromAddress = $fromAddress;
|
$this->fromAddress = $fromAddress;
|
||||||
|
@ -63,9 +58,6 @@ class Mailer
|
||||||
return $this->fromName;
|
return $this->fromName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $fromName
|
|
||||||
*/
|
|
||||||
public function setFromName(string $fromName)
|
public function setFromName(string $fromName)
|
||||||
{
|
{
|
||||||
$this->fromName = $fromName;
|
$this->fromName = $fromName;
|
||||||
|
|
|
@ -45,11 +45,10 @@ class MailerServiceProvider extends ServiceProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|null $transport
|
|
||||||
* @param array $config
|
* @param array $config
|
||||||
* @return TransportInterface
|
* @return TransportInterface
|
||||||
*/
|
*/
|
||||||
protected function getTransport($transport, $config)
|
protected function getTransport(?string $transport, array $config)
|
||||||
{
|
{
|
||||||
switch ($transport) {
|
switch ($transport) {
|
||||||
case 'log':
|
case 'log':
|
||||||
|
|
|
@ -21,7 +21,6 @@ class LogTransport extends AbstractTransport
|
||||||
/**
|
/**
|
||||||
* Send the message to log
|
* Send the message to log
|
||||||
*
|
*
|
||||||
* @param SentMessage $message
|
|
||||||
*/
|
*/
|
||||||
protected function doSend(SentMessage $message): void
|
protected function doSend(SentMessage $message): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,9 +13,6 @@ class AddHeaders implements MiddlewareInterface
|
||||||
/** @var Config */
|
/** @var Config */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Config $config
|
|
||||||
*/
|
|
||||||
public function __construct(Config $config)
|
public function __construct(Config $config)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
@ -24,8 +21,6 @@ class AddHeaders implements MiddlewareInterface
|
||||||
/**
|
/**
|
||||||
* Process an incoming server request and setting the locale if required
|
* Process an incoming server request and setting the locale if required
|
||||||
*
|
*
|
||||||
* @param ServerRequestInterface $request
|
|
||||||
* @param RequestHandlerInterface $handler
|
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
*/
|
*/
|
||||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||||
|
|
|
@ -20,7 +20,6 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param callable $callable The callable that should be wrapped
|
* @param callable $callable The callable that should be wrapped
|
||||||
* @param Container $container
|
|
||||||
*/
|
*/
|
||||||
public function __construct(callable $callable, Container $container = null)
|
public function __construct(callable $callable, Container $container = null)
|
||||||
{
|
{
|
||||||
|
@ -32,8 +31,6 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface
|
||||||
* Process an incoming server request and return a response, optionally delegating
|
* Process an incoming server request and return a response, optionally delegating
|
||||||
* response creation to a handler.
|
* response creation to a handler.
|
||||||
*
|
*
|
||||||
* @param ServerRequestInterface $request
|
|
||||||
* @param RequestHandlerInterface $handler
|
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
*/
|
*/
|
||||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||||
|
@ -44,7 +41,6 @@ class CallableHandler implements MiddlewareInterface, RequestHandlerInterface
|
||||||
/**
|
/**
|
||||||
* Handle the request and return a response.
|
* Handle the request and return a response.
|
||||||
*
|
*
|
||||||
* @param ServerRequestInterface $request
|
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
*/
|
*/
|
||||||
public function handle(ServerRequestInterface $request): ResponseInterface
|
public function handle(ServerRequestInterface $request): ResponseInterface
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface
|
||||||
* @param MiddlewareInterface[]|string[] $stack
|
* @param MiddlewareInterface[]|string[] $stack
|
||||||
* @param Application|null $container
|
* @param Application|null $container
|
||||||
*/
|
*/
|
||||||
public function __construct($stack = [], Application $container = null)
|
public function __construct(array $stack = [], Application $container = null)
|
||||||
{
|
{
|
||||||
$this->stack = $stack;
|
$this->stack = $stack;
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
|
@ -39,8 +39,6 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface
|
||||||
*
|
*
|
||||||
* Could be used to group middleware
|
* Could be used to group middleware
|
||||||
*
|
*
|
||||||
* @param ServerRequestInterface $request
|
|
||||||
* @param RequestHandlerInterface $handler
|
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
*/
|
*/
|
||||||
public function process(
|
public function process(
|
||||||
|
@ -57,7 +55,6 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface
|
||||||
*
|
*
|
||||||
* It calls all configured middleware and handles their response
|
* It calls all configured middleware and handles their response
|
||||||
*
|
*
|
||||||
* @param ServerRequestInterface $request
|
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
*/
|
*/
|
||||||
public function handle(ServerRequestInterface $request): ResponseInterface
|
public function handle(ServerRequestInterface $request): ResponseInterface
|
||||||
|
@ -80,9 +77,6 @@ class Dispatcher implements MiddlewareInterface, RequestHandlerInterface
|
||||||
return $middleware->process($request, $this);
|
return $middleware->process($request, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Application $container
|
|
||||||
*/
|
|
||||||
public function setContainer(Application $container)
|
public function setContainer(Application $container)
|
||||||
{
|
{
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
|
|
|
@ -38,9 +38,6 @@ class ErrorHandler implements MiddlewareInterface
|
||||||
'_token',
|
'_token',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TwigLoader $loader
|
|
||||||
*/
|
|
||||||
public function __construct(TwigLoader $loader)
|
public function __construct(TwigLoader $loader)
|
||||||
{
|
{
|
||||||
$this->loader = $loader;
|
$this->loader = $loader;
|
||||||
|
@ -51,8 +48,6 @@ class ErrorHandler implements MiddlewareInterface
|
||||||
*
|
*
|
||||||
* Should be added at the beginning
|
* Should be added at the beginning
|
||||||
*
|
*
|
||||||
* @param ServerRequestInterface $request
|
|
||||||
* @param RequestHandlerInterface $handler
|
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
*/
|
*/
|
||||||
public function process(
|
public function process(
|
||||||
|
@ -105,7 +100,6 @@ class ErrorHandler implements MiddlewareInterface
|
||||||
/**
|
/**
|
||||||
* Select a view based on the given status code
|
* Select a view based on the given status code
|
||||||
*
|
*
|
||||||
* @param int $statusCode
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function selectView(int $statusCode): string
|
protected function selectView(int $statusCode): string
|
||||||
|
@ -125,8 +119,6 @@ class ErrorHandler implements MiddlewareInterface
|
||||||
/**
|
/**
|
||||||
* Create a new response
|
* Create a new response
|
||||||
*
|
*
|
||||||
* @param string $content
|
|
||||||
* @param int $status
|
|
||||||
* @param array $headers
|
* @param array $headers
|
||||||
* @return Response
|
* @return Response
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
|
|
|
@ -15,9 +15,6 @@ class ExceptionHandler implements MiddlewareInterface
|
||||||
/** @var ContainerInterface */
|
/** @var ContainerInterface */
|
||||||
protected $container;
|
protected $container;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ContainerInterface $container
|
|
||||||
*/
|
|
||||||
public function __construct(ContainerInterface $container)
|
public function __construct(ContainerInterface $container)
|
||||||
{
|
{
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
|
@ -28,8 +25,6 @@ class ExceptionHandler implements MiddlewareInterface
|
||||||
*
|
*
|
||||||
* Should be added at the beginning
|
* Should be added at the beginning
|
||||||
*
|
*
|
||||||
* @param ServerRequestInterface $request
|
|
||||||
* @param RequestHandlerInterface $handler
|
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
*/
|
*/
|
||||||
public function process(
|
public function process(
|
||||||
|
|
|
@ -35,10 +35,6 @@ class LegacyMiddleware implements MiddlewareInterface
|
||||||
/** @var Authenticator */
|
/** @var Authenticator */
|
||||||
protected $auth;
|
protected $auth;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ContainerInterface $container
|
|
||||||
* @param Authenticator $auth
|
|
||||||
*/
|
|
||||||
public function __construct(ContainerInterface $container, Authenticator $auth)
|
public function __construct(ContainerInterface $container, Authenticator $auth)
|
||||||
{
|
{
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
|
@ -50,8 +46,6 @@ class LegacyMiddleware implements MiddlewareInterface
|
||||||
*
|
*
|
||||||
* Should be used before a 404 is send
|
* Should be used before a 404 is send
|
||||||
*
|
*
|
||||||
* @param ServerRequestInterface $request
|
|
||||||
* @param RequestHandlerInterface $handler
|
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
*/
|
*/
|
||||||
public function process(
|
public function process(
|
||||||
|
@ -89,11 +83,10 @@ class LegacyMiddleware implements MiddlewareInterface
|
||||||
/**
|
/**
|
||||||
* Get the legacy page content and title
|
* Get the legacy page content and title
|
||||||
*
|
*
|
||||||
* @param string $page
|
|
||||||
* @return array ['title', 'content']
|
* @return array ['title', 'content']
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
protected function loadPage($page)
|
protected function loadPage(string $page)
|
||||||
{
|
{
|
||||||
switch ($page) {
|
switch ($page) {
|
||||||
case 'ical':
|
case 'ical':
|
||||||
|
@ -182,13 +175,10 @@ class LegacyMiddleware implements MiddlewareInterface
|
||||||
/**
|
/**
|
||||||
* Render the template
|
* Render the template
|
||||||
*
|
*
|
||||||
* @param string $page
|
|
||||||
* @param string $title
|
|
||||||
* @param string $content
|
|
||||||
* @return Response
|
* @return Response
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
protected function renderPage($page, $title, $content)
|
protected function renderPage(string $page, string $title, string $content)
|
||||||
{
|
{
|
||||||
if (!empty($page) && is_int($page)) {
|
if (!empty($page) && is_int($page)) {
|
||||||
return response($content, (int)$page);
|
return response($content, (int)$page);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue