chore: composer run cs:fix

Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
This commit is contained in:
Richard Steinmetz 2023-04-19 10:18:28 +02:00
parent 8ba654048f
commit b28ab94c1b
No known key found for this signature in database
GPG Key ID: 27137D9E7D273FB2
29 changed files with 143 additions and 143 deletions

View File

@ -41,8 +41,8 @@ class CleanUpOutdatedBookingsJob extends TimedJob {
private $service;
public function __construct(ITimeFactory $time,
BookingService $service,
LoggerInterface $logger) {
BookingService $service,
LoggerInterface $logger) {
parent::__construct($time);
$this->service = $service;
$this->logger = $logger;

View File

@ -52,9 +52,9 @@ class AppointmentConfigController extends Controller {
private $logger;
public function __construct(IRequest $request,
AppointmentConfigService $appointmentService,
LoggerInterface $logger,
?string $userId) {
AppointmentConfigService $appointmentService,
LoggerInterface $logger,
?string $userId) {
parent::__construct(Application::APP_ID, $request);
$this->appointmentConfigService = $appointmentService;
$this->userId = $userId;

View File

@ -53,11 +53,11 @@ class AppointmentController extends Controller {
private $userId;
public function __construct(IRequest $request,
IUserManager $userManager,
AppointmentConfigService $configService,
IInitialState $initialState,
?string $userId
) {
IUserManager $userManager,
AppointmentConfigService $configService,
IInitialState $initialState,
?string $userId
) {
parent::__construct(Application::APP_ID, $request);
$this->userManager = $userManager;

View File

@ -71,15 +71,15 @@ class BookingController extends Controller {
private IConfig $systemConfig;
public function __construct(string $appName,
IRequest $request,
ITimeFactory $timeFactory,
IInitialState $initialState,
BookingService $bookingService,
AppointmentConfigService $appointmentConfigService,
URLGenerator $urlGenerator,
LoggerInterface $logger,
IMailer $mailer,
IConfig $systemConfig) {
IRequest $request,
ITimeFactory $timeFactory,
IInitialState $initialState,
BookingService $bookingService,
AppointmentConfigService $appointmentConfigService,
URLGenerator $urlGenerator,
LoggerInterface $logger,
IMailer $mailer,
IConfig $systemConfig) {
parent::__construct($appName, $request);
$this->bookingService = $bookingService;
@ -103,8 +103,8 @@ class BookingController extends Controller {
* @return JsonResponse
*/
public function getBookableSlots(int $appointmentConfigId,
int $startTime,
string $timeZone): JsonResponse {
int $startTime,
string $timeZone): JsonResponse {
// Convert the timestamps to the beginning and end of the respective day in the specified timezone
try {
$tz = new DateTimeZone($timeZone);
@ -164,12 +164,12 @@ class BookingController extends Controller {
* @return JsonResponse
*/
public function bookSlot(int $appointmentConfigId,
int $start,
int $end,
string $displayName,
string $email,
string $description,
string $timeZone): JsonResponse {
int $start,
int $end,
string $displayName,
string $email,
string $description,
string $timeZone): JsonResponse {
if (!$this->mailer->validateMailAddress($email)) {
return JsonResponse::fail('Invalid email address', Http::STATUS_UNPROCESSABLE_ENTITY);
}

View File

@ -51,8 +51,8 @@ class ContactController extends Controller {
* @param IManager $contacts
*/
public function __construct(string $appName,
IRequest $request,
IManager $contacts) {
IRequest $request,
IManager $contacts) {
parent::__construct($appName, $request);
$this->contactsManager = $contacts;
}

View File

@ -75,13 +75,13 @@ class EmailController extends Controller {
* @param IURLGenerator $urlGenerator
*/
public function __construct(string $appName,
IRequest $request,
IUserSession $userSession,
IConfig $config,
IMailer $mailer,
IL10N $l10N,
Defaults $defaults,
IURLGenerator $urlGenerator) {
IRequest $request,
IUserSession $userSession,
IConfig $config,
IMailer $mailer,
IL10N $l10N,
Defaults $defaults,
IURLGenerator $urlGenerator) {
parent::__construct($appName, $request);
$this->config = $config;
$this->userSession = $userSession;
@ -102,8 +102,8 @@ class EmailController extends Controller {
* @NoAdminRequired
*/
public function sendEmailPublicLink(string $recipient,
string $token,
string $calendarName):JSONResponse {
string $token,
string $calendarName):JSONResponse {
$user = $this->userSession->getUser();
if (!$user) {
return new JSONResponse([
@ -159,8 +159,8 @@ class EmailController extends Controller {
* @return IMessage
*/
private function createMessage(string $from,
array $recipients,
IEMailTemplate $template):IMessage {
array $recipients,
IEMailTemplate $template):IMessage {
$message = $this->mailer->createMessage();
$message->setFrom([$from => $this->defaults->getName()]);
$message->setTo($recipients);
@ -177,9 +177,9 @@ class EmailController extends Controller {
* @return IEMailTemplate
*/
private function createTemplate(string $subject,
string $displayName,
string $calendarName,
string $token):IEMailTemplate {
string $displayName,
string $calendarName,
string $token):IEMailTemplate {
$url = $this->getURLFromToken($token);
$emailTemplate = $this->mailer->createEMailTemplate('calendar.PublicShareNotification', [
'displayname' => $displayName,

View File

@ -63,10 +63,10 @@ class PublicViewController extends Controller {
* @param IURLGenerator $urlGenerator
*/
public function __construct(string $appName,
IRequest $request,
IConfig $config,
IInitialStateService $initialStateService,
IURLGenerator $urlGenerator) {
IRequest $request,
IConfig $config,
IInitialStateService $initialStateService,
IURLGenerator $urlGenerator) {
parent::__construct($appName, $request);
$this->config = $config;
$this->initialStateService = $initialStateService;
@ -118,7 +118,7 @@ class PublicViewController extends Controller {
* @return TemplateResponse
*/
private function publicIndex(string $token,
string $renderAs):TemplateResponse {
string $renderAs):TemplateResponse {
$defaultEventLimit = $this->config->getAppValue($this->appName, 'eventLimit', 'yes');
$defaultInitialView = $this->config->getAppValue($this->appName, 'currentView', 'dayGridMonth');
$defaultShowWeekends = $this->config->getAppValue($this->appName, 'showWeekends', 'yes');

View File

@ -24,8 +24,8 @@ declare(strict_types=1);
namespace OCA\Calendar\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IConfig;
use OCP\IRequest;
@ -50,9 +50,9 @@ class SettingsController extends Controller {
* @param string $userId
*/
public function __construct(string $appName,
IRequest $request,
IConfig $config,
string $userId) {
IRequest $request,
IConfig $config,
string $userId) {
parent::__construct($appName, $request);
$this->config = $config;
$this->userId = $userId;
@ -68,7 +68,7 @@ class SettingsController extends Controller {
* @return JSONResponse
*/
public function setConfig(string $key,
string $value):JSONResponse {
string $value):JSONResponse {
switch ($key) {
case 'view':
return $this->setView($value);

View File

@ -56,13 +56,13 @@ class ViewController extends Controller {
private IAppData $appData;
public function __construct(string $appName,
IRequest $request,
IConfig $config,
AppointmentConfigService $appointmentConfigService,
IInitialState $initialStateService,
IAppManager $appManager,
?string $userId,
IAppData $appData) {
IRequest $request,
IConfig $config,
AppointmentConfigService $appointmentConfigService,
IInitialState $initialStateService,
IAppManager $appManager,
?string $userId,
IAppData $appData) {
parent::__construct($appName, $request);
$this->config = $config;
$this->appointmentConfigService = $appointmentConfigService;

View File

@ -65,12 +65,12 @@ class CalendarWidget implements IAPIWidget, IButtonWidget, IIconWidget, IOptionW
* @param IManager $calendarManager
*/
public function __construct(IL10N $l10n,
IInitialState $initialStateService,
JSDataService $dataService,
IDateTimeFormatter $dateTimeFormatter,
IURLGenerator $urlGenerator,
IManager $calendarManager,
ITimeFactory $timeFactory) {
IInitialState $initialStateService,
JSDataService $dataService,
IDateTimeFormatter $dateTimeFormatter,
IURLGenerator $urlGenerator,
IManager $calendarManager,
ITimeFactory $timeFactory) {
$this->l10n = $l10n;
$this->initialStateService = $initialStateService;
$this->dataService = $dataService;

View File

@ -33,9 +33,9 @@ class ClientException extends Exception {
private $httpCode;
public function __construct($message = "",
$code = 0,
Throwable $previous = null,
int $httpCode = null) {
$code = 0,
Throwable $previous = null,
int $httpCode = null) {
parent::__construct($message, $code, $previous);
$this->httpCode = $httpCode;
}

View File

@ -31,9 +31,9 @@ class ServiceException extends Exception {
private $httpCode;
public function __construct($message = "",
$code = 0,
Throwable $previous = null,
int $httpCode = null) {
$code = 0,
Throwable $previous = null,
int $httpCode = null) {
parent::__construct($message, $code, $previous);
$this->httpCode = $httpCode;
}

View File

@ -40,7 +40,7 @@ use function get_class;
*/
class JsonResponse extends Base {
public function __construct($data = [],
int $statusCode = Http::STATUS_OK) {
int $statusCode = Http::STATUS_OK) {
parent::__construct($data, $statusCode);
$this->addHeader('x-calendar-response', 'true');
@ -53,7 +53,7 @@ class JsonResponse extends Base {
* @return static
*/
public static function success($data = null,
int $status = Http::STATUS_OK): self {
int $status = Http::STATUS_OK): self {
return new self(
[
'status' => 'success',
@ -70,7 +70,7 @@ class JsonResponse extends Base {
* @return static
*/
public static function fail($data = null,
int $status = Http::STATUS_BAD_REQUEST): self {
int $status = Http::STATUS_BAD_REQUEST): self {
return new self(
[
'status' => 'fail',
@ -81,9 +81,9 @@ class JsonResponse extends Base {
}
public static function error(string $message,
int $status = Http::STATUS_INTERNAL_SERVER_ERROR,
array $data = [],
int $code = 0): self {
int $status = Http::STATUS_INTERNAL_SERVER_ERROR,
array $data = [],
int $code = 0): self {
return new self(
[
'status' => 'error',
@ -99,8 +99,8 @@ class JsonResponse extends Base {
* @param mixed[] $data
*/
public static function errorFromThrowable(Throwable $error,
int $status = Http::STATUS_INTERNAL_SERVER_ERROR,
array $data = []): self {
int $status = Http::STATUS_INTERNAL_SERVER_ERROR,
array $data = []): self {
return self::error(
$error->getMessage(),
$status,

View File

@ -43,8 +43,8 @@ class UserDeletedListener implements IEventListener {
private $logger;
public function __construct(AppointmentConfigService $appointmentConfigService,
BookingService $bookingService,
LoggerInterface $logger) {
BookingService $bookingService,
LoggerInterface $logger) {
$this->appointmentConfigService = $appointmentConfigService;
$this->bookingService = $bookingService;
$this->logger = $logger;

View File

@ -55,9 +55,9 @@ class AppointmentsAction implements ILinkAction {
private $configs = [];
public function __construct(IL10N $l10n,
IUserSession $userSession,
AppointmentConfigService $configService,
IURLGenerator $urlGenerator) {
IUserSession $userSession,
AppointmentConfigService $configService,
IURLGenerator $urlGenerator) {
$this->l10n = $l10n;
$this->userSession = $userSession;
$this->configService = $configService;

View File

@ -46,7 +46,7 @@ class AppointmentConfigService {
private $random;
public function __construct(AppointmentConfigMapper $mapper,
ISecureRandom $random) {
ISecureRandom $random) {
$this->mapper = $mapper;
$this->random = $random;
}
@ -163,22 +163,22 @@ class AppointmentConfigService {
* @throws ServiceException
*/
public function create(string $name,
string $description,
?string $location,
string $visibility,
string $userId,
string $targetCalendarUri,
array $availability,
int $length,
int $increment,
int $preparationDuration,
int $followupDuration,
int $buffer,
?int $dailyMax,
?array $calendarFreeBusyUris = [],
?int $start = null,
?int $end = null,
?int $futureLimit = null): AppointmentConfig {
string $description,
?string $location,
string $visibility,
string $userId,
string $targetCalendarUri,
array $availability,
int $length,
int $increment,
int $preparationDuration,
int $followupDuration,
int $buffer,
?int $dailyMax,
?array $calendarFreeBusyUris = [],
?int $start = null,
?int $end = null,
?int $futureLimit = null): AppointmentConfig {
try {
$appointmentConfig = new AppointmentConfig();
$appointmentConfig->setToken($this->random->generate(12, ISecureRandom::CHAR_HUMAN_READABLE));

View File

@ -53,8 +53,8 @@ class AvailabilityGenerator {
* @return Interval[]
*/
public function generate(AppointmentConfig $config,
int $start,
int $end): array {
int $start,
int $end): array {
$now = $this->timeFactory->getTime();
$bufferBeforeStart = ($config->getTimeBeforeNextSlot() ?? 0);

View File

@ -56,10 +56,10 @@ class BookingCalendarWriter {
private $l10n;
public function __construct(IConfig $config,
IManager $manager,
IUserManager $userManager,
ISecureRandom $random,
IL10N $l10n) {
IManager $manager,
IUserManager $userManager,
ISecureRandom $random,
IL10N $l10n) {
$this->config = $config;
$this->manager = $manager;
$this->userManager = $userManager;

View File

@ -76,14 +76,14 @@ class BookingService {
private $logger;
public function __construct(AvailabilityGenerator $availabilityGenerator,
SlotExtrapolator $extrapolator,
DailyLimitFilter $dailyLimitFilter,
EventConflictFilter $eventConflictFilter,
BookingMapper $bookingMapper,
BookingCalendarWriter $calendarWriter,
ISecureRandom $random,
MailService $mailService,
LoggerInterface $logger) {
SlotExtrapolator $extrapolator,
DailyLimitFilter $dailyLimitFilter,
EventConflictFilter $eventConflictFilter,
BookingMapper $bookingMapper,
BookingCalendarWriter $calendarWriter,
ISecureRandom $random,
MailService $mailService,
LoggerInterface $logger) {
$this->availabilityGenerator = $availabilityGenerator;
$this->extrapolator = $extrapolator;
$this->dailyLimitFilter = $dailyLimitFilter;

View File

@ -38,7 +38,7 @@ class EventConflictFilter {
private $logger;
public function __construct(IManager $calendarManager,
LoggerInterface $logger) {
LoggerInterface $logger) {
$this->calendarManager = $calendarManager;
$this->logger = $logger;
}

View File

@ -65,14 +65,14 @@ class MailService {
private IManager $notificationManager;
public function __construct(IMailer $mailer,
IUserManager $userManager,
IL10N $l10n,
Defaults $defaults,
LoggerInterface $logger,
URLGenerator $urlGenerator,
IDateTimeFormatter $dateFormatter,
IFactory $lFactory,
IManager $notificationManager) {
IUserManager $userManager,
IL10N $l10n,
Defaults $defaults,
LoggerInterface $logger,
URLGenerator $urlGenerator,
IDateTimeFormatter $dateFormatter,
IFactory $lFactory,
IManager $notificationManager) {
$this->userManager = $userManager;
$this->mailer = $mailer;
$this->l10n = $l10n;
@ -222,9 +222,9 @@ class MailService {
}
private function addBulletList(IEMailTemplate $template,
IL10N $l10n,
Booking $booking,
?string $location = null):void {
IL10N $l10n,
Booking $booking,
?string $location = null):void {
$template->addBodyListItem($booking->getDisplayName(), $l10n->t('Appointment for:'));
$l = $this->lFactory->findGenericLanguage();

View File

@ -36,7 +36,7 @@ class SlotExtrapolator {
* @return Interval[]
*/
public function extrapolate(AppointmentConfig $config,
array $availabilityIntervals): array {
array $availabilityIntervals): array {
$increment = $config->getIncrement();
$length = $config->getLength();
$slots = [];

View File

@ -42,7 +42,7 @@ class JSDataService implements \JsonSerializable {
* @param IUserSession $userSession
*/
public function __construct(IConfig $config,
IUserSession $userSession) {
IUserSession $userSession) {
$this->config = $config;
$this->userSession = $userSession;
}

View File

@ -23,10 +23,10 @@ declare(strict_types=1);
*/
namespace OCA\Calendar\Controller;
use ChristophWurst\Nextcloud\Testing\TestCase;
use OCP\AppFramework\Http\JSONResponse;
use OCP\Contacts\IManager;
use OCP\IRequest;
use ChristophWurst\Nextcloud\Testing\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
class ContactControllerTest extends TestCase {

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
*/
namespace OCA\Calendar\Controller;
use ChristophWurst\Nextcloud\Testing\TestCase;
use OCP\AppFramework\Http\JSONResponse;
use OCP\Defaults;
use OCP\IConfig;
@ -34,7 +35,6 @@ use OCP\IUserSession;
use OCP\Mail\IEMailTemplate;
use OCP\Mail\IMailer;
use OCP\Mail\IMessage;
use ChristophWurst\Nextcloud\Testing\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
class EmailControllerTest extends TestCase {

View File

@ -24,13 +24,13 @@ declare(strict_types=1);
*/
namespace OCA\Calendar\Controller;
use ChristophWurst\Nextcloud\Testing\TestCase;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\IRequest;
use OCP\IURLGenerator;
use ChristophWurst\Nextcloud\Testing\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
class PublicViewControllerTest extends TestCase {

View File

@ -23,9 +23,9 @@ declare(strict_types=1);
*/
namespace OCA\Calendar\Controller;
use ChristophWurst\Nextcloud\Testing\TestCase;
use OCP\IConfig;
use OCP\IRequest;
use ChristophWurst\Nextcloud\Testing\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
class SettingsControllerTest extends TestCase {
@ -63,7 +63,7 @@ class SettingsControllerTest extends TestCase {
* @dataProvider setViewWithAllowedViewDataProvider
*/
public function testSetViewWithAllowedView(string $view,
int $expectedStatusCode):void {
int $expectedStatusCode):void {
if ($expectedStatusCode === 200) {
$this->config->expects($this->once())
->method('setUserValue')
@ -111,7 +111,7 @@ class SettingsControllerTest extends TestCase {
* @dataProvider setPopoverWithAllowedValueDataProvider
*/
public function testSetPopoverWithAllowedValue(string $value,
int $expectedStatusCode) {
int $expectedStatusCode) {
if ($expectedStatusCode === 200) {
$this->config->expects($this->once())
->method('setUserValue')
@ -203,7 +203,7 @@ class SettingsControllerTest extends TestCase {
* @dataProvider setShowWeekendsWithAllowedValueDataProvider
*/
public function testSetShowWeekendsWithAllowedValue(string $value,
int $expectedStatusCode):void {
int $expectedStatusCode):void {
if ($expectedStatusCode === 200) {
$this->config->expects($this->once())
->method('setUserValue')
@ -245,7 +245,7 @@ class SettingsControllerTest extends TestCase {
* @dataProvider setShowWeekNumbersWithAllowedValueDataProvider
*/
public function testSetShowWeekNumbersWithAllowedValue(string $value,
int $expectedStatusCode):void {
int $expectedStatusCode):void {
if ($expectedStatusCode === 200) {
$this->config->expects($this->once())
->method('setUserValue')
@ -287,7 +287,7 @@ class SettingsControllerTest extends TestCase {
* @dataProvider setEventLimitWithAllowedValueDataProvider
*/
public function testSetEventLimitWithAllowedValue(string $value,
int $expectedStatusCode):void {
int $expectedStatusCode):void {
if ($expectedStatusCode === 200) {
$this->config->expects($this->once())
->method('setUserValue')
@ -329,7 +329,7 @@ class SettingsControllerTest extends TestCase {
* @dataProvider setSlotDurationWithAllowedValueDataProvider
*/
public function testSetSlotDurationWithAllowedValue(string $value,
int $expectedStatusCode):void {
int $expectedStatusCode):void {
if ($expectedStatusCode === 200) {
$this->config->expects($this->once())
->method('setUserValue')
@ -376,7 +376,7 @@ class SettingsControllerTest extends TestCase {
* @dataProvider setDefaultReminderWithAllowedValueDataProvider
*/
public function testSetDefaultReminderWithAllowedValue(string $value,
int $expectedStatusCode):void {
int $expectedStatusCode):void {
if ($expectedStatusCode === 200) {
$this->config->expects($this->once())
->method('setUserValue')

View File

@ -25,6 +25,7 @@ declare(strict_types=1);
namespace OCA\Calendar\Controller;
use ChristophWurst\Nextcloud\Testing\TestCase;
use OCA\Calendar\Db\AppointmentConfig;
use OCA\Calendar\Service\Appointments\AppointmentConfigService;
use OCP\App\IAppManager;
@ -33,7 +34,6 @@ use OCP\AppFramework\Services\IInitialState;
use OCP\Files\IAppData;
use OCP\IConfig;
use OCP\IRequest;
use ChristophWurst\Nextcloud\Testing\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
class ViewControllerTest extends TestCase {

View File

@ -28,10 +28,10 @@ namespace OCA\Calendar\Tests\Unit\Service\Appointments;
use ChristophWurst\Nextcloud\Testing\TestCase;
use Exception;
use OCA\Calendar\Db\AppointmentConfig;
use OCA\Calendar\Db\Booking;
use OCA\Calendar\Db\BookingMapper;
use OCA\Calendar\Exception\ClientException;
use OCA\Calendar\Db\AppointmentConfig;
use OCA\Calendar\Service\Appointments\AvailabilityGenerator;
use OCA\Calendar\Service\Appointments\BookingCalendarWriter;
use OCA\Calendar\Service\Appointments\BookingService;