├── src ├── I18n │ ├── Locale │ │ └── empty │ ├── Exception │ │ └── LocaleNotAvailableException.php │ ├── composer.json │ ├── functions.php │ └── LICENSE.md ├── Core │ ├── .preloadignore │ ├── Exception │ │ ├── RouterException.php │ │ ├── MissingClassException.php │ │ ├── MissingPluginException.php │ │ ├── FileNotFoundException.php │ │ ├── InvalidArgumentException.php │ │ └── Exception.php │ ├── BaseObject.php │ ├── composer.json │ ├── HookTrait.php │ ├── LICENSE.md │ ├── bootstrap.php │ ├── InitializerTrait.php │ ├── ModelTrait.php │ ├── LazyLoadContainer.php │ ├── Resolver.php │ └── PhpFile.php ├── Mailbox │ ├── .preloadignore │ ├── pipe.php │ ├── composer.json │ ├── LICENSE.md │ ├── Job │ │ ├── MailboxCleanJob.php │ │ └── MailboxJob.php │ └── Model │ │ ├── ImapMessage.php │ │ └── InboundEmail.php ├── Http │ ├── Middleware │ │ ├── Exception │ │ │ ├── InvalidCsrfTokenException.php │ │ │ └── MaintainenceModeException.php │ │ ├── DispatcherMiddleware.php │ │ ├── MinifyMiddleware.php │ │ ├── Middleware.php │ │ ├── AccessLogMiddleware.php │ │ ├── MaintenanceModeMiddleware.php │ │ ├── FirewallMiddleware.php │ │ ├── MiddlewareRunner.php │ │ ├── ProfilerMiddleware.php │ │ └── SessionMiddleware.php │ ├── Exception │ │ ├── HttpException.php │ │ ├── ForbiddenException.php │ │ ├── NotFoundException.php │ │ ├── BadRequestException.php │ │ ├── UnauthorizedException.php │ │ ├── InternalErrorException.php │ │ ├── MethodNotAllowedException.php │ │ ├── ServiceUnavailableException.php │ │ └── NotImplementedException.php │ ├── View │ │ ├── Exception │ │ │ ├── NotFoundException.php │ │ │ ├── MissingHelperException.php │ │ │ ├── MissingLayoutException.php │ │ │ ├── MissingSharedViewException.php │ │ │ └── MissingViewException.php │ │ ├── Helper │ │ │ ├── FlashHelper.php │ │ │ ├── HelperRegistry.php │ │ │ ├── CookieHelper.php │ │ │ ├── SessionHelper.php │ │ │ ├── DateHelper.php │ │ │ └── NumberHelper.php │ │ ├── TemplateTrait.php │ │ └── JsonView.php │ ├── Controller │ │ ├── Component │ │ │ ├── Exception │ │ │ │ └── MissingComponentException.php │ │ │ ├── FlashComponent.php │ │ │ ├── SessionComponent.php │ │ │ ├── Component.php │ │ │ └── CookieComponent.php │ │ └── Exception │ │ │ ├── MissingMethodException.php │ │ │ ├── MissingControllerException.php │ │ │ └── PrivateMethodException.php │ ├── composer.json │ ├── LICENSE.md │ ├── Session │ │ └── SessionEngineInterface.php │ └── Dispatcher.php ├── Redis │ ├── composer.json │ └── LICENSE.md ├── Utility │ ├── composer.json │ └── LICENSE.md ├── Lock │ ├── composer.json │ └── LICENSE.md ├── Ssh │ ├── composer.json │ └── RemoteFile.php ├── Process │ ├── composer.json │ ├── Exception │ │ └── TimeoutException.php │ ├── BaseProcess.php │ └── LICENSE.md ├── Console │ ├── Exception │ │ ├── ConsoleException.php │ │ └── StopExecutionException.php │ ├── composer.json │ ├── Command │ │ └── Exception │ │ │ └── MissingCommandException.php │ ├── BaseApplication.php │ ├── LICENSE.md │ └── ConsoleInput.php ├── Schedule │ ├── Exception │ │ └── ScheduleException.php │ ├── composer.json │ ├── bin │ │ └── schedule:run │ ├── Command │ │ └── ScheduleRunCommand.php │ └── Task.php ├── Publisher │ ├── Exception │ │ └── PublisherException.php │ ├── composer.json │ ├── ListenerJob.php │ ├── LICENSE.md │ ├── Listener.php │ └── PublisherTrait.php ├── Mailer │ ├── Exception │ │ └── MissingTemplateException.php │ ├── composer.json │ ├── LICENSE.md │ ├── Message.php │ └── MailerJob.php ├── Migration │ ├── Exception │ │ └── IrreversibleMigrationException.php │ ├── composer.json │ ├── Sql.php │ └── LICENSE.md ├── Model │ ├── Exception │ │ ├── DatasourceException.php │ │ ├── ValidatorException.php │ │ ├── QueryBuilderException.php │ │ ├── MissingDatasourceException.php │ │ ├── RecordNotFoundException.php │ │ ├── MissingModelException.php │ │ ├── ConnectionException.php │ │ └── RecordSaveException.php │ ├── composer.json │ ├── LICENSE.md │ ├── Seed.php │ ├── Repository │ │ └── Repository.php │ ├── Query │ │ ├── QueryObject.php │ │ └── BatchInsertQuery.php │ ├── Engine │ │ ├── MysqlEngine.php │ │ ├── PostgresEngine.php │ │ └── SqliteEngine.php │ └── Concern │ │ ├── Delocalizable.php │ │ └── Timestampable.php ├── Service │ ├── composer.json │ └── LICENSE.md ├── TestSuite │ ├── Exception │ │ └── ConsoleInputRequiredException.php │ ├── Stub │ │ ├── Request.php │ │ ├── ConsoleInput.php │ │ └── ConsoleOutput.php │ ├── composer.json │ ├── LICENSE.md │ └── TestTrait.php └── Job │ ├── Model │ └── Queue.php │ ├── composer.json │ ├── LICENSE.md │ ├── Queue.php │ └── Engine │ ├── RedisConnection.php │ └── BaseEngine.php ├── LICENSE.md └── composer.json /src/I18n/Locale/empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/Core/.preloadignore: -------------------------------------------------------------------------------- 1 | bootstrap.php -------------------------------------------------------------------------------- /src/Mailbox/.preloadignore: -------------------------------------------------------------------------------- 1 | pipe.php -------------------------------------------------------------------------------- /src/Http/Middleware/Exception/InvalidCsrfTokenException.php: -------------------------------------------------------------------------------- 1 | =7.3.0" 21 | }, 22 | "minimum-stability": "dev", 23 | "prefer-stable": true 24 | } 25 | -------------------------------------------------------------------------------- /src/Core/Exception/RouterException.php: -------------------------------------------------------------------------------- 1 | =7.3.0" 24 | }, 25 | "minimum-stability": "dev", 26 | "prefer-stable": true 27 | } 28 | -------------------------------------------------------------------------------- /src/Lock/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "originphp/lock", 3 | "description": "OriginPHP Lock", 4 | "type": "library", 5 | "keywords": [ 6 | "lock" 7 | ], 8 | "homepage": "https://www.originphp.com/", 9 | "license": "MIT", 10 | "authors": [ 11 | { 12 | "name": "Jamiel Sharief", 13 | "email": "js@originphp.com" 14 | } 15 | ], 16 | "autoload": { 17 | "psr-4": { 18 | "Origin\\Lock\\": "." 19 | } 20 | }, 21 | "require": { 22 | "php": ">=7.3.0", 23 | "originphp/defer": "^3.0" 24 | }, 25 | "minimum-stability": "dev", 26 | "prefer-stable": true 27 | } 28 | -------------------------------------------------------------------------------- /src/Ssh/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "originphp/ssh", 3 | "description": "OriginPHP SSH", 4 | "type": "library", 5 | "keywords": [ 6 | "ssh", 7 | "scp" 8 | ], 9 | "homepage": "https://www.originphp.com/", 10 | "license": "MIT", 11 | "authors": [ 12 | { 13 | "name": "Jamiel Sharief", 14 | "email": "js@originphp.com" 15 | } 16 | ], 17 | "autoload": { 18 | "psr-4": { 19 | "Origin\\Ssh\\": "." 20 | } 21 | }, 22 | "require": { 23 | "php": ">=7.3.0", 24 | "ext-ssh2": "*" 25 | }, 26 | "minimum-stability": "dev", 27 | "prefer-stable": true 28 | } 29 | -------------------------------------------------------------------------------- /src/Process/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "originphp/process", 3 | "description": "OriginPHP Process", 4 | "type": "library", 5 | "keywords": [ 6 | "process", 7 | "background" 8 | ], 9 | "homepage": "https://www.originphp.com/docs/utility/process/", 10 | "license": "MIT", 11 | "authors": [ 12 | { 13 | "name": "Jamiel Sharief", 14 | "email": "js@originphp.com" 15 | } 16 | ], 17 | "autoload": { 18 | "psr-4": { 19 | "Origin\\Process\\": "." 20 | } 21 | }, 22 | "require": { 23 | "php": ">=7.3.0" 24 | }, 25 | "minimum-stability": "dev", 26 | "prefer-stable": true 27 | } 28 | -------------------------------------------------------------------------------- /src/Http/Exception/HttpException.php: -------------------------------------------------------------------------------- 1 | =7.3.0", 25 | "originphp/core": "^3.0" 26 | }, 27 | "minimum-stability": "dev", 28 | "prefer-stable": true 29 | } 30 | -------------------------------------------------------------------------------- /src/Http/View/Exception/NotFoundException.php: -------------------------------------------------------------------------------- 1 | =7.3.0", 23 | "originphp/core": "^3.0", 24 | "originphp/inflector": "^2.0", 25 | "originphp/model": "^3.0" 26 | }, 27 | "minimum-stability": "dev", 28 | "prefer-stable": true 29 | } 30 | -------------------------------------------------------------------------------- /src/Model/Exception/MissingDatasourceException.php: -------------------------------------------------------------------------------- 1 | executeHook('initialize', func_get_args()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Http/View/Exception/MissingHelperException.php: -------------------------------------------------------------------------------- 1 | =7.3.0", 27 | "originphp/core": "^3.0", 28 | "originphp/utility": "^3.0" 29 | }, 30 | "minimum-stability": "dev", 31 | "prefer-stable": true 32 | } 33 | -------------------------------------------------------------------------------- /src/Console/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "originphp/console", 3 | "description": "OriginPHP Console", 4 | "type": "library", 5 | "keywords": [ 6 | "originPHP", 7 | "console" 8 | ], 9 | "homepage": "https://www.originphp.com/docs/console-commands/", 10 | "license": "MIT", 11 | "authors": [ 12 | { 13 | "name": "Jamiel Sharief", 14 | "email": "js@originphp.com" 15 | } 16 | ], 17 | "autoload": { 18 | "psr-4": { 19 | "Origin\\Console\\": "." 20 | } 21 | }, 22 | "require": { 23 | "php": ">=7.3.0", 24 | "originphp/core": "^3.0", 25 | "originphp/inflector": "^2.0", 26 | "originphp/log": "^2.0" 27 | }, 28 | "minimum-stability": "dev", 29 | "prefer-stable": true 30 | } 31 | -------------------------------------------------------------------------------- /src/Console/Command/Exception/MissingCommandException.php: -------------------------------------------------------------------------------- 1 | =7.3.0", 25 | "originphp/core": "^3.0" 26 | }, 27 | "suggest": { 28 | "originphp/job": "If you are going to queue events" 29 | }, 30 | "minimum-stability": "dev", 31 | "prefer-stable": true 32 | } 33 | -------------------------------------------------------------------------------- /src/Http/Controller/Component/Exception/MissingComponentException.php: -------------------------------------------------------------------------------- 1 | =7.3.0", 25 | "originphp/core": "^3.0", 26 | "originphp/email": "^2.0", 27 | "originphp/html": "^2.0", 28 | "originphp/inflector": "^2.0", 29 | "originphp/job": "^3.0" 30 | }, 31 | "minimum-stability": "dev", 32 | "prefer-stable": true 33 | } 34 | -------------------------------------------------------------------------------- /src/Http/Controller/Exception/MissingMethodException.php: -------------------------------------------------------------------------------- 1 | session = $session; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Core/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "originphp/core", 3 | "description": "OriginPHP Core", 4 | "type": "library", 5 | "keywords": [ 6 | "originPHP", 7 | "core" 8 | ], 9 | "homepage": "https://www.originphp.com/", 10 | "license": "MIT", 11 | "authors": [ 12 | { 13 | "name": "Jamiel Sharief", 14 | "email": "js@originphp.com" 15 | } 16 | ], 17 | "autoload": { 18 | "psr-4": { 19 | "Origin\\Core\\": "." 20 | }, 21 | "files": [ 22 | "functions.php" 23 | ] 24 | }, 25 | "require": { 26 | "php": ">=7.3.0", 27 | "originphp/inflector": "^2.0" 28 | }, 29 | "suggest": { 30 | "originphp/dotenv": "If this package is used part of the framework and you will use bootstrap.php" 31 | }, 32 | "minimum-stability": "dev", 33 | "prefer-stable": true 34 | } 35 | -------------------------------------------------------------------------------- /src/Http/Exception/ForbiddenException.php: -------------------------------------------------------------------------------- 1 | =7.3.0", 26 | "originphp/configurable": "^2.0", 27 | "originphp/core": "^3.0", 28 | "originphp/log": "^2.0", 29 | "originphp/model": "^3.0", 30 | "originphp/redis": "^3.0", 31 | "originphp/security": "^2.0" 32 | }, 33 | "minimum-stability": "dev", 34 | "prefer-stable": true 35 | } 36 | -------------------------------------------------------------------------------- /src/Process/BaseProcess.php: -------------------------------------------------------------------------------- 1 | dispatch(); 31 | -------------------------------------------------------------------------------- /src/Model/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "originphp/model", 3 | "description": "OriginPHP ORM", 4 | "type": "library", 5 | "keywords": [ 6 | "orm" 7 | ], 8 | "homepage": "https://www.originphp.com/", 9 | "license": "MIT", 10 | "authors": [ 11 | { 12 | "name": "Jamiel Sharief", 13 | "email": "js@originphp.com" 14 | } 15 | ], 16 | "autoload": { 17 | "psr-4": { 18 | "Origin\\Model\\": "." 19 | } 20 | }, 21 | "require": { 22 | "php": ">=7.3.0", 23 | "originphp/cache": "^2.0", 24 | "originphp/configurable": "^2.0", 25 | "originphp/core": "^3.0", 26 | "originphp/inflector": "^2.0", 27 | "originphp/log": "^2.0", 28 | "originphp/utility": "^3.0", 29 | "originphp/validation": "^2.0", 30 | "originphp/xml": "^2.0" 31 | }, 32 | "minimum-stability": "dev", 33 | "prefer-stable": true 34 | } 35 | -------------------------------------------------------------------------------- /src/Mailbox/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "originphp/mailbox", 3 | "description": "OriginPHP Mailbox", 4 | "type": "library", 5 | "keywords": [ 6 | "mailbox", 7 | "imap", 8 | "pop3" 9 | ], 10 | "homepage": "https://www.originphp.com/", 11 | "license": "MIT", 12 | "authors": [ 13 | { 14 | "name": "Jamiel Sharief", 15 | "email": "js@originphp.com" 16 | } 17 | ], 18 | "autoload": { 19 | "psr-4": { 20 | "Origin\\Mailbox\\": "." 21 | } 22 | }, 23 | "require": { 24 | "php": ">=7.3.0", 25 | "originphp/configurable": "^2.0", 26 | "originphp/core": "^3.0", 27 | "originphp/job": "^3.0", 28 | "originphp/log": "^2.0", 29 | "originphp/model": "^3.0", 30 | "originphp/security": "^2.0", 31 | "originphp/service-object": "^3.0" 32 | }, 33 | "minimum-stability": "dev", 34 | "prefer-stable": true 35 | } 36 | -------------------------------------------------------------------------------- /src/Http/Exception/NotImplementedException.php: -------------------------------------------------------------------------------- 1 | =7.3.0", 25 | "originphp/core": "^3.20", 26 | "originphp/configurable": "^2.0", 27 | "originphp/console": "^3.20", 28 | "originphp/process": "^3.20" 29 | }, 30 | "suggest": { 31 | "originphp/job": "If you are going to queue events" 32 | }, 33 | "minimum-stability": "dev", 34 | "prefer-stable": true, 35 | "bin": [ 36 | "bin/schedule:run" 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /src/Http/Middleware/Exception/MaintainenceModeException.php: -------------------------------------------------------------------------------- 1 | =7.3.0", 24 | "originphp/core": "^3.0", 25 | "originphp/inflector": "^2.0", 26 | "originphp/model": "^3.0", 27 | "phpunit/phpunit": "^9.2" 28 | }, 29 | "suggest": { 30 | "originphp/http": "If you are going to use integration testing for web based applications", 31 | "originphp/console": "If you are going to use integration testing for console based commands", 32 | "originphp/job": "If you want to test queued jobs" 33 | }, 34 | "minimum-stability": "dev", 35 | "prefer-stable": true 36 | } 37 | -------------------------------------------------------------------------------- /src/Migration/Sql.php: -------------------------------------------------------------------------------- 1 | statements = array_filter((array) $mixed); 29 | } 30 | 31 | /** 32 | * Gets the statements for this 33 | * 34 | * @return array 35 | */ 36 | public function statements(): array 37 | { 38 | return $this->statements; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Publisher/ListenerJob.php: -------------------------------------------------------------------------------- 1 | onError('errorHandler'); 26 | } 27 | 28 | protected function execute(string $className, string $method, array $args = []) 29 | { 30 | ( new Publisher())->dispatch(new $className(), $method, $args); 31 | } 32 | 33 | protected function errorHandler(\Exception $exception): void 34 | { 35 | $this->retry(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/I18n/functions.php: -------------------------------------------------------------------------------- 1 | $user->id,'name'=>$user->name]); 22 | * @param string $string 23 | * @param array $vars array of vars e.g ['id'=>$user->id,'name'=>$user->name] 24 | * @return string|null formatted 25 | */ 26 | function __(string $string = null, array $vars = []): ?string 27 | { 28 | if ($string) { 29 | return I18n::translate($string, $vars); 30 | } 31 | 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Http/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "originphp/http", 3 | "description": "OriginPHP Http Package, provides the Controller and View functionality.", 4 | "type": "library", 5 | "keywords": [], 6 | "homepage": "https://www.originphp.com/", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Jamiel Sharief", 11 | "email": "js@originphp.com" 12 | } 13 | ], 14 | "autoload": { 15 | "psr-4": { 16 | "Origin\\Http\\": "." 17 | } 18 | }, 19 | "require": { 20 | "php": ">=7.3.0", 21 | "originphp/cache": "^2.0", 22 | "originphp/configurable": "^2.0", 23 | "originphp/core": "^3.0", 24 | "originphp/defer": "^3.0", 25 | "originphp/i18n": "^3.0", 26 | "originphp/inflector": "^2.0", 27 | "originphp/log": "^2.0", 28 | "originphp/model": "^3.0", 29 | "originphp/security": "^2.0", 30 | "originphp/utility": "^3.0", 31 | "originphp/xml": "^2.0", 32 | "originphp/redis": "^3.0" 33 | }, 34 | "suggest": { 35 | "originphp/model": "To use the Auth component" 36 | }, 37 | "minimum-stability": "dev", 38 | "prefer-stable": true 39 | } 40 | -------------------------------------------------------------------------------- /src/Console/BaseApplication.php: -------------------------------------------------------------------------------- 1 | executeHook('initialize'); 27 | } 28 | 29 | /** 30 | * Dispatches the command 31 | * 32 | * @return int 33 | */ 34 | public function dispatch(array $arguments = []): int 35 | { 36 | $this->executeHook('startup'); 37 | $exitCode = (new CommandRunner())->run($arguments); 38 | $this->executeHook('shutdown'); 39 | 40 | return $exitCode; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Core/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Http/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/I18n/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Job/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Lock/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Mailer/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Model/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Redis/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Console/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Mailbox/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Migration/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Process/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Publisher/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Service/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/TestSuite/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Utility/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2021 Jamiel Sharief. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/Core/Exception/Exception.php: -------------------------------------------------------------------------------- 1 | template !== null) { 29 | if (! is_array($message)) { 30 | $message = [$message]; 31 | } 32 | $message = vsprintf($this->template, $message); 33 | } 34 | if ($this->defaultErrorCode !== null) { 35 | $code = $this->defaultErrorCode; 36 | } 37 | 38 | parent::__construct($message, $code); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Mailbox/Job/MailboxCleanJob.php: -------------------------------------------------------------------------------- 1 | loadModel('InboundEmail', ['className' => InboundEmail::class]); 37 | } 38 | 39 | protected function execute(Entity $message): void 40 | { 41 | $this->InboundEmail->delete($message); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Mailbox/Model/ImapMessage.php: -------------------------------------------------------------------------------- 1 | validate('account', 'notBlank'); 34 | $this->validate('message_id', 'notBlank'); 35 | } 36 | 37 | public function findByAccount(string $account) 38 | { 39 | return $this->select(['id','message_id']) 40 | ->where(['account' => $account]) 41 | ->first(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Http/Middleware/DispatcherMiddleware.php: -------------------------------------------------------------------------------- 1 | dispatch($request, $response); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Publisher/Listener.php: -------------------------------------------------------------------------------- 1 | executeHook('initialize'); 27 | } 28 | 29 | /** 30 | * Dispatches a method 31 | * 32 | * @param string $method 33 | * @param array $arguments 34 | * @return boolean 35 | */ 36 | public function dispatch(string $method, array $arguments = []): bool 37 | { 38 | $this->executeHook('startup'); 39 | if ($this->executeHook($method, $arguments) === false) { 40 | return false; 41 | } 42 | $this->executeHook('shutdown'); 43 | 44 | return true; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Ssh/RemoteFile.php: -------------------------------------------------------------------------------- 1 | name('run'); 37 | $app->description([ 38 | 'Runs scheduled tasks' 39 | ]); 40 | $app->addCommand('run', ScheduleRunCommand::class); 41 | exit($app->run()); 42 | -------------------------------------------------------------------------------- /src/TestSuite/Stub/ConsoleInput.php: -------------------------------------------------------------------------------- 1 | input = $input; 29 | } 30 | 31 | public function read(): ?string 32 | { 33 | $index = $this->currentIndex(); 34 | 35 | if (! isset($this->input[$index])) { 36 | throw new ConsoleInputRequiredException('Console input is requesting more input that what was provided'); 37 | } 38 | 39 | return $this->input[$index]; 40 | } 41 | 42 | private function currentIndex(): int 43 | { 44 | $this->current ++; 45 | 46 | return $this->current; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/TestSuite/TestTrait.php: -------------------------------------------------------------------------------- 1 | $method(); 32 | } 33 | 34 | return call_user_func_array([$this, $method], $args); 35 | } 36 | 37 | public function getProperty(string $property) 38 | { 39 | if (isset($this->$property)) { 40 | return $this->$property; 41 | } 42 | } 43 | 44 | public function setProperty(string $property, $value) 45 | { 46 | $this->$property = $value; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Model/Seed.php: -------------------------------------------------------------------------------- 1 | executeHook('initialize'); 26 | } 27 | /** 28 | * Creates the SQL statements for inserting 29 | * 30 | * @param \Origin\Model\Connection $connection 31 | * @return array 32 | */ 33 | public function insertSql(Connection $connection): array 34 | { 35 | $out = []; 36 | $properties = get_object_vars($this); 37 | foreach (array_keys($properties) as $table) { 38 | foreach ($this->$table as $record) { 39 | $builder = $connection->queryBuilder($table); 40 | $sql = $builder->insert($record)->write(); 41 | $out[] = [$sql,$builder->getValues()]; 42 | } 43 | } 44 | 45 | return $out; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Mailbox/Job/MailboxJob.php: -------------------------------------------------------------------------------- 1 | loadModel('InboundEmail', ['className' => InboundEmail::class]); 39 | } 40 | 41 | protected function execute(Entity $inboundEmail): void 42 | { 43 | $mail = new Mail($inboundEmail->message); 44 | $mailbox = Mailbox::mailbox($mail->recipients()); 45 | 46 | if ($mailbox) { 47 | (new $mailbox($inboundEmail))->dispatch(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Model/Repository/Repository.php: -------------------------------------------------------------------------------- 1 | modelClass === null) { 41 | list($namespace, $class) = namespaceSplit(get_class($this)); 42 | $this->modelClass = Inflector::singular(substr($class, 0, -10)); 43 | } 44 | /** 45 | * Models are dependcies and should not be lazyloaded. 46 | */ 47 | $this->loadModel($this->modelClass); 48 | $this->executeHook('initialize', func_get_args()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Mailer/Message.php: -------------------------------------------------------------------------------- 1 | header = $header; 25 | $this->body = $body; 26 | } 27 | 28 | /** 29 | * Gets the message header 30 | * 31 | * @return string 32 | */ 33 | public function header(): string 34 | { 35 | return $this->header; 36 | } 37 | 38 | /** 39 | * Gets the message body 40 | * 41 | * @return string 42 | */ 43 | public function body(): string 44 | { 45 | return $this->body; 46 | } 47 | 48 | /** 49 | * Returns the full message (header and body) 50 | * 51 | * @return string 52 | */ 53 | public function message(): string 54 | { 55 | return $this->header . "\r\n\r\n" . $this->body; 56 | } 57 | 58 | public function __toString() 59 | { 60 | return $this->message(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Console/ConsoleInput.php: -------------------------------------------------------------------------------- 1 | stream = fopen($stream, 'r'); 33 | } 34 | 35 | /** 36 | * Reads from the stream 37 | * 38 | * @return string|null 39 | */ 40 | public function read(): ?string 41 | { 42 | $data = fgets($this->stream); 43 | 44 | return $data ? trim($data) : null; 45 | } 46 | 47 | /** 48 | * Closes the stream 49 | * 50 | * @return void 51 | */ 52 | public function close(): void 53 | { 54 | if (is_resource($this->stream)) { 55 | fclose($this->stream); 56 | } 57 | } 58 | 59 | public function __destruct() 60 | { 61 | $this->close(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/Model/Query/QueryObject.php: -------------------------------------------------------------------------------- 1 | Article = $Article; 30 | * } 31 | * 32 | * public function execute() : Collection 33 | * { 34 | * .... 35 | * } 36 | * } 37 | * 38 | * Example 39 | * 40 | * $result = (new BooleanSearchQuery($this->Article))->execute('how to'); 41 | * 42 | * @see https://www.martinfowler.com/eaaCatalog/queryObject.html 43 | */ 44 | class QueryObject 45 | { 46 | use HookTrait; 47 | 48 | public function __construct() 49 | { 50 | $this->executeHook('initialize', func_get_args()); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Schedule/Command/ScheduleRunCommand.php: -------------------------------------------------------------------------------- 1 | addOption('directory', [ 29 | 'description' => 'The directory where the tasks files are' 30 | ]); 31 | 32 | $this->addOption('id', [ 33 | 'description' => 'A specific event ID that should be run' 34 | ]); 35 | } 36 | 37 | /** 38 | * @return void 39 | */ 40 | protected function execute(): void 41 | { 42 | $path = $this->options('directory') ?: Schedule::config('path'); 43 | 44 | if (is_null($path)) { 45 | $path = (defined('ROOT') ? ROOT : getcwd()) . '/app/Task'; 46 | } 47 | 48 | try { 49 | Schedule::run($path, $this->options('id')); 50 | } catch (ScheduleException $exception) { 51 | $this->throwError($exception->getMessage()); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/TestSuite/Stub/ConsoleOutput.php: -------------------------------------------------------------------------------- 1 | level === self::QUIET || ($level === self::VERBOSE && $this->level === self::NORMAL)) { 32 | return strlen($buffer); 33 | } 34 | 35 | $this->buffer .= $buffer; 36 | 37 | return strlen($buffer); 38 | } 39 | 40 | public function read() 41 | { 42 | return $this->buffer; 43 | } 44 | } 45 | 46 | /* 47 | class ConsoleOutput extends BaseConsoleOutput 48 | { 49 | protected $mode = SELF::RAW; 50 | 51 | protected $buffer = ''; 52 | 53 | protected function fwrite(string $data) : int 54 | { 55 | $this->buffer .= $data; 56 | 57 | return strlen($data); 58 | } 59 | 60 | public function read() 61 | { 62 | return $this->buffer; 63 | } 64 | } 65 | 66 | */ 67 | -------------------------------------------------------------------------------- /src/Core/bootstrap.php: -------------------------------------------------------------------------------- 1 | register(); 32 | } else { 33 | ( new Origin\Http\ErrorHandler())->register(); 34 | } 35 | 36 | /** 37 | * As of version 2.6 .env.php is the cached version of .env. Prior 38 | * to this config was set manually .env.php 39 | */ 40 | $configFile = ROOT . '/config/.env.php'; 41 | if (file_exists($configFile)) { 42 | $result = include $configFile; 43 | foreach ($result as $key => $value) { 44 | $_ENV[$key] = $value; 45 | } 46 | } elseif (file_exists(ROOT . '/config/.env')) { 47 | $vars = (new DotEnv())->load(ROOT. '/config'); 48 | $header = [ 49 | '# .env (cached version) - Do not edit, delete instead', 50 | '# Automatically generated ' . now(), 51 | ]; 52 | if (env('APP_DEBUG') === false) { 53 | (new PhpFile())->write($configFile, $vars, ['short' => true,'before' => implode("\n", $header)]); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Mailer/MailerJob.php: -------------------------------------------------------------------------------- 1 | onError('errorHandler'); 26 | } 27 | 28 | /** 29 | * Executes the MailerJob, the first param is class or object and then after that are arguments 30 | * 31 | * @return void 32 | */ 33 | public function execute(): void 34 | { 35 | $arguments = func_get_args(); 36 | 37 | /** 38 | * Temporary backwards comptability to prevent queued jobs from breaking 39 | * @deprecated this will be depcreated 40 | */ 41 | if (isset($arguments[0]) && is_array($arguments[0])) { 42 | $mailer = $arguments['mailer']; 43 | $arguments = $arguments['arguments']; 44 | } else { 45 | $mailer = array_shift($arguments); 46 | if (! is_object($mailer)) { 47 | $mailer = new $mailer(); 48 | } 49 | } 50 | 51 | $mailer->dispatch(...$arguments); 52 | } 53 | 54 | public function errorHandler(\Exception $exception): void 55 | { 56 | $this->retry(['wait' => '+30 minutes','limit' => 3]); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Http/Controller/Component/FlashComponent.php: -------------------------------------------------------------------------------- 1 | loadComponent('Session'); 25 | } 26 | 27 | public function error(string $message): void 28 | { 29 | $this->addMessage('error', $message); 30 | } 31 | 32 | public function success(string $message): void 33 | { 34 | $this->addMessage('success', $message); 35 | } 36 | 37 | public function warning(string $message): void 38 | { 39 | $this->addMessage('warning', $message); 40 | } 41 | 42 | public function info(string $message): void 43 | { 44 | $this->addMessage('info', $message); 45 | } 46 | 47 | public function addMessage(string $type, string $message): void 48 | { 49 | $messages = []; 50 | 51 | if ($this->Session->exists('Flash')) { 52 | $messages = $this->Session->read('Flash'); 53 | } 54 | $messages[] = [ 55 | 'template' => $type, 56 | 'message' => $message 57 | ]; 58 | $this->Session->write('Flash', $messages); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Model/Exception/RecordSaveException.php: -------------------------------------------------------------------------------- 1 | entity = $entity; 30 | 31 | $message = $this->formatMessage($entity, $message); 32 | 33 | parent::__construct($message, $code); 34 | } 35 | 36 | /** 37 | * @return \Origin\Model\Entity 38 | */ 39 | public function getEntity(): Entity 40 | { 41 | return $this->entity; 42 | } 43 | 44 | /** 45 | * @param \Origin\Model\Entity $entity 46 | * @param string $message 47 | * @return string 48 | */ 49 | private function formatMessage(Entity $entity, string $message): string 50 | { 51 | $out = []; 52 | foreach ($entity->errors() as $field => $errors) { 53 | foreach ($errors as $error) { 54 | $out[] = "{$field}: {$error}"; 55 | } 56 | } 57 | 58 | return sprintf( 59 | '%s %s failure. The following errors were found (%s).', 60 | $entity->name(), 61 | $message, 62 | implode(', ', $out), 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Http/Middleware/MinifyMiddleware.php: -------------------------------------------------------------------------------- 1 | true, 33 | /** 34 | * Minifies inline Javascript 35 | */ 36 | 'minifyJs' => true, 37 | /** 38 | * Minifies inline Styles 39 | */ 40 | 'minifyCss' => true 41 | ]; 42 | 43 | /** 44 | * @param \Origin\Http\Request $request 45 | * @param \Origin\Http\Response $response 46 | * @return void 47 | */ 48 | public function process(Request $request, Response $response): void 49 | { 50 | if ($response->contentType() === 'text/html' && $response->body()) { 51 | $this->minifyBody($response); 52 | } 53 | } 54 | 55 | /** 56 | * Handles the minfication 57 | * 58 | * @param \Origin\Http\Response $response 59 | * @return void 60 | */ 61 | private function minifyBody(Response $response): void 62 | { 63 | $response->body( 64 | Html::minify($response->body(), $this->config()) 65 | ); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Http/View/Helper/FlashHelper.php: -------------------------------------------------------------------------------- 1 | [ 28 | 'error' => '