Skip to content

Commit

Permalink
style: Fix code styling and formatting issues
Browse files Browse the repository at this point in the history
Signed-off-by: Sacha Telgenhof <[email protected]>
  • Loading branch information
stelgenhof committed Apr 9, 2024
1 parent d0658fc commit 8eca89a
Show file tree
Hide file tree
Showing 257 changed files with 1,521 additions and 870 deletions.
33 changes: 23 additions & 10 deletions examples/basic.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,59 @@

// This file demonstrates the general use of Yasumi and its basic methods.

declare(strict_types=1);
declare(strict_types = 1);

/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me at sachatelgenhof dot com>
*/

require 'vendor/autoload.php';

// Use the factory to create a new holiday provider instance
$holidays = Yasumi\Yasumi::create('USA', (int) date('Y'));

// Show the number of defined holidays
echo 'Number of defined holidays: '.$holidays->count().PHP_EOL;
echo 'Number of defined holidays: ' . $holidays->count() . PHP_EOL;
echo PHP_EOL;

// Display a list all of the holiday names (short names)
echo 'List of all the holiday names: '.PHP_EOL;
echo 'List of all the holiday names: ' . PHP_EOL;
foreach ($holidays->getHolidayNames() as $name) {
echo $name.PHP_EOL;
echo $name . PHP_EOL;
}
echo PHP_EOL;

// Display a list all of the holiday dates
echo 'List of all the holiday dates:'.PHP_EOL;
echo 'List of all the holiday dates:' . PHP_EOL;
foreach ($holidays->getHolidayDates() as $date) {
echo $date.PHP_EOL;
echo $date . PHP_EOL;
}
echo PHP_EOL;

// Get a holiday instance for Independence Day
$independenceDay = $holidays->getHoliday('independenceDay');

// Show the localized name
echo 'Name of the holiday : '.$independenceDay->getName().PHP_EOL;
echo 'Name of the holiday : ' . $independenceDay->getName() . PHP_EOL;

// Show the date
echo 'Date of the holiday : '.$independenceDay.PHP_EOL;
echo 'Date of the holiday : ' . $independenceDay . PHP_EOL;

// Show the type of holiday
echo 'Type of holiday : '.$independenceDay->getType().PHP_EOL;
echo 'Type of holiday : ' . $independenceDay->getType() . PHP_EOL;
echo PHP_EOL;

// Dump the holiday as a JSON object
echo 'Holiday as a JSON object:'.PHP_EOL;
echo 'Holiday as a JSON object:' . PHP_EOL;
echo json_encode($independenceDay, JSON_PRETTY_PRINT);

echo PHP_EOL;
25 changes: 19 additions & 6 deletions examples/between_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,20 @@
// This file demonstrates the use of the `between` filter, selecting only a number of holidays
// that fall in the given date range.

declare(strict_types=1);
declare(strict_types = 1);

/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me at sachatelgenhof dot com>
*/

require 'vendor/autoload.php';

Expand All @@ -12,16 +25,16 @@
// Use the factory to create a new holiday provider instance
$holidays = Yasumi\Yasumi::create('Italy', $year);
$holidaysInDecember = $holidays->between(
new DateTime('12/01/'.$year),
new DateTime('12/31/'.$year)
new DateTime('12/01/' . $year),
new DateTime('12/31/' . $year)
);

// Show all holidays in Italy for December
echo 'List of all the holidays in December: '.PHP_EOL;
echo 'List of all the holidays in December: ' . PHP_EOL;
foreach ($holidaysInDecember as $holiday) {
echo $holiday.' - '.$holiday->getName().PHP_EOL;
echo $holiday . ' - ' . $holiday->getName() . PHP_EOL;
}
echo PHP_EOL;

// Show the number of filtered holidays
echo 'Number of filtered holidays: '.$holidaysInDecember->count().PHP_EOL;
echo 'Number of filtered holidays: ' . $holidaysInDecember->count() . PHP_EOL;
21 changes: 17 additions & 4 deletions examples/custom_provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@
// those scenarios where you would need only a subset of holidays of an existing provider. Or, if you you like to
// extend an existing provider with additional, non-standard holidays.

declare(strict_types=1);
declare(strict_types = 1);

/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me at sachatelgenhof dot com>
*/

require 'vendor/autoload.php';

Expand Down Expand Up @@ -33,11 +46,11 @@ public function initialize(): void
$NYSEHolidays = Yasumi\Yasumi::create(NYSE::class, (int) date('Y'));

// We then can retrieve the NYSE observed holidays in the usual manner:
echo 'List of all the holiday names: '.PHP_EOL;
echo 'List of all the holiday names: ' . PHP_EOL;
foreach ($NYSEHolidays->getHolidayNames() as $day) {
echo $day.PHP_EOL;
echo $day . PHP_EOL;
}
echo PHP_EOL;

// Use the count() method to show how many holidays are returned
echo 'Number of defined holidays: '.$NYSEHolidays->count().PHP_EOL;
echo 'Number of defined holidays: ' . $NYSEHolidays->count() . PHP_EOL;
19 changes: 16 additions & 3 deletions examples/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@
// based on certain conditions. In this examples we show only the holidays that are
// marked as 'official'.

declare(strict_types=1);
declare(strict_types = 1);

/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me at sachatelgenhof dot com>
*/

require 'vendor/autoload.php';

Expand All @@ -14,7 +27,7 @@
// Create a filter instance for the official holidays
$official = new Yasumi\Filters\OfficialHolidaysFilter($holidays->getIterator());

echo 'List of all official holidays: '.PHP_EOL;
echo 'List of all official holidays: ' . PHP_EOL;
foreach ($official as $day) {
echo $day->getName().PHP_EOL;
echo $day->getName() . PHP_EOL;
}
15 changes: 14 additions & 1 deletion phpinsights.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me at sachatelgenhof dot com>
*/

return [
/*
Expand Down
19 changes: 16 additions & 3 deletions rector.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me at sachatelgenhof dot com>
*/

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__.'/src',
__DIR__.'/tests',
__DIR__ . '/src',
__DIR__ . '/tests',
]);

// single rules
Expand Down
8 changes: 5 additions & 3 deletions src/Yasumi/Exception/Exception.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

/*
* This file is part of the Yasumi package.
/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
Expand Down
8 changes: 5 additions & 3 deletions src/Yasumi/Exception/InvalidYearException.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

/*
* This file is part of the Yasumi package.
/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
Expand Down
8 changes: 5 additions & 3 deletions src/Yasumi/Exception/MissingTranslationException.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

/*
* This file is part of the Yasumi package.
/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
Expand Down
8 changes: 5 additions & 3 deletions src/Yasumi/Exception/ProviderNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

/*
* This file is part of the Yasumi package.
/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
Expand Down
8 changes: 5 additions & 3 deletions src/Yasumi/Exception/UnknownLocaleException.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

/*
* This file is part of the Yasumi package.
/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
Expand Down
8 changes: 5 additions & 3 deletions src/Yasumi/Filters/AbstractFilter.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

/*
* This file is part of the Yasumi package.
/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
Expand Down
8 changes: 5 additions & 3 deletions src/Yasumi/Filters/BankHolidaysFilter.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

/*
* This file is part of the Yasumi package.
/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
Expand Down
8 changes: 5 additions & 3 deletions src/Yasumi/Filters/BetweenFilter.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

/*
* This file is part of the Yasumi package.
/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
Expand Down
8 changes: 5 additions & 3 deletions src/Yasumi/Filters/ObservedHolidaysFilter.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

/*
* This file is part of the Yasumi package.
/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
Expand Down
8 changes: 5 additions & 3 deletions src/Yasumi/Filters/OfficialHolidaysFilter.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);
declare(strict_types = 1);

/*
* This file is part of the Yasumi package.
/**
* This file is part of the 'Yasumi' package.
*
* The easy PHP Library for calculating holidays.
*
* Copyright (c) 2015 - 2024 AzuyaLabs
*
Expand Down
Loading

0 comments on commit 8eca89a

Please sign in to comment.