chore: code cleanup
This commit is contained in:
1 parent
c4e28818e0
commit
e36009008c
273 files changed
+547
-531
No files matched your search
@@ -31,7 +31,7 @@ class ApiClient
|
||||
private readonly ResponseParser $responseParser,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly FilesystemOperator $xmlDump,
|
||||
array $options
|
||||
array $options,
|
||||
) {
|
||||
$this->config = $this->resolveOptions($options);
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ namespace App\BusProNet;
|
||||
|
||||
class ApiClientException extends \Exception
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ trait ApiClientTrait
|
||||
private function send($socket, string $data): void
|
||||
{
|
||||
// message length is prepended to actual message
|
||||
$send = sprintf('%010s', strlen($data)) . $data;
|
||||
$send = sprintf('%010s', strlen($data)).$data;
|
||||
fwrite($socket, $send);
|
||||
}
|
||||
|
||||
@@ -73,4 +73,4 @@ trait ApiClientTrait
|
||||
{
|
||||
@fclose($socket);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,8 @@ use Symfony\Contracts\Cache\ItemInterface;
|
||||
class CountryDataProvider
|
||||
{
|
||||
public function __construct(private readonly ApiClient $apiClient, private readonly CacheInterface $cache)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
public function getAll(): array
|
||||
{
|
||||
@@ -40,4 +41,4 @@ class CountryDataProvider
|
||||
|
||||
return $this->getAll()[$token] ?? null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,8 @@ use Symfony\Contracts\Cache\ItemInterface;
|
||||
class HotelDataProvider
|
||||
{
|
||||
public function __construct(private readonly ApiClient $apiClient, private readonly CacheInterface $cache)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
public function getAll(): array
|
||||
{
|
||||
@@ -50,4 +51,4 @@ class HotelDataProvider
|
||||
|
||||
return $hotels;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,8 @@ use Symfony\Contracts\Cache\ItemInterface;
|
||||
class PickupDataProvider
|
||||
{
|
||||
public function __construct(private readonly ApiClient $apiClient, private readonly CacheInterface $cache)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
public function getAll(): array
|
||||
{
|
||||
@@ -36,4 +37,4 @@ class PickupDataProvider
|
||||
{
|
||||
return $this->getAll()[$busProId] ?? null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,4 +56,4 @@ class Address
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,11 @@ namespace App\BusProNet\Model;
|
||||
class BaseDataResponse
|
||||
{
|
||||
public function __construct(private readonly array $items)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
public function getItems(): array
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\BusProNet\Model;
|
||||
|
||||
use Symfony\Component\Serializer\Annotation\SerializedName;
|
||||
|
||||
class Communication
|
||||
{
|
||||
private ?string $phone = null;
|
||||
@@ -45,4 +43,4 @@ class Communication
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,4 +56,4 @@ class Country
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,4 +43,4 @@ class CrmAttribute
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,4 @@ class CrmAttributeGroup
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,8 @@ class CrmAttributesResponse
|
||||
return $this->attributeGroups;
|
||||
}
|
||||
|
||||
public function setAttributeGroups(?array $attributeGroups): static{
|
||||
public function setAttributeGroups(?array $attributeGroups): static
|
||||
{
|
||||
$this->attributeGroups = $attributeGroups;
|
||||
|
||||
return $this;
|
||||
@@ -102,4 +103,4 @@ class CrmAttributesResponse
|
||||
|
||||
return $crmSelections;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ class NotificationResponse
|
||||
private ?int $code;
|
||||
private ?string $message;
|
||||
|
||||
public function __construct(int $code = null, string $message = null)
|
||||
public function __construct(?int $code = null, ?string $message = null)
|
||||
{
|
||||
$this->code = $code;
|
||||
$this->message = $message;
|
||||
@@ -33,9 +33,9 @@ class NotificationResponse
|
||||
// These weird and contradictory looking assertions are required because
|
||||
// of the stupid API implementation that doesn't distinguish between error
|
||||
// and success responses.
|
||||
$responseIsError = 100 <= $this->getCode() || $this->getMessage() === 'Daten konnten nicht gesendet werden.';
|
||||
$responseIsError = 100 <= $this->getCode() || 'Daten konnten nicht gesendet werden.' === $this->getMessage();
|
||||
$responseIsSuccess = 650 === $this->getCode() && false === stripos($this->getMessage(), 'fehler');
|
||||
|
||||
return false === $responseIsError && true === $responseIsSuccess;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,4 +96,4 @@ class Pickup
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,4 +134,4 @@ class ProfileResponse
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class ResponseParser
|
||||
$title = (string) $addressXml->titel;
|
||||
|
||||
$gender = (string) $addressXml->geschlecht;
|
||||
$gender = strtoupper($gender) === 'W' ? 'F' : strtoupper($gender);
|
||||
$gender = 'W' === strtoupper($gender) ? 'F' : strtoupper($gender);
|
||||
|
||||
$dateString = (string) $addressXml->geburtsdatum;
|
||||
$dateOfBirth = empty($dateString) ? null : \DateTimeImmutable::createFromFormat('d.m.Y', $dateString);
|
||||
|
||||
@@ -4,4 +4,4 @@ namespace App\BusProNet;
|
||||
|
||||
class ResponseParserException extends \Exception
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ class UserDataHandler
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly LoggerInterface $logger
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ class UserDataHandler
|
||||
array $roles,
|
||||
bool $isTeamer = false,
|
||||
array $crmSelections = [],
|
||||
array $hotelCodes = []
|
||||
array $hotelCodes = [],
|
||||
): User {
|
||||
$user = new User();
|
||||
$user
|
||||
@@ -95,7 +95,7 @@ class UserDataHandler
|
||||
array $roles,
|
||||
bool $isTeamer = false,
|
||||
array $crmSelections = [],
|
||||
array $hotelCodes = []
|
||||
array $hotelCodes = [],
|
||||
): void {
|
||||
$user
|
||||
->setEmail($profileResponse->getCommunication()->getEmail())
|
||||
@@ -126,4 +126,4 @@ class UserDataHandler
|
||||
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user