Skip to content

Commit

Permalink
fix(ZMSKVR-125): formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Fink authored and Thomas Fink committed Feb 14, 2025
1 parent 34039d1 commit c7a0e24
Show file tree
Hide file tree
Showing 26 changed files with 33 additions and 17 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ To run Checks locally in your local docker container:

0. Run all at once:
- `ddev exec "./cli modules loop 'vendor/bin/phpcs --standard=psr12 src/'"`
- `ddev exec "./cli modules loop 'vendor/bin/phpcbf --standard=psr12 src/'"`

1. **Enter the container** (if using DDEV or Docker):
- `ddev ssh`
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Collection.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
1 change: 0 additions & 1 deletion mellon/src/Mellon/Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
class Condition
{

protected $collection = [];

public function __construct(Valid ...$validList)
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Exception.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Failure/Exception.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Failure/Message.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Failure/MessageList.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
2 changes: 1 addition & 1 deletion mellon/src/Mellon/Parameter.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand All @@ -12,7 +13,6 @@
*/
abstract class Parameter
{

/**
* value of parameter
*
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Unvalidated.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
2 changes: 1 addition & 1 deletion mellon/src/Mellon/Valid.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand All @@ -13,7 +14,6 @@
*/
class Valid extends \BO\Mellon\Parameter
{

/**
* validation errors
*
Expand Down
5 changes: 3 additions & 2 deletions mellon/src/Mellon/ValidArray.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/
Expand All @@ -11,7 +12,6 @@
*/
class ValidArray extends \BO\Mellon\Valid
{

/**
* Allow native arrays anc class replacements
*
Expand All @@ -21,7 +21,8 @@ class ValidArray extends \BO\Mellon\Valid
*/
public function isArray($message = 'no valid array')
{
if (is_array($this->value)
if (
is_array($this->value)
|| (
$this->value instanceof \Traversable
&& $this->value instanceof \Countable
Expand Down
2 changes: 1 addition & 1 deletion mellon/src/Mellon/ValidBool.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/
Expand All @@ -11,7 +12,6 @@
*/
class ValidBool extends Valid
{

/**
* Allow only boolean values like
* Allowed values are:
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/ValidDate.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
5 changes: 3 additions & 2 deletions mellon/src/Mellon/ValidDatetime.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

/**
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/

namespace BO\Mellon;

use \DateTimeImmutable;
use \DateTime;
use DateTimeImmutable;
use DateTime;

class ValidDatetime extends Valid
{
Expand Down
4 changes: 3 additions & 1 deletion mellon/src/Mellon/ValidFile.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down Expand Up @@ -44,7 +45,8 @@ public function isFile($name = 'fileupload', $message = 'No valid file found.')
public function hasType($type = 'jpeg', $message = 'Invalid file type.')
{
if (isset($_FILES[$this->fileName])) {
if ((! empty($_FILES[$this->fileName]["type"])) &&
if (
(! empty($_FILES[$this->fileName]["type"])) &&
($_FILES[$this->fileName]['type'] != $this->acceptableTypes[$type])
) {
$this->setFailure($message);
Expand Down
2 changes: 1 addition & 1 deletion mellon/src/Mellon/ValidJson.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand All @@ -14,7 +15,6 @@
*/
class ValidJson extends Valid
{

protected $originalJsonString = null;
protected $defaultJsonString = '{}';

Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/ValidMail.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
2 changes: 1 addition & 1 deletion mellon/src/Mellon/ValidNumber.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/
Expand All @@ -11,7 +12,6 @@
*/
class ValidNumber extends Valid
{

/**
* Allow only integer numbers
*
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/ValidPath.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/
Expand Down
2 changes: 1 addition & 1 deletion mellon/src/Mellon/ValidString.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
**/
Expand All @@ -11,7 +12,6 @@
*/
class ValidString extends Valid
{

/**
* Allow strings smaller than 64kb and do htmlspecialchars()
*
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/ValidUrl.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/ValidationException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
1 change: 1 addition & 0 deletions mellon/src/Mellon/Validator.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Mellon
* @copyright BerlinOnline Stadtportal GmbH & Co. KG
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private static function checkRateLimit(): bool
$attempt = 0;
$key = self::CACHE_COUNTER_KEY;
$lockKey = $key . '_lock';

while ($attempt < 3) { // Max retries
try {
if (!Application::$cache->has($lockKey)) {
Expand Down Expand Up @@ -137,7 +137,7 @@ public static function logRequest(ServerRequestInterface $request, ResponseInter

$uri = $request->getUri();
$path = preg_replace('#/+#', '/', $uri->getPath());

// Filter out query params that look like paths
$queryParams = array_filter($request->getQueryParams(), function ($key, $value) {
return !preg_match('#^/|//#', $key) && !preg_match('#^/|//#', $value);
Expand Down Expand Up @@ -202,4 +202,4 @@ private static function filterSensitiveHeaders(array $headers): array
}
return $filtered;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,6 @@ public static function contactToThinnedContact($contact): ThinnedContact
*/
public static function providerToThinnedProvider(Provider $provider): ThinnedProvider
{
return new ThinnedProvider(id: isset($provider->id) ? (int) $provider->id : null, name: isset($provider->name) ? $provider->name : null, source: isset($provider->source) ? $provider->source : null, lon: isset($provider->data['geo']['lon']) ? (float) $provider->data['geo']['lon'] : null, lat: isset($provider->data['geo']['lat']) ? (float) $provider->data['geo']['lat'] : null, contact: isset($provider->contact) ? self::contactToThinnedContact($provider->contact) : null, );
return new ThinnedProvider(id: isset($provider->id) ? (int) $provider->id : null, name: isset($provider->name) ? $provider->name : null, source: isset($provider->source) ? $provider->source : null, lon: isset($provider->data['geo']['lon']) ? (float) $provider->data['geo']['lon'] : null, lat: isset($provider->data['geo']['lat']) ? (float) $provider->data['geo']['lat'] : null, contact: isset($provider->contact) ? self::contactToThinnedContact($provider->contact) : null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public static function getBookableFreeDays(array $officeIds, array $serviceIds,
];
}

$freeDays = ZmsApiClientService::getFreeDays(new ProviderList($providers), new RequestList($services), $firstDay, $lastDay, ) ?? new Calendar();
$freeDays = ZmsApiClientService::getFreeDays(new ProviderList($providers), new RequestList($services), $firstDay, $lastDay,) ?? new Calendar();
$daysCollection = $freeDays->days;
$formattedDays = [];
foreach ($daysCollection as $day) {
Expand Down

0 comments on commit c7a0e24

Please sign in to comment.