Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)

This commit is contained in:
Kevin Papst
2022-12-31 21:19:55 +01:00
committed by GitHub
parent 95e06746bd
commit 90a0fd8a22
2164 changed files with 83700 additions and 86426 deletions

View File

@@ -16,30 +16,13 @@ use App\Event\CalendarDragAndDropSourceEvent;
use App\Event\CalendarGoogleSourceEvent;
use App\Event\RecentActivityEvent;
use App\Repository\TimesheetRepository;
use App\Timesheet\DateTimeFactory;
use App\Utils\Color;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
final class CalendarService
{
/**
* @var SystemConfiguration
*/
private $configuration;
/**
* @var TimesheetRepository
*/
private $repository;
/**
* @var EventDispatcherInterface
*/
private $dispatcher;
public function __construct(SystemConfiguration $configuration, TimesheetRepository $repository, EventDispatcherInterface $dispatcher)
public function __construct(private SystemConfiguration $configuration, private TimesheetRepository $repository, private EventDispatcherInterface $dispatcher)
{
$this->configuration = $configuration;
$this->repository = $repository;
$this->dispatcher = $dispatcher;
}
/**
@@ -56,11 +39,7 @@ final class CalendarService
return [];
}
$data = $this->repository->getRecentActivities(
$user,
DateTimeFactory::createByUser($user)->createDateTime('-1 year'),
$maxAmount
);
$data = $this->repository->getRecentActivities($user, null, $maxAmount);
$recentActivity = new RecentActivityEvent($user, $data);
$this->dispatcher->dispatch($recentActivity);
@@ -108,7 +87,6 @@ final class CalendarService
'dayLimit' => $this->configuration->getCalendarDayLimit(),
'showWeekNumbers' => $this->configuration->isCalendarShowWeekNumbers(),
'showWeekends' => $this->configuration->isCalendarShowWeekends(),
'businessDays' => $this->configuration->getCalendarBusinessDays(),
'businessTimeBegin' => $this->configuration->getCalendarBusinessTimeBegin(),
'businessTimeEnd' => $this->configuration->getCalendarBusinessTimeEnd(),
'slotDuration' => $this->configuration->getCalendarSlotDuration(),

View File

@@ -11,23 +11,12 @@ namespace App\Calendar;
final class Google
{
/**
* @var GoogleSource[]
*/
private $sources;
/**
* @var string
*/
private $apiKey;
/**
* @param string $apiKey
* @param GoogleSource[] $sources
*/
public function __construct(string $apiKey, array $sources = [])
public function __construct(private string $apiKey, private array $sources = [])
{
$this->apiKey = $apiKey;
$this->sources = $sources;
}
/**

View File

@@ -11,24 +11,8 @@ namespace App\Calendar;
final class GoogleSource
{
/**
* @var string
*/
private $id;
/**
* @var string
*/
private $uri;
/**
* @var string|null
*/
private $color;
public function __construct(string $id, string $uri, ?string $color = null)
public function __construct(private string $id, private string $uri, private ?string $color = null)
{
$this->id = $id;
$this->uri = $uri;
$this->color = $color;
}
public function getId(): string

View File

@@ -9,19 +9,13 @@
namespace App\Calendar;
class RecentActivitiesSource implements DragAndDropSource
final class RecentActivitiesSource implements DragAndDropSource
{
/**
* @var DragAndDropEntry[]
*/
private $entries;
/**
* @param DragAndDropEntry[] $entries
*/
public function __construct(array $entries)
public function __construct(private array $entries)
{
$this->entries = $entries;
}
public function getTitle(): string

View File

@@ -18,36 +18,25 @@ use App\Entity\Timesheet;
*/
final class TimesheetEntry implements DragAndDropEntry
{
/**
* @var Timesheet
*/
private $timesheet;
/**
* @var string
*/
private $color;
/**
* @var bool
*/
private $copy;
public function __construct(Timesheet $timesheet, string $color, bool $copy = false)
public function __construct(private Timesheet $timesheet, private string $color, private bool $copy = false)
{
$this->timesheet = $timesheet;
$this->color = $color;
$this->copy = $copy;
}
public function getData(): array
{
$data = [
'activity' => $this->timesheet->getActivity() !== null ? $this->timesheet->getActivity()->getId() : null,
'project' => $this->timesheet->getProject() !== null ? $this->timesheet->getProject()->getId() : null,
'activity' => $this->timesheet->getActivity()?->getId(),
'project' => $this->timesheet->getProject()?->getId(),
];
if ($this->copy) {
$tags = null;
if (!empty($this->timesheet->getTagsAsArray())) {
$tags = implode(',', $this->timesheet->getTagsAsArray());
}
$data['description'] = $this->timesheet->getDescription();
$data['tags'] = implode(',', $this->timesheet->getTagsAsArray());
$data['tags'] = $tags;
}
return $data;