Skip to content

Commit

Permalink
Merge branch 'release/2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
stelgenhof committed Jun 22, 2020
2 parents 87cde7f + ca6bf0b commit e2f37e6
Show file tree
Hide file tree
Showing 1,590 changed files with 13,220 additions and 4,417 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Mark stale issues and pull requests

on:
schedule:
- cron: "0 0 * * *"

jobs:
stale:

runs-on: ubuntu-latest

steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue has been open 60 days with no activity. Please remove the stale label or comment, or this will be closed in 10 days.'
stale-pr-message: 'This pull request has been open 60 days with no activity. Please remove the stale label or comment, or this will be closed in 10 days.'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
days-before-stale: 60
days-before-close: 10
6 changes: 4 additions & 2 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2019 AzuyaLabs
* Copyright (c) 2015 - 2020 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -20,5 +20,7 @@ return PhpCsFixer\Config::create()->setRiskyAllowed(true)->setRules([
'no_unused_imports' => true,
'single_quote' => true,
'space_after_semicolon' => true,
'trailing_comma_in_multiline_array' => true
'trailing_comma_in_multiline_array' => true,
'cast_spaces' => ['space' => 'single'],
'declare_strict_types' => true,
])->setLineEnding("\n")->setFinder($finder);
11 changes: 3 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
language: php

php:
- 7.1
- 7.2
- 7.3
- 7.4snapshot
- 7.4
- nightly

dist: trusty
Expand All @@ -23,26 +22,22 @@ before_script:
- composer install --no-interaction

script:
- if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.11 && vendor/bin/phpstan analyse -l 5 src; fi
- if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.12 && vendor/bin/phpstan analyse -l 5 src; fi
- ./vendor/bin/phpunit
- phpenv config-rm xdebug.ini || return 0
- ./vendor/bin/php-cs-fixer --diff --dry-run -v fix

matrix:
allow_failures:
- php: 7.1
- php: 7.4snapshot
- php: hhvm
- php: nightly

include:
- php: 7.1
env: PHPSTAN=1
- php: 7.2
env: PHPSTAN=1
- php: 7.3
env: PHPSTAN=1
- php: 7.4snapshot
- php: 7.4
env: PHPSTAN=1
- php: hhvm
env: HHVM=true
93 changes: 74 additions & 19 deletions CHANGELOG.md

Large diffs are not rendered by default.

56 changes: 43 additions & 13 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
Expand All @@ -16,31 +22,55 @@ Examples of behavior that contributes to creating a positive environment include

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at me@sachatelgenhof.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at me@sachatelgenhof.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version]
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://contributor-covenant.org
[version]: https://contributor-covenant.org/version/1/4/
[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 - 2019 AzuyaLabs
Copyright (c) 2015 - 2020 AzuyaLabs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Logo](https://github.com/azuyalabs/yasumi/blob/gh-pages/images/yasumi_logo_wb.png)
![Logo](https://www.yasumi.dev/assets/img/yasumi_logo.svg)

[![GitHub Release](https://img.shields.io/github/release/azuyalabs/yasumi.svg?style=flat-square)](https://github.com/azuyalabs/yasumi/releases)
[![Total Downloads](https://img.shields.io/packagist/dt/azuyalabs/yasumi.svg?style=flat-square)](https://packagist.org/packages/azuyalabs/yasumi)
Expand All @@ -9,23 +9,36 @@

Introduction
------------
Yasumi (Japanese for 'Holiday'「休み」) is an easy PHP library to help you calculate the dates and names of holidays and other
special celebrations from various countries/states. Many services exist on the internet that provide holidays, however
are either not free or offer only limited information. In addition, no complete PHP library seems to exist today
that covers a wide range of holidays and countries, except maybe [PEAR's Date_Holidays](https://pear.php.net/package/Date_Holidays) which unfortunately hasn't been updated for a long time.
Yasumi (Japanese for 'Holiday'「休み」) is the easy PHP library that helps you retrieve the dates and names of holidays and other special celebrations from various countries/states. It is calculation and rule driven avoiding the need of a comprehensive database.

Many services exist that can provide holiday information, however are either not entirely free or only offer limited information. In addition, no exhaustive PHP library exists today covering a wide range of holidays and countries. [PEAR's Date_Holidays](https://pear.php.net/package/Date_Holidays) library was a similar attempt, however it hasn't been updated for a long time.

Highlights
----------
The goal of Yasumi is to be powerful while remaining lightweight, by utilizing PHP native classes wherever possible. Yasumi's calculation is provider-based (i.e. by country/state), making it easy to add new holiday providers that calculate holidays.

- Straightforward API
- Framework-agnostic
- Use of Providers to easily extend and expand new Holidays
- Common Holiday Providers
- Accounts for the date/time when holidays have been officially established and/or abolished
- Filters enabling to easily select certain holiday types (Official, Observed, Bank, Seasonal or Other)
- Global Translations
- Timezone aware
- Implements [ArrayIterator](https://www.php.net/manual/en/class.arrayiterator.php) to easily process a provider's holidays
- Fully documented
- Fully unit tested
- [Composer](https://getcomposer.org) ready, [PSR-2](https://www.php-fig.org/psr/psr-2/) and [PSR-4](https://www.php-fig.org/psr/psr-4/) compliant

The goal of Yasumi is to be powerful while remaining lightweight, by utilizing PHP native classes wherever possible.
Yasumi's calculation is provider-based (i.e. by country/state) so it's easy to add new holiday providers that calculate
holidays. The methods of Yasumi can be used to get a holiday's date and name in various languages.

Documentation
-------------

Yasumi’s documentation is available on [https://azuyalabs.github.io/yasumi/](https://azuyalabs.github.io/yasumi/). You will find all the necessary information how to install Yasumi and also recipes how you can use Yasumi in your project.
Yasumi’s documentation is available on [https://www.yasumi.dev](https://www.yasumi.dev). You will find all the necessary information how to install Yasumi and also recipes how you can use Yasumi in your project.

Blog
----
Checkout the [blog](https://azuyalabs.github.io/yasumi/blog/) section on documentation site regularly for latest updates. Keeping you informed about any news, releases, etc. in a handy blog post format!
Checkout the [blog](https://www.yasumi.dev/blog/) section on documentation site regularly for latest updates. Keeping you informed about any news, releases, etc. in a handy blog post format!

## Contributing

Expand Down
35 changes: 25 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"name": "azuyalabs/yasumi",
"description": "Yasumi is an easy PHP Library for calculating national holidays.",
"description": "The easy PHP Library for calculating holidays.",
"type": "library",
"authors": [
{
"name": "Sacha Telgenhof",
"email": "me@sachatelgenhof.com",
"role": "Maintainer"
}
],
"homepage": "https://www.yasumi.dev",
"license": "MIT",
"keywords": [
"holiday",
"holidays",
Expand All @@ -12,22 +22,27 @@
"bank",
"national"
],
"license": "MIT",
"authors": [
"readme": "README.md",
"support": {
"issues": "https://github.com/azuyalabs/yasumi/issues",
"source": "https://github.com/azuyalabs/yasumi",
"docs": "https://www.yasumi.dev"
},
"funding": [
{
"name": "Sacha Telgenhof",
"email": "me@sachatelgenhof.com"
"type": "other",
"url": "https://www.buymeacoffee.com/sachatelgenhof"
}
],
"require": {
"php": ">=7.1",
"php": ">=7.2",
"ext-json": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14",
"fzaninotto/faker": "~1.8",
"mikey179/vfsstream": "~1.6",
"phpunit/phpunit": "~8.4"
"friendsofphp/php-cs-fixer": "^2.16",
"fzaninotto/faker": "^1.9",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^8.5"
},
"autoload": {
"psr-4": {
Expand Down
20 changes: 15 additions & 5 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ This file is part of the Yasumi package.
~ This file is part of the Yasumi package.
~
~ Copyright (c) 2015 - 2019 AzuyaLabs
~ Copyright (c) 2015 - 2020 AzuyaLabs
~
~ For the full copyright and license information, please view the LICENSE
~ file that was distributed with this source code.
~ For the full copyright and license information, please view the LICENSE
~ file that was distributed with this source code.
~
~ @author Sacha Telgenhof <me@sachatelgenhof.com>
~ @author Sacha Telgenhof <me@sachatelgenhof.com>
-->

<phpunit backupGlobals="false"
Expand Down Expand Up @@ -58,6 +58,11 @@
<directory suffix="Test.php">./tests/Brazil</directory>
</testsuite>

<!-- Test Suite for holidays in Canada -->
<testsuite name="Canada">
<directory suffix="Test.php">./tests/Canada</directory>
</testsuite>

<!-- Test Suite for holidays in Croatia -->
<testsuite name="Croatia">
<directory suffix="Test.php">./tests/Croatia</directory>
Expand Down Expand Up @@ -128,6 +133,11 @@
<directory suffix="Test.php">./tests/Lithuania</directory>
</testsuite>

<!-- Test Suite for holidays in Luxembourg -->
<testsuite name="Luxembourg">
<directory suffix="Test.php">./tests/Luxembourg</directory>
</testsuite>

<!-- Test Suite for holidays in Netherlands -->
<testsuite name="Netherlands">
<directory suffix="Test.php">./tests/Netherlands</directory>
Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Exception/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2019 AzuyaLabs
* Copyright (c) 2015 - 2020 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
4 changes: 2 additions & 2 deletions src/Yasumi/Exception/InvalidDateException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2019 AzuyaLabs
* Copyright (c) 2015 - 2020 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -34,7 +34,7 @@ public function __construct($argumentValue)
break;
case 'integer':
case 'double':
$displayName = (string)$argumentValue;
$displayName = (string) $argumentValue;
break;
case 'string':
$displayName = $argumentValue;
Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Exception/InvalidYearException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2019 AzuyaLabs
* Copyright (c) 2015 - 2020 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down
32 changes: 32 additions & 0 deletions src/Yasumi/Exception/MissingTranslationException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php declare(strict_types=1);
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2019 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me@sachatelgenhof.com>
*/

namespace Yasumi\Exception;

use Exception as BaseException;

/**
* Class MissingTranslationException.
*/
class MissingTranslationException extends BaseException implements Exception
{
/**
* Initializes the Exception instance
*
* @param string $key The holiday key
* @param array $locales The locales that was searched
*/
public function __construct(string $key, array $locales)
{
parent::__construct(\sprintf("Translation for '%s' not found for any locale: '%s'", $key, \implode("', '", $locales)));
}
}
Loading

0 comments on commit e2f37e6

Please sign in to comment.