From aecd4a1c4c3b86158fef3610ed52a020fa5445ab Mon Sep 17 00:00:00 2001 From: LeinadAlberto Date: Thu, 29 Feb 2024 00:05:41 -0400 Subject: [PATCH 1/2] build: dependencies have been updated --- composer.json | 7 +- composer.lock | 631 ++++++++++---------------------------------------- 2 files changed, 120 insertions(+), 518 deletions(-) diff --git a/composer.json b/composer.json index c3516e6..f5d4f6b 100644 --- a/composer.json +++ b/composer.json @@ -15,13 +15,12 @@ }, "require": { "php": ">=8.2", - "phpmailer/phpmailer": "^6.6", - "symfony/mailer": "^6.3", - "symfony/mime": "^6.3" + "symfony/mime": "^6.3", + "phpmailer/phpmailer": "^6.9", + "symfony/mailer": "^7.0" }, "require-dev": { "phpunit/phpunit": "^10.0.", - "vlucas/phpdotenv": "*", "lion/test": "^1.4" } } diff --git a/composer.lock b/composer.lock index 3579312..70dc9df 100644 --- a/composer.lock +++ b/composer.lock @@ -4,31 +4,31 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1a4f1457b4d960430d69fa72431f8f62", + "content-hash": "845d29d843921f666e406727adbf116f", "packages": [ { "name": "doctrine/lexer", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "84a527db05647743d50373e0ec53a152f2cde568" + "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/84a527db05647743d50373e0ec53a152f2cde568", - "reference": "84a527db05647743d50373e0ec53a152f2cde568", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", + "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", "shasum": "" }, "require": { "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^10", - "phpstan/phpstan": "^1.9", - "phpunit/phpunit": "^9.5", + "doctrine/coding-standard": "^12", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.5", "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^5.0" + "vimeo/psalm": "^5.21" }, "type": "library", "autoload": { @@ -65,7 +65,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/3.0.0" + "source": "https://github.com/doctrine/lexer/tree/3.0.1" }, "funding": [ { @@ -81,7 +81,7 @@ "type": "tidelift" } ], - "time": "2022-12-15T16:57:16+00:00" + "time": "2024-02-05T11:56:58+00:00" }, { "name": "egulias/email-validator", @@ -453,16 +453,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v7.0.2", + "version": "v7.0.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "098b62ae81fdd6cbf941f355059f617db28f4f9a" + "reference": "834c28d533dd0636f910909d01b9ff45cc094b5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/098b62ae81fdd6cbf941f355059f617db28f4f9a", - "reference": "098b62ae81fdd6cbf941f355059f617db28f4f9a", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/834c28d533dd0636f910909d01b9ff45cc094b5e", + "reference": "834c28d533dd0636f910909d01b9ff45cc094b5e", "shasum": "" }, "require": { @@ -513,7 +513,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v7.0.2" + "source": "https://github.com/symfony/event-dispatcher/tree/v7.0.3" }, "funding": [ { @@ -529,7 +529,7 @@ "type": "tidelift" } ], - "time": "2023-12-27T22:24:19+00:00" + "time": "2024-01-23T15:02:46+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -609,39 +609,39 @@ }, { "name": "symfony/mailer", - "version": "v6.4.2", + "version": "v7.0.4", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "6da89e5c9202f129717a770a03183fb140720168" + "reference": "72e16d87bf50a3ce195b9470c06bb9d7b816ea85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/6da89e5c9202f129717a770a03183fb140720168", - "reference": "6da89e5c9202f129717a770a03183fb140720168", + "url": "https://api.github.com/repos/symfony/mailer/zipball/72e16d87bf50a3ce195b9470c06bb9d7b816ea85", + "reference": "72e16d87bf50a3ce195b9470c06bb9d7b816ea85", "shasum": "" }, "require": { "egulias/email-validator": "^2.1.10|^3|^4", - "php": ">=8.1", + "php": ">=8.2", "psr/event-dispatcher": "^1", "psr/log": "^1|^2|^3", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", - "symfony/mime": "^6.2|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/mime": "^6.4|^7.0", "symfony/service-contracts": "^2.5|^3" }, "conflict": { "symfony/http-client-contracts": "<2.5", - "symfony/http-kernel": "<5.4", - "symfony/messenger": "<6.2", - "symfony/mime": "<6.2", - "symfony/twig-bridge": "<6.2.1" + "symfony/http-kernel": "<6.4", + "symfony/messenger": "<6.4", + "symfony/mime": "<6.4", + "symfony/twig-bridge": "<6.4" }, "require-dev": { - "symfony/console": "^5.4|^6.0|^7.0", - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/messenger": "^6.2|^7.0", - "symfony/twig-bridge": "^6.2|^7.0" + "symfony/console": "^6.4|^7.0", + "symfony/http-client": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/twig-bridge": "^6.4|^7.0" }, "type": "library", "autoload": { @@ -669,7 +669,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.4.2" + "source": "https://github.com/symfony/mailer/tree/v7.0.4" }, "funding": [ { @@ -685,20 +685,20 @@ "type": "tidelift" } ], - "time": "2023-12-19T09:12:31+00:00" + "time": "2024-02-03T21:34:19+00:00" }, { "name": "symfony/mime", - "version": "v6.4.0", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "ca4f58b2ef4baa8f6cecbeca2573f88cd577d205" + "reference": "5017e0a9398c77090b7694be46f20eb796262a34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/ca4f58b2ef4baa8f6cecbeca2573f88cd577d205", - "reference": "ca4f58b2ef4baa8f6cecbeca2573f88cd577d205", + "url": "https://api.github.com/repos/symfony/mime/zipball/5017e0a9398c77090b7694be46f20eb796262a34", + "reference": "5017e0a9398c77090b7694be46f20eb796262a34", "shasum": "" }, "require": { @@ -753,7 +753,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v6.4.0" + "source": "https://github.com/symfony/mime/tree/v6.4.3" }, "funding": [ { @@ -769,20 +769,20 @@ "type": "tidelift" } ], - "time": "2023-10-17T11:49:05+00:00" + "time": "2024-01-30T08:32:12+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "ecaafce9f77234a6a449d29e49267ba10499116d" + "reference": "a287ed7475f85bf6f61890146edbc932c0fff919" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/ecaafce9f77234a6a449d29e49267ba10499116d", - "reference": "ecaafce9f77234a6a449d29e49267ba10499116d", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a287ed7475f85bf6f61890146edbc932c0fff919", + "reference": "a287ed7475f85bf6f61890146edbc932c0fff919", "shasum": "" }, "require": { @@ -795,9 +795,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -840,7 +837,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.29.0" }, "funding": [ { @@ -856,20 +853,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:30:37+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", "shasum": "" }, "require": { @@ -880,9 +877,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -924,7 +918,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" }, "funding": [ { @@ -940,20 +934,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -967,9 +961,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -1007,7 +998,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -1023,20 +1014,20 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" + "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", - "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/861391a8da9a04cbad2d232ddd9e4893220d6e25", + "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25", "shasum": "" }, "require": { @@ -1044,9 +1035,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -1083,7 +1071,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.29.0" }, "funding": [ { @@ -1099,7 +1087,7 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/service-contracts", @@ -1185,80 +1173,18 @@ } ], "packages-dev": [ - { - "name": "graham-campbell/result-type", - "version": "v1.1.2", - "source": { - "type": "git", - "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/fbd48bce38f73f8a4ec8583362e732e4095e5862", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "GrahamCampbell\\ResultType\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - } - ], - "description": "An Implementation Of The Result Type", - "keywords": [ - "Graham Campbell", - "GrahamCampbell", - "Result Type", - "Result-Type", - "result" - ], - "support": { - "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.2" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", - "type": "tidelift" - } - ], - "time": "2023-11-12T22:16:48+00:00" - }, { "name": "lion/test", - "version": "v1.4.0", + "version": "v1.5.0", "source": { "type": "git", - "url": "https://github.com/lion-packages/test.git", - "reference": "c0eed0c33478b27a521258c94b053dd68d8e7bbc" + "url": "https://github.com/Sleon4/test.git", + "reference": "b087d55b4a18eb4e50afe52d4a747122e7d9f933" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lion-packages/test/zipball/c0eed0c33478b27a521258c94b053dd68d8e7bbc", - "reference": "c0eed0c33478b27a521258c94b053dd68d8e7bbc", + "url": "https://api.github.com/repos/Sleon4/test/zipball/b087d55b4a18eb4e50afe52d4a747122e7d9f933", + "reference": "b087d55b4a18eb4e50afe52d4a747122e7d9f933", "shasum": "" }, "require": { @@ -1279,10 +1205,10 @@ ], "description": "library to implement testing with helpers that allow easy testing with PHPUnit", "support": { - "issues": "https://github.com/lion-packages/test/issues", - "source": "https://github.com/lion-packages/test/tree/v1.4.0" + "issues": "https://github.com/Sleon4/test/issues", + "source": "https://github.com/Sleon4/test/tree/v1.5.0" }, - "time": "2024-01-09T14:44:37+00:00" + "time": "2024-02-13T21:08:53+00:00" }, { "name": "myclabs/deep-copy", @@ -1345,16 +1271,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.0.0", + "version": "v5.0.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc" + "reference": "2218c2252c874a4624ab2f613d86ac32d227bc69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc", - "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2218c2252c874a4624ab2f613d86ac32d227bc69", + "reference": "2218c2252c874a4624ab2f613d86ac32d227bc69", "shasum": "" }, "require": { @@ -1397,9 +1323,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.1" }, - "time": "2024-01-07T17:17:35+00:00" + "time": "2024-02-21T19:24:10+00:00" }, { "name": "phar-io/manifest", @@ -1512,93 +1438,18 @@ }, "time": "2022-02-21T01:04:05+00:00" }, - { - "name": "phpoption/phpoption", - "version": "1.9.2", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/php-option.git", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/80735db690fe4fc5c76dfa7f9b770634285fa820", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820", - "shasum": "" - }, - "require": { - "php": "^7.2.5 || ^8.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": true - }, - "branch-alias": { - "dev-master": "1.9-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", - "homepage": "https://github.com/schmittjoh" - }, - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - } - ], - "description": "Option Type for PHP", - "keywords": [ - "language", - "option", - "php", - "type" - ], - "support": { - "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.2" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", - "type": "tidelift" - } - ], - "time": "2023-11-12T21:59:55+00:00" - }, { "name": "phpunit/php-code-coverage", - "version": "10.1.11", + "version": "10.1.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "78c3b7625965c2513ee96569a4dbb62601784145" + "reference": "842f72662d6b9edda84c4b6f13885fd9cd53dc63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/78c3b7625965c2513ee96569a4dbb62601784145", - "reference": "78c3b7625965c2513ee96569a4dbb62601784145", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/842f72662d6b9edda84c4b6f13885fd9cd53dc63", + "reference": "842f72662d6b9edda84c4b6f13885fd9cd53dc63", "shasum": "" }, "require": { @@ -1655,7 +1506,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.11" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.12" }, "funding": [ { @@ -1663,7 +1514,7 @@ "type": "github" } ], - "time": "2023-12-21T15:38:30+00:00" + "time": "2024-03-02T07:22:05+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1910,16 +1761,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.5", + "version": "10.5.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ed21115d505b4b4f7dc7b5651464e19a2c7f7856" + "reference": "0d968f6323deb3dbfeba5bfd4929b9415eb7a9a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ed21115d505b4b4f7dc7b5651464e19a2c7f7856", - "reference": "ed21115d505b4b4f7dc7b5651464e19a2c7f7856", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0d968f6323deb3dbfeba5bfd4929b9415eb7a9a4", + "reference": "0d968f6323deb3dbfeba5bfd4929b9415eb7a9a4", "shasum": "" }, "require": { @@ -1991,7 +1842,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.5" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.11" }, "funding": [ { @@ -2007,20 +1858,20 @@ "type": "tidelift" } ], - "time": "2023-12-27T15:13:52+00:00" + "time": "2024-02-25T14:05:00+00:00" }, { "name": "sebastian/cli-parser", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae" + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efdc130dbbbb8ef0b545a994fd811725c5282cae", - "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084", + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084", "shasum": "" }, "require": { @@ -2055,7 +1906,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.0" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1" }, "funding": [ { @@ -2063,7 +1915,7 @@ "type": "github" } ], - "time": "2023-02-03T06:58:15+00:00" + "time": "2024-03-02T07:12:49+00:00" }, { "name": "sebastian/code-unit", @@ -2313,16 +2165,16 @@ }, { "name": "sebastian/diff", - "version": "5.1.0", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f" + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f", - "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e", "shasum": "" }, "require": { @@ -2330,7 +2182,7 @@ }, "require-dev": { "phpunit/phpunit": "^10.0", - "symfony/process": "^4.2 || ^5" + "symfony/process": "^6.4" }, "type": "library", "extra": { @@ -2368,7 +2220,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/5.1.0" + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1" }, "funding": [ { @@ -2376,7 +2228,7 @@ "type": "github" } ], - "time": "2023-12-22T10:55:06+00:00" + "time": "2024-03-02T07:15:17+00:00" }, { "name": "sebastian/environment", @@ -2444,16 +2296,16 @@ }, { "name": "sebastian/exporter", - "version": "5.1.1", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc" + "reference": "955288482d97c19a372d3f31006ab3f37da47adf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64f51654862e0f5e318db7e9dcc2292c63cdbddc", - "reference": "64f51654862e0f5e318db7e9dcc2292c63cdbddc", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/955288482d97c19a372d3f31006ab3f37da47adf", + "reference": "955288482d97c19a372d3f31006ab3f37da47adf", "shasum": "" }, "require": { @@ -2510,7 +2362,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.1" + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.2" }, "funding": [ { @@ -2518,20 +2370,20 @@ "type": "github" } ], - "time": "2023-09-24T13:22:09+00:00" + "time": "2024-03-02T07:17:12+00:00" }, { "name": "sebastian/global-state", - "version": "6.0.1", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4" + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/7ea9ead78f6d380d2a667864c132c2f7b83055e4", - "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", "shasum": "" }, "require": { @@ -2565,14 +2417,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", "security": "https://github.com/sebastianbergmann/global-state/security/policy", - "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.1" + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2" }, "funding": [ { @@ -2580,7 +2432,7 @@ "type": "github" } ], - "time": "2023-07-19T07:19:23+00:00" + "time": "2024-03-02T07:19:19+00:00" }, { "name": "sebastian/lines-of-code", @@ -2924,171 +2776,6 @@ ], "time": "2023-02-07T11:34:05+00:00" }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.28.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "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" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" - }, - "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": "2023-01-26T09:26:14+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.28.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "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" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" - }, - "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": "2023-01-26T09:26:14+00:00" - }, { "name": "theseer/tokenizer", "version": "1.2.2", @@ -3138,90 +2825,6 @@ } ], "time": "2023-11-20T00:12:19+00:00" - }, - { - "name": "vlucas/phpdotenv", - "version": "v5.6.0", - "source": { - "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", - "shasum": "" - }, - "require": { - "ext-pcre": "*", - "graham-campbell/result-type": "^1.1.2", - "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2", - "symfony/polyfill-ctype": "^1.24", - "symfony/polyfill-mbstring": "^1.24", - "symfony/polyfill-php80": "^1.24" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.2", - "ext-filter": "*", - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" - }, - "suggest": { - "ext-filter": "Required to use the boolean validator." - }, - "type": "library", - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": true - }, - "branch-alias": { - "dev-master": "5.6-dev" - } - }, - "autoload": { - "psr-4": { - "Dotenv\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk", - "homepage": "https://github.com/GrahamCampbell" - }, - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "https://github.com/vlucas" - } - ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "support": { - "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.0" - }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", - "type": "tidelift" - } - ], - "time": "2023-11-12T22:43:29+00:00" } ], "aliases": [], From 8f692909329f1fe3435f050152a20dcf782eeab5 Mon Sep 17 00:00:00 2001 From: Sleon4 Date: Sat, 2 Mar 2024 23:25:59 -0500 Subject: [PATCH 2/2] docs: added code blocks to document classes --- src/AccountType.php | 21 +++- src/Accounts/PHPMailerAccount.php | 66 ++++++++++- src/Accounts/SymfonyMailerAccount.php | 66 ++++++++++- src/Exceptions/EmptyBodyException.php | 10 ++ .../InvalidFromAddressException.php | 10 ++ .../InvalidRecipientAddressException.php | 10 ++ .../MailerAccountConfigException.php | 32 ++++++ src/Mailer.php | 51 +++++++++ src/MailerAccountConfig.php | 22 ++++ src/MailerAccountInterface.php | 104 ++++++++++++++++++ src/Priority.php | 24 ++++ 11 files changed, 405 insertions(+), 11 deletions(-) diff --git a/src/AccountType.php b/src/AccountType.php index 884ab46..28bdadb 100644 --- a/src/AccountType.php +++ b/src/AccountType.php @@ -7,11 +7,28 @@ use Lion\Mailer\Accounts\PHPMailerAccount; use Lion\Mailer\Accounts\SymfonyMailerAccount; +/** + * Enumeration for service configuration + * + * @package Lion\Mailer + */ enum AccountType: string { - case PHPMailer = "phpmailer"; - case Symfony = "symfony"; + /** + * [Defines the PHPMailer service] + */ + case PHPMailer = 'phpmailer'; + /** + * [Defines the SymfonyMailer service] + */ + case Symfony = 'symfony'; + + /** + * Returns the defined service + * + * @return string + */ public function getClassName(): string { return match ($this) { diff --git a/src/Accounts/PHPMailerAccount.php b/src/Accounts/PHPMailerAccount.php index 686f999..05c5cf6 100644 --- a/src/Accounts/PHPMailerAccount.php +++ b/src/Accounts/PHPMailerAccount.php @@ -12,24 +12,49 @@ use Lion\Mailer\Exceptions\InvalidFromAddressException; use Lion\Mailer\Exceptions\InvalidRecipientAddressException; +/** + * Service to send emails with PHPMailer + * + * @package Lion\Mailer\Accounts + */ class PHPMailerAccount implements MailerAccountInterface { + /** + * [Object of PHPMailer class] + * + * @var PHPMailer $mailer + */ private PHPMailer $mailer; + /** + * {@inheritdoc} + */ public function __construct(protected MailerAccountConfig $config) { $this->mailer = new PHPMailer(true); + $this->mailer->isSMTP(); + $this->mailer->isHTML(true); + $this->mailer->SMTPAuth = true; + $this->mailer->SMTPDebug = 0; + $this->mailer->Host = $config->host; + $this->mailer->Username = $config->username; + $this->mailer->Password = $config->password; + $this->mailer->Port = $config->port; + $this->mailer->SMTPSecure = $config->encryption; } + /** + * {@inheritdoc} + */ public function priority(Priority $priority): MailerAccountInterface { $this->mailer->Priority = $priority->value; @@ -37,20 +62,29 @@ public function priority(Priority $priority): MailerAccountInterface return $this; } - public function from(string $address, ?string $name = null): MailerAccountInterface + /** + * {@inheritdoc} + */ + public function subject(string $subject): MailerAccountInterface { - $this->mailer->setFrom($address, $name); + $this->mailer->Subject = $subject; return $this; } - public function subject(string $subject): MailerAccountInterface + /** + * {@inheritdoc} + */ + public function from(string $address, ?string $name = null): MailerAccountInterface { - $this->mailer->Subject = $subject; + $this->mailer->setFrom($address, $name); return $this; } + /** + * {@inheritdoc} + */ public function addAddress(string $address, ?string $name = null): MailerAccountInterface { $this->mailer->addAddress($address, $name); @@ -58,6 +92,9 @@ public function addAddress(string $address, ?string $name = null): MailerAccount return $this; } + /** + * {@inheritdoc} + */ public function addReplyTo(string $address, ?string $name = null): MailerAccountInterface { $this->mailer->addReplyTo($address, $name); @@ -65,6 +102,9 @@ public function addReplyTo(string $address, ?string $name = null): MailerAccount return $this; } + /** + * {@inheritdoc} + */ public function addCC(string $address, ?string $name = null): MailerAccountInterface { $this->mailer->addCC($address, $name); @@ -72,6 +112,9 @@ public function addCC(string $address, ?string $name = null): MailerAccountInter return $this; } + /** + * {@inheritdoc} + */ public function addBCC(string $address, ?string $name = null): MailerAccountInterface { $this->mailer->addBCC($address, $name); @@ -79,6 +122,9 @@ public function addBCC(string $address, ?string $name = null): MailerAccountInte return $this; } + /** + * {@inheritdoc} + */ public function addAttachment(string $path, ?string $fileName = null): MailerAccountInterface { $this->mailer->addAttachment($path, $fileName); @@ -86,6 +132,9 @@ public function addAttachment(string $path, ?string $fileName = null): MailerAcc return $this; } + /** + * {@inheritdoc} + */ public function addEmbeddedImage( string $path, string $cid, @@ -97,6 +146,9 @@ public function addEmbeddedImage( return $this; } + /** + * {@inheritdoc} + */ public function body(string $body): MailerAccountInterface { $this->mailer->Body = $body; @@ -104,6 +156,9 @@ public function body(string $body): MailerAccountInterface return $this; } + /** + * {@inheritdoc} + */ public function altBody(string $altBody): MailerAccountInterface { $this->mailer->AltBody = $altBody; @@ -111,6 +166,9 @@ public function altBody(string $altBody): MailerAccountInterface return $this; } + /** + * {@inheritdoc} + */ public function send(): bool { if (!$this->mailer->From) { diff --git a/src/Accounts/SymfonyMailerAccount.php b/src/Accounts/SymfonyMailerAccount.php index 87f933d..ef0b32b 100644 --- a/src/Accounts/SymfonyMailerAccount.php +++ b/src/Accounts/SymfonyMailerAccount.php @@ -17,20 +17,44 @@ use Symfony\Component\Mime\Part\DataPart; use Symfony\Component\Mime\Part\File; +/** + * Service to send emails with SymfonyMailer + * + * @package Lion\Mailer\Accounts + */ class SymfonyMailerAccount implements MailerAccountInterface { + /** + * [Object of Email class] + * + * @var Email $email + */ private Email $email; + /** + * [Defines the DNS configuration for the symfony service] + * + * @var string $dns + */ private string $dns; + /** + * {@inheritdoc} + */ public function __construct(protected MailerAccountConfig $config) { $this->email = new Email(); + $this->dns = "smtp://$config->username:$config->password@$config->host:$config->port"; + $this->dns .= "?encryption=$config->encryption"; + $this->dns .= "&debug=" . $config->debug ? 'true' : 'false'; } + /** + * {@inheritdoc} + */ public function priority(Priority $priority): MailerAccountInterface { $this->email->priority($priority->value); @@ -38,6 +62,9 @@ public function priority(Priority $priority): MailerAccountInterface return $this; } + /** + * {@inheritdoc} + */ public function from(string $address, ?string $name = null): MailerAccountInterface { $this->email->from(new Address($address, $name)); @@ -45,6 +72,9 @@ public function from(string $address, ?string $name = null): MailerAccountInterf return $this; } + /** + * {@inheritdoc} + */ public function subject(string $subject): MailerAccountInterface { $this->email->subject($subject); @@ -52,6 +82,9 @@ public function subject(string $subject): MailerAccountInterface return $this; } + /** + * {@inheritdoc} + */ public function addAddress(string $address, ?string $name = null): MailerAccountInterface { if (!$name) { @@ -63,6 +96,9 @@ public function addAddress(string $address, ?string $name = null): MailerAccount return $this; } + /** + * {@inheritdoc} + */ public function addReplyTo(string $address, ?string $name = null): MailerAccountInterface { if (!$name) { @@ -74,6 +110,9 @@ public function addReplyTo(string $address, ?string $name = null): MailerAccount return $this; } + /** + * {@inheritdoc} + */ public function addCC(string $address, $name = null): MailerAccountInterface { if (!$name) { @@ -85,6 +124,9 @@ public function addCC(string $address, $name = null): MailerAccountInterface return $this; } + /** + * {@inheritdoc} + */ public function addBCC(string $address, $name = null): MailerAccountInterface { if (!$name) { @@ -96,6 +138,9 @@ public function addBCC(string $address, $name = null): MailerAccountInterface return $this; } + /** + * {@inheritdoc} + */ public function addAttachment(string $path, ?string $fileName = null): MailerAccountInterface { $this->email->addPart(new DataPart(new File($path, $fileName))); @@ -103,21 +148,26 @@ public function addAttachment(string $path, ?string $fileName = null): MailerAcc return $this; } + /** + * {@inheritdoc} + */ public function addEmbeddedImage( string $path, string $cid, ?string $name = null, ?string $mimeType = null ): MailerAccountInterface { - $this->email->addPart((new DataPart( - new File($path), - $cid, - $mimeType - ))->asInline()); + $this->email->addPart( + (new DataPart(new File($path), $cid, $mimeType)) + ->asInline() + ); return $this; } + /** + * {@inheritdoc} + */ public function body(string $body): MailerAccountInterface { $this->email->html($body); @@ -125,6 +175,9 @@ public function body(string $body): MailerAccountInterface return $this; } + /** + * {@inheritdoc} + */ public function altBody(string $altBody): MailerAccountInterface { $this->email->text($altBody); @@ -132,6 +185,9 @@ public function altBody(string $altBody): MailerAccountInterface return $this; } + /** + * {@inheritdoc} + */ public function send(): bool { if (!$this->email->getFrom()) { diff --git a/src/Exceptions/EmptyBodyException.php b/src/Exceptions/EmptyBodyException.php index 0c9d12c..91bd264 100644 --- a/src/Exceptions/EmptyBodyException.php +++ b/src/Exceptions/EmptyBodyException.php @@ -6,8 +6,18 @@ use Exception; +/** + * Exception for emails with empty body + * + * @package Lion\Mailer\Exceptions + */ class EmptyBodyException extends Exception { + /** + * Returns an object of type Exception with an error message + * + * @return self + */ public static function make(): self { return new self('message body has not been specified. Use the `body` method to specify the message body'); diff --git a/src/Exceptions/InvalidFromAddressException.php b/src/Exceptions/InvalidFromAddressException.php index 5163167..e311a57 100644 --- a/src/Exceptions/InvalidFromAddressException.php +++ b/src/Exceptions/InvalidFromAddressException.php @@ -6,8 +6,18 @@ use Exception; +/** + * Exception for emails with empty destination email + * + * @package Lion\Mailer\Exceptions + */ class InvalidFromAddressException extends Exception { + /** + * Returns an object of type Exception with an error message + * + * @return self + */ public static function emptyFromAddress(): self { return new self( diff --git a/src/Exceptions/InvalidRecipientAddressException.php b/src/Exceptions/InvalidRecipientAddressException.php index 9ce3f86..89b510e 100644 --- a/src/Exceptions/InvalidRecipientAddressException.php +++ b/src/Exceptions/InvalidRecipientAddressException.php @@ -6,8 +6,18 @@ use Exception; +/** + * Exception for emails with empty destination email + * + * @package Lion\Mailer\Exceptions + */ class InvalidRecipientAddressException extends Exception { + /** + * Returns an object of type Exception with an error message + * + * @return self + */ public static function emptyRecipientsList(): self { return new self( diff --git a/src/Exceptions/MailerAccountConfigException.php b/src/Exceptions/MailerAccountConfigException.php index 3c4b152..cdb62e6 100644 --- a/src/Exceptions/MailerAccountConfigException.php +++ b/src/Exceptions/MailerAccountConfigException.php @@ -6,13 +6,28 @@ use Exception; +/** + * Defines the Exception type objects for the mail configuration + * + * @package Lion\Mailer\Exceptions + */ class MailerAccountConfigException extends Exception { + /** + * Returns an object of type Exception with an error message + * + * @return self + */ public static function invalidSMTPEncryptionProtocol(): self { return new self('the provided encryption protocol is invalid'); } + /** + * Returns an object of type Exception with an error message + * + * @return self + */ public static function invalidMailerAccountType(): self { return new self( @@ -20,16 +35,33 @@ public static function invalidMailerAccountType(): self ); } + /** + * Returns an object of type Exception with an error message + * + * @param string $name [Configured account name] + * + * @return self + */ public static function accountNotFound(string $name): self { return new self("the account `{$name}` could not be found."); } + /** + * Returns an object of type Exception with an error message + * + * @return self + */ public static function emptyAccountList(): self { return new self('the configuration array passed to the initialize method should contain at least on account'); } + /** + * Returns an object of type Exception with an error message + * + * @return self + */ public static function invalidDefaultAccount(): self { return new self('no default account has been provided or the default account provided is invalid'); diff --git a/src/Mailer.php b/src/Mailer.php index 1652c4b..99e42de 100644 --- a/src/Mailer.php +++ b/src/Mailer.php @@ -10,11 +10,35 @@ use Lion\Mailer\Accounts\SymfonyMailerAccount; use Lion\Mailer\Exceptions\MailerAccountConfigException; +/** + * Initializes all services and their defined configurations + * + * @package Lion\Mailer + */ class Mailer { + /** + * [List of all defined accounts] + * + * @var array $accounts + */ private static array $accounts; + + /** + * [Default account] + * + * @var string $default + */ private static string $default; + /** + * Initialize account settings + * + * @param array $accounts [List of all defined accounts] + * @param string $default [Default account] + * + * @return void + */ public static function initialize(array $accounts, string $default = 'default'): void { if (count($accounts) <= 0) { @@ -38,11 +62,23 @@ public static function initialize(array $accounts, string $default = 'default'): } } + /** + * Returns a service defined by default + * + * @return MailerAccountInterface + */ public static function default(): MailerAccountInterface { return self::account(self::$default); } + /** + * Change the default account to the defined account + * + * @param string $name [Default account] + * + * @return void + */ public static function setDefault(string $name): void { if (!isset(self::$accounts[$name])) { @@ -52,6 +88,14 @@ public static function setDefault(string $name): void self::$default = $name; } + /** + * Add an account + * + * @param string $name [Account name] + * @param array $config [Configuration data for the account] + * + * @return void + */ public static function addAccount(string $name, array $config): void { if (!in_array($config["type"], ['phpmailer', 'symfony'])) { @@ -65,6 +109,13 @@ public static function addAccount(string $name, array $config): void ]; } + /** + * Get an account + * + * @param string $name [Account name] + * + * @return MailerAccountInterface + */ public static function account(string $name): MailerAccountInterface { $account = self::$accounts[$name] ?? ['type' => null]; diff --git a/src/MailerAccountConfig.php b/src/MailerAccountConfig.php index 626f74b..bfdf637 100644 --- a/src/MailerAccountConfig.php +++ b/src/MailerAccountConfig.php @@ -6,8 +6,23 @@ use Lion\Mailer\Exceptions\MailerAccountConfigException; +/** + * Create email account settings + * + * @package Lion\Mailer + */ class MailerAccountConfig { + /** + * Class constructor + * + * @param string $host [Service host] + * @param string $username [Account username] + * @param string $password [Account password] + * @param int $port [Service port] + * @param string $encryption [Account encryption] + * @param bool $debug [Service debug] + */ public function __construct( public readonly string $host, public readonly string $username, @@ -21,6 +36,13 @@ public function __construct( } } + /** + * Create the configuration object from an array + * + * @param array $config [Configuration data array] + * + * @return self + */ public static function fromArray(array $config): self { return new self( diff --git a/src/MailerAccountInterface.php b/src/MailerAccountInterface.php index ef7b0de..364b7fe 100644 --- a/src/MailerAccountInterface.php +++ b/src/MailerAccountInterface.php @@ -7,26 +7,109 @@ use Lion\Mailer\MailerAccountConfig; use Lion\Mailer\Priority; +/** + * Defines the configuration of native functions to send emails + * + * @package Lion\Mailer + */ interface MailerAccountInterface { + /** + * Class constructor + * + * @param MailerAccountConfig $config [Configuration object for PHPMailer + * service] + */ public function __construct(MailerAccountConfig $config); + /** + * Defines the priority level + * + * @param Priority $priority [Priority level] + * + * @return MailerAccountInterface + */ public function priority(Priority $priority): MailerAccountInterface; + /** + * Mail subject + * + * @param string $subject [Subject] + * + * @return MailerAccountInterface + */ public function subject(string $subject): MailerAccountInterface; + /** + * Define who sends the email + * + * @param string $address [Mail account] + * @param string|null $name [Account name] + * + * @return MailerAccountInterface + */ public function from(string $address, ?string $name = null): MailerAccountInterface; + /** + * Defines the destination account + * + * @param string $address [Destination account] + * @param string|null $name [Account name] + * + * @return MailerAccountInterface + */ public function addAddress(string $address, ?string $name = null): MailerAccountInterface; + /** + * Account that answers email + * + * @param string $address [Account that responds] + * @param string|null $name [Account name] + * + * @return MailerAccountInterface + */ public function addReplyTo(string $address, ?string $name = null): MailerAccountInterface; + /** + * Send a copy of the message to other accounts + * + * @param string $address [Destination account] + * @param string|null $name [Account name] + * + * @return MailerAccountInterface + */ public function addCC(string $address, ?string $name = null): MailerAccountInterface; + /** + * Send a blind copy of the message to other accounts + * + * @param string $address [Destination account] + * @param string|null $name [Account name] + * + * @return MailerAccountInterface + */ public function addBCC(string $address, ?string $name = null): MailerAccountInterface; + /** + * Attaches defined files + * + * @param string $path [File path] + * @param string|null $fileName [File name] + * + * @return MailerAccountInterface + */ public function addAttachment(string $path, ?string $fileName = null): MailerAccountInterface; + /** + * Allows you to embed images directly in the body of the message + * + * @param string $path [File path] + * @param string $cid [Content ID of the attachment; Use this to reference + * the content when using an embedded image in HTML] + * @param string|null $name [Overrides the attachment filename] + * @param string|null $mimeType [File MIME type (by default mapped from the + * `$path` filename's extension)] + */ public function addEmbeddedImage( string $path, string $cid, @@ -34,9 +117,30 @@ public function addEmbeddedImage( ?string $mimeType = null ): MailerAccountInterface; + /** + * Defines the body of the email + * + * @param string $body [Email body] + * + * @return MailerAccountInterface + */ public function body(string $body): MailerAccountInterface; + /** + * Provides a plain text version of the message body to be displayed in + * email clients that do not support HTML or that have the HTML display + * option disabled + * + * @param string $altBody [Email body] + * + * @return MailerAccountInterface + */ public function altBody(string $altBody): MailerAccountInterface; + /** + * Send the email after you have configured all the message details + * + * @return bool + */ public function send(): bool; } diff --git a/src/Priority.php b/src/Priority.php index b7f4798..6242a45 100644 --- a/src/Priority.php +++ b/src/Priority.php @@ -4,11 +4,35 @@ namespace Lion\Mailer; +/** + * Define priority levels + * + * @package Lion\Mailer + */ enum Priority: int { + /** + * [Lowest priority level] + */ case LOWEST = 5; + + /** + * [Low priority level] + */ case LOW = 4; + + /** + * [Normal priority level] + */ case NORMAL = 3; + + /** + * [High priority level] + */ case HIGH = 2; + + /** + * [Highest priority level] + */ case HIGHEST = 1; }