diff options
42 files changed, 5394 insertions, 0 deletions
diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..5d0b26c --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +EPG_SERVICE_KEY= diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c01293d --- /dev/null +++ b/.gitignore @@ -0,0 +1,112 @@ +### Composer ### + +composer.phar +/vendor/ + +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +# composer.lock + +### Git ### + +# Created by git for backups. To disable backups in Git: +# $ git config --global mergetool.keepBackup false +*.orig + +# Created by git when using merge tools for conflicts +*.BACKUP.* +*.BASE.* +*.LOCAL.* +*.REMOTE.* +*_BACKUP_*.txt +*_BASE_*.txt +*_LOCAL_*.txt +*_REMOTE_*.txt + +### Linux ### + +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### PHPUnit ### + +# Covers PHPUnit +# Reference: https://phpunit.de/ + +# Generated files +.phpunit.result.cache + +# PHPUnit +/app/phpunit.xml +/phpunit.xml +/.env + +# Build data +/build/ + +### Windows ### + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..f292995 --- /dev/null +++ b/composer.json @@ -0,0 +1,28 @@ +{ + "name": "valentineus/epg-service", + "description": "Description", + "type": "library", + "license": "Apache-2.0", + "authors": [ + { + "name": "Valentin Popov", + "email": "info@valentineus.link" + } + ], + "minimum-stability": "alpha", + "autoload": { + "psr-4": { + "EPGService\\": "src/", + "Tests\\": "tests/" + } + }, + "require": { + "guzzlehttp/guzzle": "^7.0", + "ext-SimpleXML": "^7.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.2", + "fzaninotto/faker": "^1.9", + "vlucas/phpdotenv": "^5.1" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..0fd47d7 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2565 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "740aecc5e2319aaf77d3b09e7feae5d4", + "packages": [ + { + "name": "guzzlehttp/guzzle", + "version": "7.0.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "2d9d3c186a6637a43193e66b097c50e4451eaab2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/2d9d3c186a6637a43193e66b097c50e4451eaab2", + "reference": "2d9d3c186a6637a43193e66b097c50e4451eaab2", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.6.1", + "php": "^7.2.5", + "psr/http-client": "^1.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.0", + "ext-curl": "*", + "php-http/client-integration-tests": "dev-phpunit8", + "phpunit/phpunit": "^8.5.5", + "psr/log": "^1.1" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "time": "2020-06-27T10:33:25+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2019-07-01T23:21:34+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "time": "2020-06-29T06:28:15+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2019-03-08T08:55:37+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", + "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2020-05-29T17:27:14+00:00" + }, + { + "name": "fzaninotto/faker", + "version": "v1.9.1", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/fc10d778e4b84d5bd315dad194661e091d307c6f", + "reference": "fc10d778e4b84d5bd315dad194661e091d307c6f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "ext-intl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^2.9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "time": "2019-12-12T13:22:17+00:00" + }, + { + "name": "graham-campbell/result-type", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "7e279d2cd5d7fbb156ce46daada972355cea27bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/7e279d2cd5d7fbb156ce46daada972355cea27bb", + "reference": "7e279d2cd5d7fbb156ce46daada972355cea27bb", + "shasum": "" + }, + "require": { + "php": "^7.0|^8.0", + "phpoption/phpoption": "^1.7.3" + }, + "require-dev": { + "phpunit/phpunit": "^6.5|^7.5|^8.5|^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GrahamCampbell\\ResultType\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "graham@alt-three.com" + } + ], + "description": "An Implementation Of The Result Type", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Result Type", + "Result-Type", + "result" + ], + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", + "type": "tidelift" + } + ], + "time": "2020-04-13T13:17:36+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.10.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-06-29T13:22:24+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "shasum": "" + }, + "require": { + "ext-filter": "^7.1", + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.0", + "webmozart/assert": "^1" + }, + "require-dev": { + "doctrine/instantiator": "^1", + "mockery/mockery": "^1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2020-02-22T12:28:44+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2020-06-27T10:12:23+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.7.4", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3", + "reference": "b2ada2ad5d8a32b89088b8adc31ecd2e3a13baf3", + "shasum": "" + }, + "require": { + "php": "^5.5.9 || ^7.0 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.3", + "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2020-06-07T10:40:07+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.11.1", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b20034be5efcdab4fb60ca3a29cba2949aead160", + "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2", + "php": "^7.2", + "phpdocumentor/reflection-docblock": "^5.0", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^6.0", + "phpunit/phpunit": "^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2020-07-08T12:44:21+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "8.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca6647ffddd2add025ab3f21644a441d7c146cdc", + "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "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" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-pcov": "*", + "ext-xdebug": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.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 that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-05-23T08:02:54+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/25fefc5b19835ca653877fe081644a3f8c1d915e", + "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.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": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-11T05:18:21+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "f6eedfed1085dd1f4c599629459a0277d25f9a66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f6eedfed1085dd1f4c599629459a0277d25f9a66", + "reference": "f6eedfed1085dd1f4c599629459a0277d25f9a66", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.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": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T11:53:53+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", + "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "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": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T11:55:37+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/cc49734779cbb302bf51a44297dab8c4bbf941e7", + "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.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": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "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" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-27T06:36:25+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.2.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "1c6a9e4312e209e659f1fce3ce88dd197c2448f6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1c6a9e4312e209e659f1fce3ce88dd197c2448f6", + "reference": "1c6a9e4312e209e659f1fce3ce88dd197c2448f6", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "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", + "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/environment": "^5.1.2", + "sebastian/exporter": "^4.0.2", + "sebastian/global-state": "^4.0", + "sebastian/object-enumerator": "^4.0.2", + "sebastian/resource-operations": "^3.0.2", + "sebastian/type": "^2.1.1", + "sebastian/version": "^3.0.1" + }, + "require-dev": { + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-13T17:55:55+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "c1e2df332c905079980b119c4db103117e5e5c90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/c1e2df332c905079980b119c4db103117e5e5c90", + "reference": "c1e2df332c905079980b119c4db103117e5e5c90", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "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": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:50:45+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ee51f9bb0c6d8a43337055db3120829fa14da819", + "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "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" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:04:00+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", + "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.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" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:05:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", + "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0", + "symfony/process": "^4.2 || ^5" + }, + "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" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-30T04:46:02+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", + "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:07:24+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "571d721db4aec847a0e59690b954af33ebf9f023" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/571d721db4aec847a0e59690b954af33ebf9f023", + "reference": "571d721db4aec847a0e59690b954af33ebf9f023", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.2" + }, + "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" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:08:55+00:00" + }, + { + "name": "sebastian/global-state", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bdb1e7c79e592b8c82cb1699be3c8743119b8a72", + "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72", + "shasum": "" + }, + "require": { + "php": "^7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "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": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2020-02-07T06:11:37+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/074fed2d0a6d08e1677dd8ce9d32aecb384917b8", + "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.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": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:11:32+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "127a46f6b057441b201253526f81d5406d6c7840" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/127a46f6b057441b201253526f81d5406d6c7840", + "reference": "127a46f6b057441b201253526f81d5406d6c7840", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "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" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:12:55+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/062231bf61d2b9448c4fa5a7643b5e1829c11d63", + "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63", + "shasum": "" + }, + "require": { + "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" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:14:17+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0653718a5a629b065e91f774595267f8dc32e213" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0653718a5a629b065e91f774595267f8dc32e213", + "reference": "0653718a5a629b065e91f774595267f8dc32e213", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:16:22+00:00" + }, + { + "name": "sebastian/type", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-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": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-05T08:31:53+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "626586115d0ed31cb71483be55beb759b5af5a3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/626586115d0ed31cb71483be55beb759b5af5a3c", + "reference": "626586115d0ed31cb71483be55beb759b5af5a3c", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.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 that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:18:43+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.18.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.18.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a", + "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.18.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/d87d5766cbf48d72388a9f6b85f280c8ad51f981", + "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981", + "shasum": "" + }, + "require": { + "php": ">=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "75a63c33a8577608444246075ea0af0d052e452a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", + "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2020-07-12T23:59:07+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v5.1.0", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "448c76d7a9e30c341ff5bc367a923af74ae18467" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/448c76d7a9e30c341ff5bc367a923af74ae18467", + "reference": "448c76d7a9e30c341ff5bc367a923af74ae18467", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "graham-campbell/result-type": "^1.0.1", + "php": "^7.1.3 || ^8.0", + "phpoption/phpoption": "^1.7.4", + "symfony/polyfill-ctype": "^1.17", + "symfony/polyfill-mbstring": "^1.17", + "symfony/polyfill-php80": "^1.17" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "ext-filter": "*", + "phpunit/phpunit": "^7.5.20 || ^8.5.2 || ^9.0" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "graham@alt-three.com", + "homepage": "https://gjcampbell.co.uk/" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://vancelucas.com/" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "type": "tidelift" + } + ], + "time": "2020-07-14T19:26:25+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.9.1", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2020-07-08T17:02:28+00:00" + } + ], + "aliases": [], + "minimum-stability": "alpha", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "ext-simplexml": "^7.4" + }, + "platform-dev": [], + "plugin-api-version": "1.1.0" +} diff --git a/examples/get-categories.php b/examples/get-categories.php new file mode 100644 index 0000000..a6a24af --- /dev/null +++ b/examples/get-categories.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +use EPGService\Environments\ServiceEnvironment; +use EPGService\Presenter\ServicePresenter; +use EPGService\Repositories\CategoryRepository; + +$key = getenv('EPG_SERVICE_KEY'); +$environment = ServiceEnvironment::create($key); + +# Using presenter +$presenter = ServicePresenter::create($environment); +$categories = $presenter->getCategories(); + +# Or using repository +$repository = CategoryRepository::create($environment); +$categories = $repository->get(); diff --git a/examples/get-channels.php b/examples/get-channels.php new file mode 100644 index 0000000..645eb96 --- /dev/null +++ b/examples/get-channels.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +use EPGService\Environments\ServiceEnvironment; +use EPGService\Presenter\ServicePresenter; +use EPGService\Repositories\ChannelRepository; + +$key = getenv('EPG_SERVICE_KEY'); +$environment = ServiceEnvironment::create($key); + +# Using presenter +$presenter = ServicePresenter::create($environment); +$channels = $presenter->getChannels(); + +# Or using repository +$repository = ChannelRepository::create($environment); +$channels = $repository->get(); diff --git a/examples/get-genres.php b/examples/get-genres.php new file mode 100644 index 0000000..2bfe576 --- /dev/null +++ b/examples/get-genres.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +use EPGService\Environments\ServiceEnvironment; +use EPGService\Presenter\ServicePresenter; +use EPGService\Repositories\GenreRepository; + +$key = getenv('EPG_SERVICE_KEY'); +$environment = ServiceEnvironment::create($key); + +# Using presenter +$presenter = ServicePresenter::create($environment); +$genres = $presenter->getGenres(); + +# Or using repository +$repository = GenreRepository::create($environment); +$genres = $repository->get(); diff --git a/examples/get-programs.php b/examples/get-programs.php new file mode 100644 index 0000000..9dbe581 --- /dev/null +++ b/examples/get-programs.php @@ -0,0 +1,38 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +use EPGService\Environments\ServiceEnvironment; +use EPGService\Presenter\ServicePresenter; +use EPGService\Repositories\ProgramRepository; + +$key = getenv('EPG_SERVICE_KEY'); +$environment = ServiceEnvironment::create($key); + +$channels = ServicePresenter::create($environment)->getChannels(); +$channel = array_shift($channels); + +# Using presenter +$presenter = ServicePresenter::create($environment); +$current_week = date('Y-m-d', strtotime('this week')); +$programs = $presenter->getPrograms($channel->id, $current_week); + +# Or using repository +$current_week = date('Y-m-d', strtotime('this week')); +$repository = ProgramRepository::create($environment, $channel->id, $current_week); +$programs = $repository->get(); diff --git a/src/Entities/CategoryEntity.php b/src/Entities/CategoryEntity.php new file mode 100644 index 0000000..2d113a4 --- /dev/null +++ b/src/Entities/CategoryEntity.php @@ -0,0 +1,110 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Entities; + +use RuntimeException; +use function is_string; + +/** + * @property-read string $id + * @property-read string $lang + * @property-read string $name + * @property-read string $version + * + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Entities + */ +final class CategoryEntity { + /** + * @var string + */ + private string $id; + + /** + * @var string + */ + private string $lang; + + /** + * @var string + */ + private string $name; + + /** + * @var string + */ + private string $version; + + /** + * @param array $payload + */ + private function __construct(array $payload) { + $this->id = $payload['id']; + $this->lang = $payload['lang']; + $this->name = $payload['name']; + $this->version = $payload['version']; + } + + /** + * @param array $payload + * + * @return \EPGService\Entities\CategoryEntity + * @throws \RuntimeException + */ + public static function create(array $payload): CategoryEntity { + if (!is_string($payload['id'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['lang'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['name'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['version'])) { + throw new RuntimeException('blah-blah-blah'); + } + + return new CategoryEntity($payload); + } + + /** + * @param string $name + * + * @return mixed + */ + public function __get(string $name) { + return $this->$name; + } + + /** + * @param string $name + * @param mixed $value + * + * @throws \RuntimeException + */ + public function __set(string $name, $value) { + throw new RuntimeException('blah-blah-blah'); + } +} diff --git a/src/Entities/ChannelEntity.php b/src/Entities/ChannelEntity.php new file mode 100644 index 0000000..4881722 --- /dev/null +++ b/src/Entities/ChannelEntity.php @@ -0,0 +1,189 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Entities; + +use DateTime; +use RuntimeException; +use function is_string; + +/** + * @property-read string $base_id + * @property-read string $base_name + * @property-read string $epg_id + * @property-read string $geo_data + * @property-read string $href + * @property-read string $icon + * @property-read string $id + * @property-read string $lang + * @property-read string $name + * @property-read \DateTime $update_at + * @property-read string $week + * + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Entities + */ +final class ChannelEntity { + /** + * @var string + */ + private string $base_id; + + /** + * @var string + */ + private string $base_name; + + /** + * @var string + */ + private string $epg_id; + + /** + * @var string + */ + private string $geo_data; + + /** + * @var string + */ + private string $href; + + /** + * @var string + */ + private string $icon; + + /** + * @var string + */ + private string $id; + + /** + * @var string + */ + private string $lang; + + /** + * @var string + */ + private string $name; + + /** + * @var \DateTime + */ + private DateTime $update_at; + + /** + * @var string + */ + private string $week; + + /** + * @param array $payload + */ + private function __construct(array $payload) { + $this->base_id = $payload['base_id']; + $this->base_name = $payload['base_name']; + $this->epg_id = $payload['epg_id']; + $this->geo_data = $payload['geo_data']; + $this->href = $payload['href']; + $this->icon = $payload['icon']; + $this->id = $payload['id']; + $this->lang = $payload['lang']; + $this->name = $payload['name']; + $this->update_at = $payload['update_at']; + $this->week = $payload['week']; + } + + /** + * @param array $payload + * + * @return \EPGService\Entities\ChannelEntity + * + * @throws \RuntimeException + */ + public static function create(array $payload): ChannelEntity { + if (!is_string($payload['base_id'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['base_name'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['epg_id'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['geo_data'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['href'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['icon'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['id'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['lang'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['name'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!$payload['update_at'] instanceof DateTime) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['week'])) { + throw new RuntimeException('blah-blah-blah'); + } + + return new ChannelEntity($payload); + } + + /** + * @param string $name + * + * @return mixed + */ + public function __get(string $name) { + return $this->$name; + } + + /** + * @param string $name + * @param mixed $value + * + * @throws \RuntimeException + */ + public function __set(string $name, $value) { + throw new RuntimeException('blah-blah-blah'); + } +} diff --git a/src/Entities/CountryEntity.php b/src/Entities/CountryEntity.php new file mode 100644 index 0000000..bf8b6f7 --- /dev/null +++ b/src/Entities/CountryEntity.php @@ -0,0 +1,122 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Entities; + +use RuntimeException; +use function is_string; + +/** + * @property-read string $id + * @property-read string $iso + * @property-read string $lang + * @property-read string $name + * @property-read string $version + * + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Entities + */ +final class CountryEntity { + /** + * @var string + */ + private string $id; + + /** + * @var string + */ + private string $iso; + + /** + * @var string + */ + private string $lang; + + /** + * @var string + */ + private string $name; + + /** + * @var string + */ + private string $version; + + /** + * @param array $payload + */ + private function __construct(array $payload) { + $this->id = $payload['id']; + $this->iso = $payload['iso']; + $this->lang = $payload['lang']; + $this->name = $payload['name']; + $this->version = $payload['version']; + } + + /** + * @param array $payload + * + * @return \EPGService\Entities\CountryEntity + * + * @throws \RuntimeException + */ + public static function create(array $payload): CountryEntity { + if (!is_string($payload['id'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['iso'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['lang'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['name'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['version'])) { + throw new RuntimeException('blah-blah-blah'); + } + + return new CountryEntity($payload); + } + + /** + * @param string $name + * + * @return mixed + */ + public function __get(string $name) { + return $this->$name; + } + + /** + * @param string $name + * @param mixed $value + * + * @throws \RuntimeException + */ + public function __set(string $name, $value) { + throw new RuntimeException('blah-blah-blah'); + } +} diff --git a/src/Entities/GenreEntity.php b/src/Entities/GenreEntity.php new file mode 100644 index 0000000..ee81041 --- /dev/null +++ b/src/Entities/GenreEntity.php @@ -0,0 +1,104 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Entities; + +use RuntimeException; +use function is_string; + +/** + * @property-read string $id + * @property-read string $lang + * @property-read string $name + * @property-read string $version + * + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Entities + */ +final class GenreEntity { + /** + * @var string + */ + private string $id; + + /** + * @var string + */ + private string $lang; + + /** + * @var string + */ + private string $name; + + /** + * @var string + */ + private string $version; + + /** + * @param array $payload + */ + private function __construct(array $payload) { + $this->id = $payload['id']; + $this->lang = $payload['lang']; + $this->name = $payload['name']; + $this->version = $payload['version']; + } + + public static function create(array $payload): GenreEntity { + if (!is_string($payload['id'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['lang'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['name'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['version'])) { + throw new RuntimeException('blah-blah-blah'); + } + + return new GenreEntity($payload); + } + + /** + * @param string $name + * + * @return mixed + */ + public function __get(string $name) { + return $this->$name; + } + + /** + * @param string $name + * @param mixed $value + * + * @throws \RuntimeException + */ + public function __set(string $name, $value) { + throw new RuntimeException('blah-blah-blah'); + } +} diff --git a/src/Entities/Program/CreditEntity.php b/src/Entities/Program/CreditEntity.php new file mode 100644 index 0000000..f7088ea --- /dev/null +++ b/src/Entities/Program/CreditEntity.php @@ -0,0 +1,89 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Entities\Program; + +use RuntimeException; +use function is_string; + +/** + * @property-read string $name + * @property-read string $type + * + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Entities\Program + */ +final class CreditEntity { + /** + * @var string + */ + private string $name; + + /** + * @var string + */ + private string $type; + + /** + * @param array $payload + */ + private function __construct(array $payload) { + $this->name = $payload['name']; + $this->type = $payload['type']; + } + + /** + * @param array $payload + * + * @return \EPGService\Entities\Program\CreditEntity + * + * @throws \RuntimeException + */ + public static function create(array $payload): CreditEntity { + if (!is_string($payload['name'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['type'])) { + throw new RuntimeException('blah-blah-blah'); + } + + return new CreditEntity($payload); + } + + /** + * @param string $name + * + * @return mixed + */ + public function __get(string $name) { + return $this->$name; + } + + /** + * @param string $name + * @param mixed $value + * + * @throws \RuntimeException + */ + public function __set(string $name, $value) { + throw new RuntimeException('blah-blah-blah'); + } +} diff --git a/src/Entities/ProgramEntity.php b/src/Entities/ProgramEntity.php new file mode 100644 index 0000000..04017c6 --- /dev/null +++ b/src/Entities/ProgramEntity.php @@ -0,0 +1,223 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Entities; + +use DateTime; +use RuntimeException; +use function is_array; +use function is_string; + +/** + * @property-read \EPGService\Entities\Program\CreditEntity[]|null $credits + * @property-read \DateTime $date + * @property-read \DateTime $start + * @property-read \DateTime $stop + * @property-read string $channel_id + * @property-read string|null $description + * @property-read string|null $parents_guide + * @property-read string|null $sub_title + * @property-read string $title + * @property-read string|null $year + * @property-read string[]|null $categories + * @property-read string[]|null $countries + * @property-read string[]|null $icons + * @property-read string[]|null $productions + * + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Entities + */ +final class ProgramEntity { + /** + * @var string[]|null + */ + private ?array $categories; + + /** + * @var string + */ + private string $channel_id; + + /** + * @var string[]|null + */ + private ?array $countries; + + /** + * @var \EPGService\Entities\Program\CreditEntity[]|null + */ + private ?array $credits; + + /** + * @var \DateTime + */ + private DateTime $date; + + /** + * @var string|null + */ + private ?string $description; + + /** + * @var string[]|null + */ + private ?array $icons; + + /** + * @var string|null + */ + private ?string $parents_guide; + + /** + * @var string[]|null + */ + private ?array $productions; + + /** + * @var \DateTime + */ + private DateTime $start; + + /** + * @var \DateTime + */ + private DateTime $stop; + + /** + * @var string|null + */ + private ?string $sub_title; + + /** + * @var string + */ + private string $title; + + /** + * @var string|null + */ + private ?string $year; + + /** + * @param array $payload + */ + private function __construct(array $payload) { + $this->categories = $payload['categories'] ?? null; + $this->channel_id = $payload['channel_id']; + $this->countries = $payload['countries'] ?? null; + $this->credits = $payload['credits'] ?? null; + $this->date = $payload['date']; + $this->description = $payload['description'] ?? null; + $this->icons = $payload['icons'] ?? null; + $this->parents_guide = $payload['parents_guide'] ?? null; + $this->productions = $payload['productions'] ?? null; + $this->start = $payload['start']; + $this->stop = $payload['stop']; + $this->sub_title = $payload['sub_title'] ?? null; + $this->title = $payload['title']; + $this->year = $payload['year'] ?? null; + } + + /** + * @param array $payload + * + * @return \EPGService\Entities\ProgramEntity + * + * @throws \RuntimeException + */ + public static function create(array $payload): ProgramEntity { + if (isset($payload['categories']) && !is_array($payload['categories'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['channel_id'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (isset($payload['countries']) && !is_array($payload['countries'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (isset($payload['credits']) && !is_array($payload['credits'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!$payload['date'] instanceof DateTime) { + throw new RuntimeException('blah-blah-blah'); + } + + if (isset($payload['description']) && !is_string($payload['description'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (isset($payload['icons']) && !is_array($payload['icons'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (isset($payload['parents_guide']) && !is_string($payload['parents_guide'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (isset($payload['productions']) && !is_array($payload['productions'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!$payload['start'] instanceof DateTime) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!$payload['stop'] instanceof DateTime) { + throw new RuntimeException('blah-blah-blah'); + } + + if (isset($payload['sub_title']) && !is_string($payload['sub_title'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (!is_string($payload['title'])) { + throw new RuntimeException('blah-blah-blah'); + } + + if (isset($payload['year']) && !is_string($payload['year'])) { + throw new RuntimeException('blah-blah-blah'); + } + + return new ProgramEntity($payload); + } + + /** + * @param string $name + * + * @return mixed + */ + public function __get(string $name) { + return $this->$name; + } + + /** + * @param string $name + * @param mixed $value + * + * @throws \RuntimeException + */ + public function __set(string $name, $value) { + throw new RuntimeException('blah-blah-blah'); + } +} diff --git a/src/Environments/ServiceEnvironment.php b/src/Environments/ServiceEnvironment.php new file mode 100644 index 0000000..53ab732 --- /dev/null +++ b/src/Environments/ServiceEnvironment.php @@ -0,0 +1,60 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Environments; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Environments + */ +class ServiceEnvironment { + /** + * @var string + */ + protected const BASE_URL = 'http://xmldata.epgservice.ru/EPGService/hs/xmldata/%s/'; + + /** + * @var string + */ + private string $key; + + /** + * @param string $key + */ + protected function __construct(string $key) { + $this->key = $key; + } + + /** + * @param string $key + * + * @return \EPGService\Environments\ServiceEnvironment + */ + public static function create(string $key): ServiceEnvironment { + return new ServiceEnvironment($key); + } + + /** + * @return string + */ + public function getUrl(): string { + return sprintf(self::BASE_URL, $this->key); + } +} diff --git a/src/Parsers/BaseParser.php b/src/Parsers/BaseParser.php new file mode 100644 index 0000000..d36508d --- /dev/null +++ b/src/Parsers/BaseParser.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Parsers; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Parsers + */ +interface BaseParser { + /** + * @param mixed $value + * + * @return mixed + */ + public static function get($value); +} diff --git a/src/Parsers/IntegerParser.php b/src/Parsers/IntegerParser.php new file mode 100644 index 0000000..ba89315 --- /dev/null +++ b/src/Parsers/IntegerParser.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Parsers; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Parsers + */ +final class IntegerParser implements BaseParser { + /** + * @param mixed $value + * + * @return int + */ + public static function get($value): int { + return filter_var($value, FILTER_VALIDATE_INT); + } +} diff --git a/src/Parsers/StringParser.php b/src/Parsers/StringParser.php new file mode 100644 index 0000000..8473106 --- /dev/null +++ b/src/Parsers/StringParser.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Parsers; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Parsers + */ +final class StringParser implements BaseParser { + /** + * @param $value + * + * @return string + */ + public static function get($value): string { + return filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); + } +} diff --git a/src/Presenter/ServicePresenter.php b/src/Presenter/ServicePresenter.php new file mode 100644 index 0000000..e3117ed --- /dev/null +++ b/src/Presenter/ServicePresenter.php @@ -0,0 +1,101 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Presenter; + +use EPGService\Environments\ServiceEnvironment; +use EPGService\Repositories\CategoryRepository; +use EPGService\Repositories\ChannelRepository; +use EPGService\Repositories\GenreRepository; +use EPGService\Repositories\ProgramRepository; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Presenter + */ +final class ServicePresenter { + /** + * @var \EPGService\Environments\ServiceEnvironment + */ + private ServiceEnvironment$environment; + + /** + * @param \EPGService\Environments\ServiceEnvironment $environment + */ + private function __construct(ServiceEnvironment $environment) { + $this->environment = $environment; + } + + /** + * @param \EPGService\Environments\ServiceEnvironment $environment + * + * @return \EPGService\Presenter\ServicePresenter + */ + public static function create(ServiceEnvironment $environment): ServicePresenter { + return new ServicePresenter($environment); + } + + /** + * @return \EPGService\Entities\CategoryEntity[] + * + * @throws \GuzzleHttp\Exception\GuzzleException + * @throws \RuntimeException + * @throws \Exception + */ + public function getCategories(): array { + return CategoryRepository::create($this->environment)->get(); + } + + /** + * @return \EPGService\Entities\ChannelEntity[] + * + * @throws \GuzzleHttp\Exception\GuzzleException + * @throws \RuntimeException + * @throws \Exception + */ + public function getChannels(): array { + return ChannelRepository::create($this->environment)->get(); + } + + /** + * @return \EPGService\Entities\GenreEntity[] + * + * @throws \GuzzleHttp\Exception\GuzzleException + * @throws \RuntimeException + * @throws \Exception + */ + public function getGenres(): array { + return GenreRepository::create($this->environment)->get(); + } + + /** + * @param string $channel_id + * @param string $week + * + * @return \EPGService\Entities\ProgramEntity[] + * + * @throws \GuzzleHttp\Exception\GuzzleException + * @throws \RuntimeException + * @throws \Exception + */ + public function getPrograms(string $channel_id, string $week): array { + return ProgramRepository::create($this->environment, $channel_id, $week)->get(); + } +} diff --git a/src/Repositories/BaseRepository.php b/src/Repositories/BaseRepository.php new file mode 100644 index 0000000..14c9061 --- /dev/null +++ b/src/Repositories/BaseRepository.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Repositories; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Repositories + */ +interface BaseRepository { + /** + * @return mixed + */ + public function get(); +} diff --git a/src/Repositories/CategoryRepository.php b/src/Repositories/CategoryRepository.php new file mode 100644 index 0000000..6139168 --- /dev/null +++ b/src/Repositories/CategoryRepository.php @@ -0,0 +1,104 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Repositories; + +use EPGService\Entities\CategoryEntity; +use EPGService\Environments\ServiceEnvironment; +use EPGService\Parsers\IntegerParser; +use EPGService\Parsers\StringParser; +use GuzzleHttp\Client; +use RuntimeException; +use SimpleXMLElement; +use function is_bool; +use function simplexml_load_string; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Repositories + */ +final class CategoryRepository implements BaseRepository { + /** + * @var string + */ + private const METHOD = 'category_list'; + + /** + * @var \GuzzleHttp\Client + */ + private Client $client; + + /** + * @param \EPGService\Environments\ServiceEnvironment $environment + */ + private function __construct(ServiceEnvironment $environment) { + $this->client = new Client([ + 'base_uri' => $environment->getUrl(), + ]); + } + + /** + * @param \EPGService\Environments\ServiceEnvironment $environment + * + * @return \EPGService\Repositories\CategoryRepository + */ + public static function create(ServiceEnvironment $environment): CategoryRepository { + return new CategoryRepository($environment); + } + + /** + * @return array + * + * @throws \GuzzleHttp\Exception\GuzzleException + * @throws \RuntimeException + */ + public function get(): array { + $response = $this->client->get(self::METHOD); + $content = $response->getBody()->getContents(); + $xml = simplexml_load_string($content); + + if (is_bool($xml) || !$xml->element instanceof SimpleXMLElement) { + throw new RuntimeException('blah-blah-blah'); + } + + $result = []; + + foreach ($xml->element as $element) { + if (!$element instanceof SimpleXMLElement) { + trigger_error('blah-blah-blah', E_USER_WARNING); + continue; + } + + if (!$element->name instanceof SimpleXMLElement) { + trigger_error('blah-blah-blah', E_USER_WARNING); + continue; + } + + $result[] = CategoryEntity::create([ + 'id' => IntegerParser::get($element['id']), + 'lang' => StringParser::get($element->name['lang']), + 'name' => StringParser::get($element->name), + 'version' => StringParser::get($element['version']), + ]); + } + + return $result; + } +} diff --git a/src/Repositories/ChannelRepository.php b/src/Repositories/ChannelRepository.php new file mode 100644 index 0000000..772e4f9 --- /dev/null +++ b/src/Repositories/ChannelRepository.php @@ -0,0 +1,108 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Repositories; + +use DateTime; +use EPGService\Entities\ChannelEntity; +use EPGService\Environments\ServiceEnvironment; +use EPGService\Parsers\StringParser; +use GuzzleHttp\Client; +use RuntimeException; +use SimpleXMLElement; +use function is_bool; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Repositories + */ +final class ChannelRepository implements BaseRepository { + /** + * @var string + */ + private const METHOD = 'index'; + + /** + * @var \GuzzleHttp\Client + */ + private Client $client; + + /** + * @param \EPGService\Environments\ServiceEnvironment $environment + */ + private function __construct(ServiceEnvironment $environment) { + $this->client = new Client([ + 'base_uri' => $environment->getUrl(), + ]); + } + + /** + * @param \EPGService\Environments\ServiceEnvironment $environment + * + * @return \EPGService\Repositories\ChannelRepository + */ + public static function create(ServiceEnvironment $environment): ChannelRepository { + return new ChannelRepository($environment); + } + + /** + * @return \EPGService\Entities\ChannelEntity[] + * + * @throws \GuzzleHttp\Exception\GuzzleException + * @throws \RuntimeException + * @throws \Exception + */ + public function get(): array { + $response = $this->client->get(self::METHOD); + $content = $response->getBody()->getContents(); + $xml = simplexml_load_string($content); + + if (is_bool($xml) || !$xml->channel instanceof SimpleXMLElement) { + throw new RuntimeException('blah-blah-blah'); + } + + $result = []; + + foreach ($xml->channel as $element) { + if (!$element instanceof SimpleXMLElement) { + trigger_error('blah-blah-blah', E_USER_WARNING); + continue; + } + + $update = StringParser::get($element->update); + + $result[] = ChannelEntity::create([ + 'base_id' => StringParser::get($element->{'base-channel'}), + 'base_name' => StringParser::get($element->{'base-channel'}['id']), + 'epg_id' => StringParser::get($element['epgsrvc_id']), + 'geo_data' => StringParser::get($element->{'geo-data'}), + 'href' => StringParser::get($element->href), + 'icon' => StringParser::get($element->icon['src']), + 'id' => StringParser::get($element['id']), + 'lang' => StringParser::get($element->{'display-name'}['lang']), + 'name' => StringParser::get($element->{'base-channel'}), + 'update_at' => new DateTime($update), + 'week' => StringParser::get($element->week), + ]); + } + + return $result; + } +} diff --git a/src/Repositories/CountryRepository.php b/src/Repositories/CountryRepository.php new file mode 100644 index 0000000..cb7e3ae --- /dev/null +++ b/src/Repositories/CountryRepository.php @@ -0,0 +1,92 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Repositories; + +use EPGService\Entities\CountryEntity; +use EPGService\Environments\ServiceEnvironment; +use EPGService\Parsers\StringParser; +use GuzzleHttp\Client; +use RuntimeException; +use SimpleXMLElement; +use function is_bool; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Repositories + */ +final class CountryRepository implements BaseRepository { + /** + * @var string + */ + private const METHOD = 'country_list'; + + /** + * @var \GuzzleHttp\Client + */ + private Client $client; + + /** + * @param \EPGService\Environments\ServiceEnvironment $environment + */ + private function __construct(ServiceEnvironment $environment) { + $this->client = new Client([ + 'base_uri' => $environment->getUrl(), + ]); + } + + /** + * @param \EPGService\Environments\ServiceEnvironment $environment + * + * @return \EPGService\Repositories\CountryRepository + */ + public static function create(ServiceEnvironment $environment): CountryRepository { + return new CountryRepository($environment); + } + + public function get(): array { + $response = $this->client->get(self::METHOD); + $content = $response->getBody()->getContents(); + $xml = simplexml_load_string($content); + + if (is_bool($xml) || !$xml->element instanceof SimpleXMLElement) { + throw new RuntimeException('blah-blah-blah'); + } + + $result = []; + + foreach ($xml->element as $element) { + if (!$element instanceof SimpleXMLElement) { + trigger_error('blah-blah-blah', E_USER_WARNING); + continue; + } + + $result[] = CountryEntity::create([ + 'id' => StringParser::get($element['id']), + 'iso' => StringParser::get($element['ISO']), + 'lang' => StringParser::get($element->name['lang']), + 'name' => StringParser::get($element->name), + 'version' => StringParser::get($element['version']), + ]); + } + + return $result; + } +} diff --git a/src/Repositories/GenreRepository.php b/src/Repositories/GenreRepository.php new file mode 100644 index 0000000..67c9a4e --- /dev/null +++ b/src/Repositories/GenreRepository.php @@ -0,0 +1,103 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Repositories; + +use EPGService\Entities\GenreEntity; +use EPGService\Environments\ServiceEnvironment; +use EPGService\Parsers\IntegerParser; +use EPGService\Parsers\StringParser; +use GuzzleHttp\Client; +use RuntimeException; +use SimpleXMLElement; +use function is_bool; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Repositories + */ +final class GenreRepository implements BaseRepository { + /** + * @var string + */ + private const METHOD = 'genre_list'; + + /** + * @var \GuzzleHttp\Client + */ + private Client $client; + + /** + * @param \EPGService\Environments\ServiceEnvironment $environment + */ + private function __construct(ServiceEnvironment $environment) { + $this->client = new Client([ + 'base_uri' => $environment->getUrl(), + ]); + } + + /** + * @param \EPGService\Environments\ServiceEnvironment $env + * + * @return \EPGService\Repositories\GenreRepository + */ + public static function create(ServiceEnvironment $env): GenreRepository { + return new GenreRepository($env); + } + + /** + * @return \EPGService\Entities\GenreEntity[] + * + * @throws \GuzzleHttp\Exception\GuzzleException + * @throws \RuntimeException + */ + public function get(): array { + $response = $this->client->get(self::METHOD); + $content = $response->getBody()->getContents(); + $xml = simplexml_load_string($content); + + if (is_bool($xml) || !$xml->element instanceof SimpleXMLElement) { + throw new RuntimeException('blah-blah-blah'); + } + + $result = []; + + foreach ($xml->element as $element) { + if (!$element instanceof SimpleXMLElement) { + trigger_error('blah-blah-blah', E_USER_WARNING); + continue; + } + + if (!$element->name instanceof SimpleXMLElement) { + trigger_error('blah-blah-blah', E_USER_WARNING); + continue; + } + + $result[] = GenreEntity::create([ + 'id' => IntegerParser::get($element['id']), + 'lang' => StringParser::get($element->name['lang']), + 'name' => StringParser::get($element->name), + 'version' => StringParser::get($element['version']), + ]); + } + + return $result; + } +} diff --git a/src/Repositories/ProgramRepository.php b/src/Repositories/ProgramRepository.php new file mode 100644 index 0000000..56884da --- /dev/null +++ b/src/Repositories/ProgramRepository.php @@ -0,0 +1,190 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace EPGService\Repositories; + +use DateTime; +use EPGService\Entities\Program\CreditEntity; +use EPGService\Entities\ProgramEntity; +use EPGService\Environments\ServiceEnvironment; +use GuzzleHttp\Client; +use GuzzleHttp\RequestOptions; +use RuntimeException; +use function is_array; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package EPGService\Repositories + */ +final class ProgramRepository implements BaseRepository { + /** + * @var string + */ + private const METHOD = 'file/%s'; + + /** + * @var string + */ + private string $channel_id; + + /** + * @var \GuzzleHttp\Client + */ + private Client $client; + + /** + * @var string + */ + private string $week; + + /** + * @param \EPGService\Environments\ServiceEnvironment $environment + * @param string $channel_id + * @param string $week + */ + private function __construct(ServiceEnvironment $environment, string $channel_id, string $week) { + $this->channel_id = $channel_id; + $this->week = $week; + + $this->client = new Client([ + 'base_uri' => $environment->getUrl(), + ]); + } + + /** + * @param \EPGService\Environments\ServiceEnvironment $environment + * @param string $channel_id + * @param string $week + * + * @return \EPGService\Repositories\ProgramRepository + */ + public static function create(ServiceEnvironment $environment, string $channel_id, string $week): ProgramRepository { + return new ProgramRepository($environment, $channel_id, $week); + } + + /** + * @param array $payload + * + * @return \EPGService\Entities\Program\CreditEntity[] + * + * @throws \RuntimeException + */ + private static function getCreditEntities(array $payload): array { + return array_map(static function (array $value): CreditEntity { + return CreditEntity::create($value); + }, $payload); + } + + /** + * @param array $payload + * + * @return \EPGService\Entities\ProgramEntity + * + * @throws \RuntimeException + * @throws \Exception + */ + private static function getProgramEntity(array $payload): ProgramEntity { + $data = []; + + foreach ($payload as $name => $value) { + switch ($name) { + case 'category': + $data['categories'] = $value; + break; + case 'channel': + $data['channel_id'] = $value; + break; + case 'country': + $data['countries'] = $value; + break; + case 'credits': + $data['credits'] = self::getCreditEntities($value); + break; + case 'date': + $data['date'] = new DateTime($value); + break; + case 'desc': + $data['description'] = $value; + break; + case 'icon': + $data['icons'] = $value; + break; + case 'pg': + $data['parents_guide'] = $value; + break; + case 'production': + $data['productions'] = $value; + break; + case 'start': + $data['start'] = new DateTime($value); + break; + case 'stop': + $data['stop'] = new DateTime($value); + break; + case 'sub_title': + $data['sub_title'] = $value; + break; + case 'title': + $data['title'] = $value; + break; + case 'year': + $data['year'] = $value; + break; + default: + trigger_error('blah-blah-blah', E_USER_WARNING); + break; + } + } + + return ProgramEntity::create($data); + } + + /** + * @return array + * + * @throws \GuzzleHttp\Exception\GuzzleException + * @throws \RuntimeException + * @throws \Exception + */ + public function get(): array { + $uri = sprintf(self::METHOD, $this->channel_id); + + $response = $this->client->get($uri, [ + RequestOptions::QUERY => [ + 'week' => $this->week, + ], + ]); + + $content = $response->getBody()->getContents(); + $json = json_decode($content, true, 512, JSON_THROW_ON_ERROR); + + if (!is_array($json) || !is_array($json['programms'])) { + throw new RuntimeException('blah-blah-blah'); + } + + $result = []; + + foreach ($json['programms'] as $program) { + $result[] = self::getProgramEntity($program); + } + + return $result; + } +} diff --git a/tests/Entities/CategoryEntityTest.php b/tests/Entities/CategoryEntityTest.php new file mode 100644 index 0000000..35363fa --- /dev/null +++ b/tests/Entities/CategoryEntityTest.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Entities; + +use EPGService\Entities\CategoryEntity; +use Faker\Factory as Faker; +use PHPUnit\Framework\TestCase; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Entities + */ +final class CategoryEntityTest extends TestCase { + public function testCreateEntity(): void { + $faker = Faker::create(); + + $id = $faker->unique()->sha256; + $lang = $faker->unique()->sha256; + $name = $faker->unique()->sha256; + $version = $faker->unique()->sha256; + + $entity = CategoryEntity::create(compact('id', 'lang', 'name', 'version')); + + self::assertEquals($id, $entity->id); + self::assertEquals($lang, $entity->lang); + self::assertEquals($name, $entity->name); + self::assertEquals($version, $entity->version); + } +} diff --git a/tests/Entities/ChannelEntityTest.php b/tests/Entities/ChannelEntityTest.php new file mode 100644 index 0000000..e3c2733 --- /dev/null +++ b/tests/Entities/ChannelEntityTest.php @@ -0,0 +1,73 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Entities; + +use EPGService\Entities\ChannelEntity; +use Faker\Factory; +use PHPUnit\Framework\TestCase; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Entities + */ +final class ChannelEntityTest extends TestCase { + public function testCreateEntity(): void { + $faker = Factory::create(); + + $base_id = $faker->unique()->sha256; + $base_name = $faker->unique()->sha256; + $epg_id = $faker->unique()->sha256; + $geo_data = $faker->unique()->sha256; + $href = $faker->unique()->sha256; + $icon = $faker->unique()->sha256; + $id = $faker->unique()->sha256; + $lang = $faker->unique()->sha256; + $name = $faker->unique()->sha256; + $update_at = $faker->unique()->sha256; + $week = $faker->unique()->sha256; + + $entity = ChannelEntity::create(compact( + 'base_id', + 'base_name', + 'epg_id', + 'geo_data', + 'href', + 'icon', + 'id', + 'lang', + 'name', + 'update_at', + 'week', + )); + + self::assertEquals($base_id, $entity->base_id); + self::assertEquals($base_name, $entity->base_name); + self::assertEquals($epg_id, $entity->epg_id); + self::assertEquals($geo_data, $entity->geo_data); + self::assertEquals($href, $entity->href); + self::assertEquals($icon, $entity->icon); + self::assertEquals($id, $entity->id); + self::assertEquals($lang, $entity->lang); + self::assertEquals($name, $entity->name); + self::assertEquals($update_at, $entity->update_at); + self::assertEquals($week, $entity->week); + } +} diff --git a/tests/Entities/CountryEntityTest.php b/tests/Entities/CountryEntityTest.php new file mode 100644 index 0000000..ffff4fd --- /dev/null +++ b/tests/Entities/CountryEntityTest.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Entities; + +use EPGService\Entities\CountryEntity; +use Faker\Factory as Faker; +use PHPUnit\Framework\TestCase; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Entities + */ +final class CountryEntityTest extends TestCase { + public function testCreateEntity(): void { + $faker = Faker::create(); + + $id = $faker->unique()->sha256; + $iso = $faker->countryCode; + $lang = $faker->languageCode; + $name = $faker->unique()->sha256; + $version = $faker->unique()->sha256; + + $entity = CountryEntity::create(compact('id', 'iso', 'lang', 'name', 'version')); + + self::assertEquals($id, $entity->id); + self::assertEquals($iso, $entity->iso); + self::assertEquals($lang, $entity->lang); + self::assertEquals($name, $entity->name); + self::assertEquals($version, $entity->version); + } +} diff --git a/tests/Entities/GenreEntityTest.php b/tests/Entities/GenreEntityTest.php new file mode 100644 index 0000000..278fb68 --- /dev/null +++ b/tests/Entities/GenreEntityTest.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Entities; + +use EPGService\Entities\GenreEntity; +use Faker\Factory as Faker; +use PHPUnit\Framework\TestCase; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Entities + */ +final class GenreEntityTest extends TestCase { + public function testCreateEntity(): void { + $faker = Faker::create(); + + $id = $faker->unique()->sha256; + $lang = $faker->unique()->sha256; + $name = $faker->unique()->sha256; + $version = $faker->unique()->sha256; + + $entity = GenreEntity::create(compact('id', 'lang', 'name', 'version')); + + self::assertEquals($id, $entity->id); + self::assertEquals($lang, $entity->lang); + self::assertEquals($name, $entity->name); + self::assertEquals($version, $entity->version); + } +} diff --git a/tests/Entities/Program/CreditEntityTest.php b/tests/Entities/Program/CreditEntityTest.php new file mode 100644 index 0000000..3c80300 --- /dev/null +++ b/tests/Entities/Program/CreditEntityTest.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Entities\Program; + +use EPGService\Entities\Program\CreditEntity; +use Faker\Factory as Faker; +use PHPUnit\Framework\TestCase; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Entities\Program + */ +final class CreditEntityTest extends TestCase { + public function testCreateEntity(): void { + $faker = Faker::create(); + + $name = $faker->unique()->sha256; + $type = $faker->unique()->sha256; + + $entity = CreditEntity::create(compact('name', 'type')); + + self::assertEquals($name, $entity->name); + self::assertEquals($type, $entity->type); + } +} diff --git a/tests/Entities/ProgramEntityTest.php b/tests/Entities/ProgramEntityTest.php new file mode 100644 index 0000000..c36e283 --- /dev/null +++ b/tests/Entities/ProgramEntityTest.php @@ -0,0 +1,83 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Entities; + +use EPGService\Entities\ProgramEntity; +use Faker\Factory as Faker; +use PHPUnit\Framework\TestCase; +use Tests\Utilities\GetCreditEntityUtility; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Entities + */ +final class ProgramEntityTest extends TestCase { + public function testCreateEntity(): void { + $faker = Faker::create(); + + $categories = [$faker->unique()->sha256]; + $channel_id = $faker->unique()->sha256; + $countries = [$faker->unique()->sha256]; + $credits = [GetCreditEntityUtility::get()]; + $date = $faker->unique()->dateTime; + $description = $faker->unique()->sha256; + $icons = [$faker->unique()->sha256]; + $parents_guide = $faker->unique()->sha256; + $productions = [$faker->unique()->sha256]; + $start = $faker->unique()->dateTime; + $stop = $faker->unique()->dateTime; + $sub_title = $faker->unique()->sha256; + $title = $faker->unique()->sha256; + $year = $faker->unique()->sha256; + + $entity = ProgramEntity::create(compact( + 'categories', + 'channel_id', + 'countries', + 'credits', + 'date', + 'description', + 'icons', + 'parents_guide', + 'productions', + 'start', + 'stop', + 'sub_title', + 'title', + 'year' + )); + + self::assertEquals($categories, $entity->categories); + self::assertEquals($channel_id, $entity->channel_id); + self::assertEquals($countries[0], $entity->countries[0]); + self::assertEquals($credits[0]->name, $entity->credits[0]->name); + self::assertEquals($date->getTimestamp(), $entity->date->getTimestamp()); + self::assertEquals($description, $entity->description); + self::assertEquals($icons[0], $entity->icons[0]); + self::assertEquals($parents_guide, $entity->parents_guide); + self::assertEquals($productions[0], $entity->productions[0]); + self::assertEquals($start->getTimestamp(), $entity->start->getTimestamp()); + self::assertEquals($stop->getTimestamp(), $entity->stop->getTimestamp()); + self::assertEquals($sub_title, $entity->sub_title); + self::assertEquals($title, $entity->title); + self::assertEquals($year, $entity->year); + } +} diff --git a/tests/Environments/ServiceEnvironmentTest.php b/tests/Environments/ServiceEnvironmentTest.php new file mode 100644 index 0000000..b14d909 --- /dev/null +++ b/tests/Environments/ServiceEnvironmentTest.php @@ -0,0 +1,37 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Environments; + +use EPGService\Environments\ServiceEnvironment; +use Faker\Factory as Faker; +use PHPUnit\Framework\TestCase; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Environments + */ +final class ServiceEnvironmentTest extends TestCase { + public function testGetUrl(): void { + $key = Faker::create()->sha256; + $url = ServiceEnvironment::create($key)->getUrl(); + self::assertStringContainsString($key, $url); + } +} diff --git a/tests/Parsers/IntegerParserTest.php b/tests/Parsers/IntegerParserTest.php new file mode 100644 index 0000000..56c13ce --- /dev/null +++ b/tests/Parsers/IntegerParserTest.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Parsers; + +use EPGService\Parsers\IntegerParser; +use Faker\Factory as Faker; +use PHPUnit\Framework\TestCase; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Parsers + */ +final class IntegerParserTest extends TestCase { + public function testValid(): void { + $number = Faker::create()->numberBetween(100, 200); + self::assertEquals($number, IntegerParser::get((string) $number)); + } +} diff --git a/tests/Parsers/StringParserTest.php b/tests/Parsers/StringParserTest.php new file mode 100644 index 0000000..5c1a82b --- /dev/null +++ b/tests/Parsers/StringParserTest.php @@ -0,0 +1,35 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Parsers; + +use EPGService\Parsers\StringParser; +use PHPUnit\Framework\TestCase; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Parsers + */ +final class StringParserTest extends TestCase { + public function testValid(): void { + $string = '<h1>Hello World!</h1>'; + self::assertEquals('Hello World!', StringParser::get($string)); + } +} diff --git a/tests/Repositories/CategoryRepositoryTest.php b/tests/Repositories/CategoryRepositoryTest.php new file mode 100644 index 0000000..25dbdd8 --- /dev/null +++ b/tests/Repositories/CategoryRepositoryTest.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Repositories; + +use EPGService\Repositories\CategoryRepository; +use PHPUnit\Framework\TestCase; +use Tests\Utilities\GetServiceEnvironment; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Repositories + */ +final class CategoryRepositoryTest extends TestCase { + /** + * @throws \GuzzleHttp\Exception\GuzzleException + * @throws \RuntimeException + * @throws \Exception + */ + public function testGetAction(): void { + $env = GetServiceEnvironment::get(); + + foreach (CategoryRepository::create($env)->get() as $category) { + /** @var \EPGService\Entities\CategoryEntity $category */ + + self::assertIsInt($category->id); + self::assertIsString($category->lang); + self::assertIsString($category->name); + self::assertIsString($category->version); + } + } +} diff --git a/tests/Repositories/ChannelRepositoryTest.php b/tests/Repositories/ChannelRepositoryTest.php new file mode 100644 index 0000000..b9d9116 --- /dev/null +++ b/tests/Repositories/ChannelRepositoryTest.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Repositories; + +use DateTime; +use EPGService\Repositories\ChannelRepository; +use PHPUnit\Framework\TestCase; +use Tests\Utilities\GetServiceEnvironment; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Repositories + */ +final class ChannelRepositoryTest extends TestCase { + /** + * @throws \GuzzleHttp\Exception\GuzzleException + * @throws \RuntimeException + * @throws \Exception + */ + public function testGetAction(): void { + $env = GetServiceEnvironment::get(); + + foreach (ChannelRepository::create($env)->get() as $channel) { + /** @var \EPGService\Entities\ChannelEntity $channel */ + + self::assertIsString($channel->base_id); + self::assertIsString($channel->base_name); + self::assertIsString($channel->epg_id); + self::assertIsString($channel->geo_data); + self::assertIsString($channel->href); + self::assertIsString($channel->icon); + self::assertIsString($channel->id); + self::assertIsString($channel->lang); + self::assertIsString($channel->name); + self::assertIsString($channel->week); + self::isInstanceOf(DateTime::class, $channel->update_at); + } + } +} diff --git a/tests/Repositories/CountryRepositoryTest.php b/tests/Repositories/CountryRepositoryTest.php new file mode 100644 index 0000000..160e388 --- /dev/null +++ b/tests/Repositories/CountryRepositoryTest.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Repositories; + +use EPGService\Repositories\CountryRepository; +use PHPUnit\Framework\TestCase; +use Tests\Utilities\GetServiceEnvironment; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Repositories + */ +final class CountryRepositoryTest extends TestCase { + public function testActionGet(): void { + $env = GetServiceEnvironment::get(); + + foreach (CountryRepository::create($env)->get() as $country) { + /** @var \EPGService\Entities\CountryEntity $country */ + self::assertNotEmpty($country->id); + self::assertNotEmpty($country->iso); + self::assertNotEmpty($country->lang); + self::assertNotEmpty($country->name); + self::assertNotEmpty($country->version); + } + } +} diff --git a/tests/Repositories/GenreRepositoryTest.php b/tests/Repositories/GenreRepositoryTest.php new file mode 100644 index 0000000..8afe351 --- /dev/null +++ b/tests/Repositories/GenreRepositoryTest.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Repositories; + +use EPGService\Repositories\GenreRepository; +use PHPUnit\Framework\TestCase; +use Tests\Utilities\GetServiceEnvironment; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Repositories + */ +final class GenreRepositoryTest extends TestCase { + /** + * @throws \GuzzleHttp\Exception\GuzzleException + * @throws \RuntimeException + * @throws \Exception + */ + public function testGetAction(): void { + $env = GetServiceEnvironment::get(); + + foreach (GenreRepository::create($env)->get() as $genre) { + /** @var \EPGService\Entities\GenreEntity $genre */ + + self::assertIsInt($genre->id); + self::assertIsString($genre->lang); + self::assertIsString($genre->name); + self::assertIsString($genre->version); + } + } +} diff --git a/tests/Repositories/ProgramRepositoryTest.php b/tests/Repositories/ProgramRepositoryTest.php new file mode 100644 index 0000000..f943bb6 --- /dev/null +++ b/tests/Repositories/ProgramRepositoryTest.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Repositories; + +use EPGService\Repositories\ChannelRepository; +use EPGService\Repositories\ProgramRepository; +use PHPUnit\Framework\TestCase; +use Tests\Utilities\GetServiceEnvironment; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Repositories + */ +final class ProgramRepositoryTest extends TestCase { + /** + * @throws \GuzzleHttp\Exception\GuzzleException + * @throws \RuntimeException + * @throws \Exception + */ + public function testGetAction(): void { + $week = date('Y-m-d', strtotime('this week')); + $env = GetServiceEnvironment::get(); + $channels = ChannelRepository::create($env)->get(); + $channel = array_shift($channels); + + foreach (ProgramRepository::create($env, $channel->id, $week)->get() as $program) { + /** @var \EPGService\Entities\ProgramEntity $program */ + + self::assertNotEmpty($program->channel_id); + self::assertNotEmpty($program->start); + self::assertNotEmpty($program->stop); + self::assertNotEmpty($program->title); + } + } +} diff --git a/tests/Utilities/GetCreditEntityUtility.php b/tests/Utilities/GetCreditEntityUtility.php new file mode 100644 index 0000000..f46b176 --- /dev/null +++ b/tests/Utilities/GetCreditEntityUtility.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Utilities; + +use EPGService\Entities\Program\CreditEntity; +use Faker\Factory as Faker; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Utilities + */ +final class GetCreditEntityUtility { + public static function get(): CreditEntity { + $faker = Faker::create(); + + return CreditEntity::create([ + 'name' => $faker->unique()->sha256, + 'type' => $faker->unique()->sha256, + ]); + } +} diff --git a/tests/Utilities/GetKeyUtility.php b/tests/Utilities/GetKeyUtility.php new file mode 100644 index 0000000..a72601e --- /dev/null +++ b/tests/Utilities/GetKeyUtility.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Utilities; + +use Dotenv\Dotenv; +use function dirname; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Utilities + */ +final class GetKeyUtility { + /** + * @return string + */ + public static function get(): string { + $result = Dotenv::createImmutable(dirname(__DIR__, 2))->load(); + + return $result['EPG_SERVICE_KEY'] ?? ''; + } +} diff --git a/tests/Utilities/GetServiceEnvironment.php b/tests/Utilities/GetServiceEnvironment.php new file mode 100644 index 0000000..cba08ae --- /dev/null +++ b/tests/Utilities/GetServiceEnvironment.php @@ -0,0 +1,38 @@ +<?php +/** + * Copyright 2020 “EPGService” + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an “AS IS” BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +declare(strict_types = 1); + +namespace Tests\Utilities; + +use EPGService\Environments\ServiceEnvironment; + +/** + * @copyright Copyright © 2020 “Valentin Popov” <info@valentineus.link> + * @license http://www.apache.org/licenses/LICENSE-2.0 + * @package Tests\Utilities + */ +final class GetServiceEnvironment { + /** + * @return \EPGService\Environments\ServiceEnvironment + */ + public static function get(): ServiceEnvironment { + $key = GetKeyUtility::get(); + + return ServiceEnvironment::create($key); + } +} |