From 4182664ccc21bc0b6c90ab8cba69cd6f495277e3 Mon Sep 17 00:00:00 2001 From: Norbert Orzechowicz Date: Fri, 7 Aug 2020 21:45:21 +0200 Subject: [PATCH] Updated dependencies and MSI score --- README.md | 148 +------ composer.json | 2 +- composer.lock | 376 +++++++++++------- infection.json | 17 +- phpunit.xml | 16 +- .../WorkingHours/ShiftsWorkingHoursTest.php | 5 +- 6 files changed, 266 insertions(+), 298 deletions(-) diff --git a/README.md b/README.md index 4f4471f..dc2f797 100644 --- a/README.md +++ b/README.md @@ -14,150 +14,6 @@ Time Management Framework for PHP [Source: Wikipedia](https://en.wikipedia.org/wiki/Aeon) -Define working hours and check Date Time against them, exclude holidays, -define exceptions and custom working days. +Aeon is a set of libraries that makes easier to work with PHP Date & Time in elegant Object Oriented way. -Business Hours class takes 3 parameters, described below. - -```php -isOpen(DateTime::fromString('2020-01-03 8am')); // true -``` - -### Monday - Friday 6am - 6pm, Weekends 11am - 6pm - -```php -isOpen(DateTime::fromString('2020-01-03 8am')); // true -``` -### Closed during regional holidays in Poland - -```php -isOpenOn(Day::fromString('2020-06-11')); // false -``` - -### Closed during regional holidays in Poland but open on January first - -```php -isOpenOn(Day::fromString('2020-06-11')); // false -``` \ No newline at end of file +Please read [Official Documentation](https://aeon-php.org/docs/business-hours/). diff --git a/composer.json b/composer.json index b2c64b2..22ca6e6 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "aeon-php/calendar": "^0.3.0" }, "require-dev": { - "phpunit/phpunit": "^9.1", + "phpunit/phpunit": "^9.3", "aeon-php/calendar-holidays": "^1.0@dev" }, "license": "MIT", diff --git a/composer.lock b/composer.lock index 4d62f54..32019b1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "63ed3354a21403156a020a6714877484", + "content-hash": "7ec7a160a9cdb8c0d3b700b8c23202a5", "packages": [ { "name": "aeon-php/calendar", @@ -66,12 +66,12 @@ "source": { "type": "git", "url": "https://github.com/aeon-php/calendar-holidays.git", - "reference": "7db16c66b1e58cd4a532fdd0e9b7d10a2f6c4c27" + "reference": "3ceee6d2e70fd51645da5c7143a65c1a61f8efe4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aeon-php/calendar-holidays/zipball/7db16c66b1e58cd4a532fdd0e9b7d10a2f6c4c27", - "reference": "7db16c66b1e58cd4a532fdd0e9b7d10a2f6c4c27", + "url": "https://api.github.com/repos/aeon-php/calendar-holidays/zipball/3ceee6d2e70fd51645da5c7143a65c1a61f8efe4", + "reference": "3ceee6d2e70fd51645da5c7143a65c1a61f8efe4", "shasum": "" }, "require": { @@ -113,7 +113,7 @@ "type": "github" } ], - "time": "2020-08-01T19:32:33+00:00" + "time": "2020-08-04T20:49:29+00:00" }, { "name": "doctrine/instantiator", @@ -247,30 +247,83 @@ ], "time": "2020-06-29T13:22:24+00:00" }, + { + "name": "nikic/php-parser", + "version": "v4.7.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "21dce06dfbf0365c6a7cc8fdbdc995926c6a9300" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/21dce06dfbf0365c6a7cc8fdbdc995926c6a9300", + "reference": "21dce06dfbf0365c6a7cc8fdbdc995926c6a9300", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "0.0.5", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.7-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2020-07-25T13:18:53+00:00" + }, { "name": "phar-io/manifest", - "version": "1.0.3", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", "shasum": "" }, "require": { "ext-dom": "*", "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -300,24 +353,24 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" + "time": "2020-06-27T14:33:11+00:00" }, { "name": "phar-io/version", - "version": "2.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + "reference": "c6bb6825def89e0a32220f88337f8ceaf1975fa0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "url": "https://api.github.com/repos/phar-io/version/zipball/c6bb6825def89e0a32220f88337f8ceaf1975fa0", + "reference": "c6bb6825def89e0a32220f88337f8ceaf1975fa0", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -347,7 +400,7 @@ } ], "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" + "time": "2020-06-27T14:39:04+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -572,32 +625,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "8.0.2", + "version": "9.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc" + "reference": "ee24e82baca11d7d6fb3513e127d6000f541cf90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca6647ffddd2add025ab3f21644a441d7c146cdc", - "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ee24e82baca11d7d6fb3513e127d6000f541cf90", + "reference": "ee24e82baca11d7d6fb3513e127d6000f541cf90", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-xmlwriter": "*", - "php": "^7.3", - "phpunit/php-file-iterator": "^3.0", - "phpunit/php-text-template": "^2.0", - "phpunit/php-token-stream": "^4.0", - "sebastian/code-unit-reverse-lookup": "^2.0", - "sebastian/environment": "^5.0", - "sebastian/version": "^3.0", - "theseer/tokenizer": "^1.1.3" + "nikic/php-parser": "^4.7", + "php": "^7.3 || ^8.0", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-pcov": "*", @@ -606,7 +662,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "8.0-dev" + "dev-master": "9.0-dev" } }, "autoload": { @@ -632,17 +688,13 @@ "testing", "xunit" ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/8.0.2" - }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], - "time": "2020-05-23T08:02:54+00:00" + "time": "2020-08-07T04:12:30+00:00" }, { "name": "phpunit/php-file-iterator", @@ -706,16 +758,16 @@ }, { "name": "phpunit/php-invoker", - "version": "3.0.2", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "f6eedfed1085dd1f4c599629459a0277d25f9a66" + "reference": "7a85b66acc48cacffdf87dadd3694e7123674298" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f6eedfed1085dd1f4c599629459a0277d25f9a66", - "reference": "f6eedfed1085dd1f4c599629459a0277d25f9a66", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/7a85b66acc48cacffdf87dadd3694e7123674298", + "reference": "7a85b66acc48cacffdf87dadd3694e7123674298", "shasum": "" }, "require": { @@ -731,7 +783,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -755,17 +807,13 @@ "keywords": [ "process" ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/master" - }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], - "time": "2020-06-26T11:53:53+00:00" + "time": "2020-08-06T07:04:15+00:00" }, { "name": "phpunit/php-text-template", @@ -885,77 +933,18 @@ ], "time": "2020-06-26T11:58:13+00:00" }, - { - "name": "phpunit/php-token-stream", - "version": "4.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "5672711b6b07b14d5ab694e700c62eeb82fcf374" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/5672711b6b07b14d5ab694e700c62eeb82fcf374", - "reference": "5672711b6b07b14d5ab694e700c62eeb82fcf374", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.3 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", - "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-06-27T06:36:25+00:00" - }, { "name": "phpunit/phpunit", - "version": "9.2.6", + "version": "9.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1c6a9e4312e209e659f1fce3ce88dd197c2448f6" + "reference": "eacb57f3857cb6706550bd39ea500f9b1097b0bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1c6a9e4312e209e659f1fce3ce88dd197c2448f6", - "reference": "1c6a9e4312e209e659f1fce3ce88dd197c2448f6", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/eacb57f3857cb6706550bd39ea500f9b1097b0bf", + "reference": "eacb57f3857cb6706550bd39ea500f9b1097b0bf", "shasum": "" }, "require": { @@ -966,30 +955,30 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.9.5", - "phar-io/manifest": "^1.0.3", - "phar-io/version": "^2.0.1", - "php": "^7.3", - "phpspec/prophecy": "^1.10.3", - "phpunit/php-code-coverage": "^8.0.2", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-invoker": "^3.0.2", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.1", + "phar-io/version": "^3.0.2", + "php": "^7.3 || ^8.0", + "phpspec/prophecy": "^1.11.1", + "phpunit/php-code-coverage": "^9.0", + "phpunit/php-file-iterator": "^3.0.4", + "phpunit/php-invoker": "^3.1", "phpunit/php-text-template": "^2.0.2", "phpunit/php-timer": "^5.0.1", "sebastian/code-unit": "^1.0.5", "sebastian/comparator": "^4.0.3", - "sebastian/diff": "^4.0.1", + "sebastian/diff": "^4.0.2", "sebastian/environment": "^5.1.2", "sebastian/exporter": "^4.0.2", - "sebastian/global-state": "^4.0", + "sebastian/global-state": "^5.0", "sebastian/object-enumerator": "^4.0.2", "sebastian/resource-operations": "^3.0.2", - "sebastian/type": "^2.1.1", + "sebastian/type": "^2.2.1", "sebastian/version": "^3.0.1" }, "require-dev": { "ext-pdo": "*", - "phpspec/prophecy-phpunit": "^2.0" + "phpspec/prophecy-phpunit": "^2.0.1" }, "suggest": { "ext-soap": "*", @@ -1001,7 +990,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-master": "9.3-dev" } }, "autoload": { @@ -1030,10 +1019,6 @@ "testing", "xunit" ], - "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.2.6" - }, "funding": [ { "url": "https://phpunit.de/donate.html", @@ -1044,7 +1029,7 @@ "type": "github" } ], - "time": "2020-07-13T17:55:55+00:00" + "time": "2020-08-07T09:12:30+00:00" }, { "name": "sebastian/code-unit", @@ -1231,6 +1216,59 @@ ], "time": "2020-06-26T12:05:46+00:00" }, + { + "name": "sebastian/complexity", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "33fcd6a26656c6546f70871244ecba4b4dced097" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/33fcd6a26656c6546f70871244ecba4b4dced097", + "reference": "33fcd6a26656c6546f70871244ecba4b4dced097", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-25T14:01:34+00:00" + }, { "name": "sebastian/diff", "version": "4.0.2", @@ -1439,26 +1477,26 @@ }, { "name": "sebastian/global-state", - "version": "4.0.0", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72" + "reference": "22ae663c951bdc39da96603edc3239ed3a299097" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bdb1e7c79e592b8c82cb1699be3c8743119b8a72", - "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/22ae663c951bdc39da96603edc3239ed3a299097", + "reference": "22ae663c951bdc39da96603edc3239ed3a299097", "shasum": "" }, "require": { - "php": "^7.3", + "php": "^7.3 || ^8.0", "sebastian/object-reflector": "^2.0", "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-uopz": "*" @@ -1466,7 +1504,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1489,7 +1527,66 @@ "keywords": [ "global state" ], - "time": "2020-02-07T06:11:37+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-08-07T04:09:03+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "e02bf626f404b5daec382a7b8a6a4456e49017e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e02bf626f404b5daec382a7b8a6a4456e49017e5", + "reference": "e02bf626f404b5daec382a7b8a6a4456e49017e5", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-22T18:33:42+00:00" }, { "name": "sebastian/object-enumerator", @@ -1832,7 +1929,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.18.0", + "version": "v1.18.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -1890,9 +1987,6 @@ "polyfill", "portable" ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.18.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", diff --git a/infection.json b/infection.json index cac6134..71d783a 100644 --- a/infection.json +++ b/infection.json @@ -17,7 +17,22 @@ } }, "mutators": { - "@default": true + "@default": true, + "OneZeroInteger": { + "ignore": [ + "Aeon\\Calendar\\Gregorian\\BusinessHours\\WorkingHours\\ShiftsWorkingHours::__construct" + ] + }, + "IncrementInteger": { + "ignore": [ + "Aeon\\Calendar\\Gregorian\\BusinessHours\\WorkingHours\\ShiftsWorkingHours::__construct" + ] + }, + "LogicalAnd": { + "ignore": [ + "Aeon\\Calendar\\Gregorian\\BusinessHours::nextBusinessDay" + ] + } }, "testFramework": "phpunit", "bootstrap": "./vendor/autoload.php" diff --git a/phpunit.xml b/phpunit.xml index ed3a7f4..65db406 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,19 +1,19 @@ - - - - - + + + + + src - - + + diff --git a/tests/Aeon/Calendar/Tests/Unit/Calendar/Gregorian/BusinessHours/WorkingHours/ShiftsWorkingHoursTest.php b/tests/Aeon/Calendar/Tests/Unit/Calendar/Gregorian/BusinessHours/WorkingHours/ShiftsWorkingHoursTest.php index 15de9d0..4f6770a 100644 --- a/tests/Aeon/Calendar/Tests/Unit/Calendar/Gregorian/BusinessHours/WorkingHours/ShiftsWorkingHoursTest.php +++ b/tests/Aeon/Calendar/Tests/Unit/Calendar/Gregorian/BusinessHours/WorkingHours/ShiftsWorkingHoursTest.php @@ -27,9 +27,12 @@ public function test_is_open() : void $shifts = new ShiftsWorkingHours( new LinearWorkingHours(Time::fromString('10am'), Time::fromString('9pm')), new LinearWorkingHours(Time::fromString('6am'), Time::fromString('8am')), + new LinearWorkingHours(Time::fromString('4am'), Time::fromString('5am')), ); - $this->assertFalse($shifts->isOpen(Time::fromString('5am'))); + $this->assertSame('04:00:00.000000', $shifts->openFrom()->toString()); + $this->assertSame('21:00:00.000000', $shifts->openTo()->toString()); + $this->assertFalse($shifts->isOpen(Time::fromString('3am'))); $this->assertTrue($shifts->isOpen(Time::fromString('6am'))); $this->assertFalse($shifts->isOpen(Time::fromString('9am'))); $this->assertTrue($shifts->isOpen(Time::fromString('5pm')));