diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 31e642eff..97fb03912 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Start Memcached uses: niden/actions-memcached@v7 @@ -44,7 +44,7 @@ jobs: - name: Cache Composer packages id: composer-cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: vendor key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} @@ -54,6 +54,9 @@ jobs: - name: Install dependencies run: composer install --prefer-dist --no-progress + - name: Run PHP-CS-Fixer + run: composer cs:check + - name: Run PHPStan run: composer phpstan @@ -61,7 +64,7 @@ jobs: run: composer test -- --fail-on-warning --fail-on-risky - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 32b789d91..fe85b5398 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,28 @@ -/vendor -/.idea -/nbproject/* -/tests/_root/shared/store/* +# ========================= +# Dependencies (Composer) +# ========================= +/vendor/ composer.lock -.phpunit.result.cache + +# ========================= +# IDE / Editor files +# ========================= +/.idea/ +/nbproject/ +.DS_Store +Thumbs.db + +# ========================= +# Test & Runtime artifacts +# ========================= +/tests/_root/shared/store/* +/coverage/ +*.log + +# ========================= +# Tooling cache files +# ========================= +/.php-cs-fixer.cache +/.phpunit.result.cache +/.phpunit.cache +/.cache/ \ No newline at end of file diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 000000000..4cec837a0 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,28 @@ +in(__DIR__) + ->exclude(['vendor']) + ->name('*.php'); + +return (new Config()) + ->setRiskyAllowed(false) + ->setRules([ + // Base standard + '@PSR12' => true, + + // Syntax & consistency + 'array_syntax' => ['syntax' => 'short'], + 'binary_operator_spaces' => ['default' => 'single_space'], + 'concat_space' => ['spacing' => 'one'], + 'single_quote' => true, + 'trailing_comma_in_multiline' => true, + 'no_unused_imports' => true, + 'no_extra_blank_lines' => true, + 'blank_line_after_namespace' => true, + 'blank_line_after_opening_tag' => true, + ]) + ->setFinder($finder); diff --git a/composer.json b/composer.json index 84c6ac50b..2cf4e4be9 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,8 @@ "mockery/mockery": "^1.4", "mikey179/vfsstream": "^1.6", "rector/rector": "^2.3", - "phpstan/phpstan": "^2.1" + "phpstan/phpstan": "^2.1", + "friendsofphp/php-cs-fixer": "^3.92" }, "suggest": { "ext-dom": "Required for XML/HTML processing", @@ -76,7 +77,9 @@ } }, "scripts": { - "phpstan": "phpstan analyse --memory-limit=512M --no-progress --error-format=github", + "cs:check": "vendor/bin/php-cs-fixer check", + "cs:fix": "vendor/bin/php-cs-fixer fix", + "phpstan": "vendor/bin/phpstan analyse --memory-limit=-1 --error-format=github", "test": "vendor/bin/phpunit --stderr --testdox --coverage-clover coverage.xml" }, "minimum-stability": "stable", diff --git a/rector.php b/rector.php index 758052b3d..95e660b1c 100644 --- a/rector.php +++ b/rector.php @@ -12,4 +12,4 @@ ]) ->withSets([ LevelSetList::UP_TO_PHP_80, - ]); \ No newline at end of file + ]); diff --git a/src/App/Adapters/AppAdapter.php b/src/App/Adapters/AppAdapter.php index f14b6d668..441b19a44 100644 --- a/src/App/Adapters/AppAdapter.php +++ b/src/App/Adapters/AppAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\App\Adapters; @@ -19,7 +19,6 @@ use Quantum\Di\Exceptions\DiException; use Quantum\App\Traits\AppTrait; use ReflectionException; -use Quantum\Di\Di; /** * Class AppAdapter @@ -27,7 +26,6 @@ */ abstract class AppAdapter implements AppInterface { - use AppTrait; /** @@ -48,4 +46,4 @@ public function __construct() $this->loadAppHelperFunctions(); $this->loadModuleHelperFunctions(); } -} \ No newline at end of file +} diff --git a/src/App/Adapters/ConsoleAppAdapter.php b/src/App/Adapters/ConsoleAppAdapter.php index 1fe39ed27..ef3fadd77 100644 --- a/src/App/Adapters/ConsoleAppAdapter.php +++ b/src/App/Adapters/ConsoleAppAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\App\Adapters; @@ -36,7 +36,6 @@ */ class ConsoleAppAdapter extends AppAdapter { - use ConsoleAppTrait; /** @@ -54,7 +53,6 @@ class ConsoleAppAdapter extends AppAdapter */ protected $application; - public function __construct() { parent::__construct(); @@ -103,4 +101,4 @@ public function start(): ?int return $exception->getCode(); } } -} \ No newline at end of file +} diff --git a/src/App/Adapters/WebAppAdapter.php b/src/App/Adapters/WebAppAdapter.php index 4b2247b43..a3f44d62f 100644 --- a/src/App/Adapters/WebAppAdapter.php +++ b/src/App/Adapters/WebAppAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\App\Adapters; @@ -44,7 +44,6 @@ */ class WebAppAdapter extends AppAdapter { - use WebAppTrait; /** @@ -132,4 +131,4 @@ public function start(): ?int return $exception->getCode(); } } -} \ No newline at end of file +} diff --git a/src/App/App.php b/src/App/App.php index 167367ee3..ab1f8f101 100644 --- a/src/App/App.php +++ b/src/App/App.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\App; @@ -24,16 +24,15 @@ */ class App { - /** * Web app adapter */ - const WEB = 'web'; + public const WEB = 'web'; /** * Console app adapter */ - const CONSOLE = 'console'; + public const CONSOLE = 'console'; /** * @var string @@ -91,4 +90,4 @@ public function __call(string $method, ?array $arguments) return $this->adapter->$method(...$arguments); } -} \ No newline at end of file +} diff --git a/src/App/Config/dependencies.php b/src/App/Config/dependencies.php index de9549033..9b8a91fa6 100644 --- a/src/App/Config/dependencies.php +++ b/src/App/Config/dependencies.php @@ -4,4 +4,4 @@ \Quantum\Loader\Loader::class => \Quantum\Loader\Loader::class, \Quantum\Http\Request::class => \Quantum\Http\Request::class, \Quantum\Http\Response::class => \Quantum\Http\Response::class, -]; \ No newline at end of file +]; diff --git a/src/App/Contracts/AppInterface.php b/src/App/Contracts/AppInterface.php index fd07cdc1f..b6bbc82d8 100644 --- a/src/App/Contracts/AppInterface.php +++ b/src/App/Contracts/AppInterface.php @@ -9,12 +9,11 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\App\Contracts; - /** * Interface AppInterface * @package Quantum\App @@ -26,4 +25,4 @@ interface AppInterface * @return int|null */ public function start(): ?int; -} \ No newline at end of file +} diff --git a/src/App/Enums/ExceptionMessages.php b/src/App/Enums/ExceptionMessages.php index b3705bf06..224d52adf 100644 --- a/src/App/Enums/ExceptionMessages.php +++ b/src/App/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\App\Enums; @@ -20,25 +20,25 @@ */ class ExceptionMessages { - const APP_KEY_MISSING = 'APP KEY is missing.'; + public const APP_KEY_MISSING = 'APP KEY is missing.'; - const EXECUTION_TERMINATED = 'Execution was terminated.'; + public const EXECUTION_TERMINATED = 'Execution was terminated.'; - const METHOD_NOT_SUPPORTED = 'The method `{%1}` is not supported for `{%2}`.'; + public const METHOD_NOT_SUPPORTED = 'The method `{%1}` is not supported for `{%2}`.'; - const ADAPTER_NOT_SUPPORTED = 'The adapter `{%1}` is not supported.'; + public const ADAPTER_NOT_SUPPORTED = 'The adapter `{%1}` is not supported.'; - const DRIVER_NOT_SUPPORTED = 'The driver `{%1}` is not supported.'; + public const DRIVER_NOT_SUPPORTED = 'The driver `{%1}` is not supported.'; - const FILE_NOT_FOUND = 'The file `{%1}` not found.'; + public const FILE_NOT_FOUND = 'The file `{%1}` not found.'; - const NOT_FOUND = '{%1} `{%2}` not found.'; + public const NOT_FOUND = '{%1} `{%2}` not found.'; - const NOT_INSTANCE_OF = 'The `{%1}` is not instance of `{%2}`.'; + public const NOT_INSTANCE_OF = 'The `{%1}` is not instance of `{%2}`.'; - const CANT_CONNECT = 'Can not connect to `{%1}`.'; + public const CANT_CONNECT = 'Can not connect to `{%1}`.'; - const MISSING_CONFIG = 'Could not load config `{%1}` properly.'; + public const MISSING_CONFIG = 'Could not load config `{%1}` properly.'; - const UNAVAILABLE_REQUEST_METHOD = 'Provided request method `{%1}` is not available.'; -} \ No newline at end of file + public const UNAVAILABLE_REQUEST_METHOD = 'Provided request method `{%1}` is not available.'; +} diff --git a/src/App/Enums/ReservedKeys.php b/src/App/Enums/ReservedKeys.php index 4e4e813b4..d40f8fc1f 100644 --- a/src/App/Enums/ReservedKeys.php +++ b/src/App/Enums/ReservedKeys.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\App\Enums; @@ -20,7 +20,6 @@ */ final class ReservedKeys { - /** * Internal response key for rendered view */ @@ -31,4 +30,4 @@ final class ReservedKeys */ public const PREV_REQUEST = '_qt_prev_request'; -} \ No newline at end of file +} diff --git a/src/App/Exceptions/AppException.php b/src/App/Exceptions/AppException.php index 1a90ba954..cae9064f1 100644 --- a/src/App/Exceptions/AppException.php +++ b/src/App/Exceptions/AppException.php @@ -24,7 +24,6 @@ */ class AppException extends BaseException { - /** * @return AppException */ diff --git a/src/App/Exceptions/BaseException.php b/src/App/Exceptions/BaseException.php index 94cf36cff..03fcab03b 100644 --- a/src/App/Exceptions/BaseException.php +++ b/src/App/Exceptions/BaseException.php @@ -25,12 +25,11 @@ */ abstract class BaseException extends Exception { - /** * @param string $message * @param int $code */ - final public function __construct(string $message = "", int $code = 0) + final public function __construct(string $message = '', int $code = 0) { parent::__construct($message, $code); } @@ -146,4 +145,4 @@ public static function requestMethodNotAvailable(string $name) E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/App/Exceptions/StopExecutionException.php b/src/App/Exceptions/StopExecutionException.php index dad7ec66c..d50cbe1ba 100644 --- a/src/App/Exceptions/StopExecutionException.php +++ b/src/App/Exceptions/StopExecutionException.php @@ -24,7 +24,6 @@ */ class StopExecutionException extends BaseException { - /** * @param int|null $code * @return StopExecutionException @@ -36,4 +35,4 @@ public static function executionTerminated(?int $code): self $code ); } -} \ No newline at end of file +} diff --git a/src/App/Factories/AppFactory.php b/src/App/Factories/AppFactory.php index 2673d20e7..4e258d41d 100644 --- a/src/App/Factories/AppFactory.php +++ b/src/App/Factories/AppFactory.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\App\Factories; @@ -26,11 +26,10 @@ */ class AppFactory { - /** * Supported adapters */ - const ADAPTERS = [ + public const ADAPTERS = [ App::WEB => WebAppAdapter::class, App::CONSOLE => ConsoleAppAdapter::class, ]; @@ -83,4 +82,4 @@ private static function createInstance(string $type, string $baseDir): App return new App(new $adapterClass()); } -} \ No newline at end of file +} diff --git a/src/App/Helpers/dir.php b/src/App/Helpers/dir.php index 5913f9cb4..47ff42250 100644 --- a/src/App/Helpers/dir.php +++ b/src/App/Helpers/dir.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\App\App; @@ -128,4 +128,4 @@ function get_directory_classes(string $path): array } return $class_names; -} \ No newline at end of file +} diff --git a/src/App/Helpers/misc.php b/src/App/Helpers/misc.php index 9046d91f4..2baee3b18 100644 --- a/src/App/Helpers/misc.php +++ b/src/App/Helpers/misc.php @@ -129,4 +129,4 @@ function get_caller_function(int $index = 2): ?string function export($var): string { return VarExporter::export($var); -} \ No newline at end of file +} diff --git a/src/App/Helpers/uuid.php b/src/App/Helpers/uuid.php index 96ce597c7..d12b509b3 100644 --- a/src/App/Helpers/uuid.php +++ b/src/App/Helpers/uuid.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ use Ramsey\Uuid\Uuid; diff --git a/src/App/Traits/AppTrait.php b/src/App/Traits/AppTrait.php index fda0ae75b..c2ddfc3e1 100644 --- a/src/App/Traits/AppTrait.php +++ b/src/App/Traits/AppTrait.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\App\Traits; @@ -36,7 +36,6 @@ */ trait AppTrait { - /** * Sets the app base directory * @param string $baseDir @@ -178,4 +177,4 @@ protected function loadLanguage() $lang->load(); } } -} \ No newline at end of file +} diff --git a/src/App/Traits/ConsoleAppTrait.php b/src/App/Traits/ConsoleAppTrait.php index c32eb215a..21ae36e45 100644 --- a/src/App/Traits/ConsoleAppTrait.php +++ b/src/App/Traits/ConsoleAppTrait.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\App\Traits; @@ -25,7 +25,6 @@ */ trait ConsoleAppTrait { - /** * @param string $name * @param string $version @@ -85,4 +84,4 @@ private function validateCommand(): void throw new Exception("Command `$commandName` is not defined"); } } -} \ No newline at end of file +} diff --git a/src/App/Traits/WebAppTrait.php b/src/App/Traits/WebAppTrait.php index 31fc35214..c8b972560 100644 --- a/src/App/Traits/WebAppTrait.php +++ b/src/App/Traits/WebAppTrait.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\App\Traits; @@ -39,7 +39,6 @@ */ trait WebAppTrait { - /** * @param Request $request * @param Response $response @@ -128,4 +127,4 @@ private function handleCors(Response $response) $response->setHeader($key, $value); } } -} \ No newline at end of file +} diff --git a/src/Config/Config.php b/src/Config/Config.php index 40482293e..469598549 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Config; @@ -29,7 +29,6 @@ */ class Config implements StorageInterface { - /** * Configs * @var Data|null @@ -158,4 +157,4 @@ public function flush() { self::$configs = null; } -} \ No newline at end of file +} diff --git a/src/Config/Enums/ExceptionMessages.php b/src/Config/Enums/ExceptionMessages.php index fdbc36117..659285ebb 100644 --- a/src/Config/Enums/ExceptionMessages.php +++ b/src/Config/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Config\Enums; @@ -22,5 +22,5 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const CONFIG_COLLISION = 'Config key `{%1}` is already in use'; -} \ No newline at end of file + public const CONFIG_COLLISION = 'Config key `{%1}` is already in use'; +} diff --git a/src/Config/Exceptions/ConfigException.php b/src/Config/Exceptions/ConfigException.php index c92eb087d..bd2e0929a 100644 --- a/src/Config/Exceptions/ConfigException.php +++ b/src/Config/Exceptions/ConfigException.php @@ -25,7 +25,6 @@ */ class ConfigException extends BaseException { - /** * @param string $name * @return ConfigException @@ -37,4 +36,4 @@ public static function configCollision(string $name): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Config/Helpers/config.php b/src/Config/Helpers/config.php index 071b2eea5..0b9aebaf0 100644 --- a/src/Config/Helpers/config.php +++ b/src/Config/Helpers/config.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\Config\Config; @@ -21,4 +21,4 @@ function config(): Config { return Config::getInstance(); -} \ No newline at end of file +} diff --git a/src/Console/CommandDiscovery.php b/src/Console/CommandDiscovery.php index 2ea0fb886..6cc1018c9 100644 --- a/src/Console/CommandDiscovery.php +++ b/src/Console/CommandDiscovery.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Console; @@ -23,7 +23,6 @@ */ class CommandDiscovery { - /** * @param string $directory * @param string $namespace @@ -59,4 +58,4 @@ public static function discover(string $directory, string $namespace): array return $commands; } -} \ No newline at end of file +} diff --git a/src/Console/Commands/DebugBarCommand.php b/src/Console/Commands/DebugBarCommand.php index c1785f421..30af5cc7a 100644 --- a/src/Console/Commands/DebugBarCommand.php +++ b/src/Console/Commands/DebugBarCommand.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Console\Commands; @@ -116,4 +116,4 @@ private function copyResources(string $src, string $dst) closedir($dir); } } -} \ No newline at end of file +} diff --git a/src/Console/Commands/EnvCommand.php b/src/Console/Commands/EnvCommand.php index 7f567f98c..06e73720e 100644 --- a/src/Console/Commands/EnvCommand.php +++ b/src/Console/Commands/EnvCommand.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Console\Commands; @@ -28,7 +28,6 @@ */ class EnvCommand extends QtCommand { - /** * Command name * @var string @@ -52,7 +51,7 @@ class EnvCommand extends QtCommand * @var array */ protected $options = [ - ['yes', 'y', 'none', 'Acceptance of the confirmation'] + ['yes', 'y', 'none', 'Acceptance of the confirmation'], ]; /** @@ -70,7 +69,7 @@ public function exec() $this->error('.env.example file not found'); } - if ($fs->exists('.env') && !$this->getOption('yes') && !$this->confirm("The operation will overwrite values of the existing .env and will create new one from .env.example. Continue?")) { + if ($fs->exists('.env') && !$this->getOption('yes') && !$this->confirm('The operation will overwrite values of the existing .env and will create new one from .env.example. Continue?')) { $this->info('Operation was canceled!'); return; } @@ -82,4 +81,4 @@ public function exec() $this->info('.env is successfully generated'); } -} \ No newline at end of file +} diff --git a/src/Console/Commands/InstallToolkitCommand.php b/src/Console/Commands/InstallToolkitCommand.php index 78ef4593e..e91f7f751 100644 --- a/src/Console/Commands/InstallToolkitCommand.php +++ b/src/Console/Commands/InstallToolkitCommand.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Console\Commands; @@ -53,11 +53,11 @@ class InstallToolkitCommand extends QtCommand * @var string */ protected $help = 'The command will install Toolkit and its assets into your project'; - + /** * Command name to generate modules */ - const COMMAND_CREATE_MODULE = 'module:generate'; + public const COMMAND_CREATE_MODULE = 'module:generate'; /** * Executes the command @@ -67,22 +67,22 @@ class InstallToolkitCommand extends QtCommand public function exec() { $name = $this->getArgument('username'); - + $password = $this->getArgument('password'); - + $env = Environment::getInstance(); $env->setMutable(true); $env->updateRow('BASIC_AUTH_NAME', $name); - + $env->updateRow('BASIC_AUTH_PWD', $password); $this->runExternalCommand(self::COMMAND_CREATE_MODULE, [ - "module" => "Toolkit", - "--yes" => true, - "--template" => "Toolkit", - "--with-assets" => true + 'module' => 'Toolkit', + '--yes' => true, + '--template' => 'Toolkit', + '--with-assets' => true, ]); $this->info('Toolkit installed successfully'); @@ -97,6 +97,6 @@ public function exec() protected function runExternalCommand(string $commandName, array $arguments) { $command = $this->getApplication()->find($commandName); - $command->run(new ArrayInput($arguments), new NullOutput); + $command->run(new ArrayInput($arguments), new NullOutput()); } -} \ No newline at end of file +} diff --git a/src/Console/Commands/KeyGenerateCommand.php b/src/Console/Commands/KeyGenerateCommand.php index a3a5d70c4..9a13382e2 100644 --- a/src/Console/Commands/KeyGenerateCommand.php +++ b/src/Console/Commands/KeyGenerateCommand.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Console\Commands; @@ -25,7 +25,6 @@ */ class KeyGenerateCommand extends QtCommand { - /** * Command name * @var string @@ -50,7 +49,7 @@ class KeyGenerateCommand extends QtCommand */ protected $options = [ ['length', 'l', 'required', 'Length of the key', 32], - ['yes', 'y', 'none', 'Acceptance of the confirmation'] + ['yes', 'y', 'none', 'Acceptance of the confirmation'], ]; /** @@ -60,8 +59,8 @@ class KeyGenerateCommand extends QtCommand */ public function exec() { - if (Environment::getInstance()->hasKey('APP_KEY') && env('APP_KEY') !== "" && !$this->getOption('yes')) { - if (!$this->confirm("The operation will remove the existing key and will create new one. Continue?")) { + if (Environment::getInstance()->hasKey('APP_KEY') && env('APP_KEY') !== '' && !$this->getOption('yes')) { + if (!$this->confirm('The operation will remove the existing key and will create new one. Continue?')) { $this->info('Operation was canceled!'); return; } diff --git a/src/Console/Commands/MigrationGenerateCommand.php b/src/Console/Commands/MigrationGenerateCommand.php index 2bcff7be3..b2b8a1364 100644 --- a/src/Console/Commands/MigrationGenerateCommand.php +++ b/src/Console/Commands/MigrationGenerateCommand.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Console\Commands; @@ -25,7 +25,6 @@ */ class MigrationGenerateCommand extends QtCommand { - /** * The console command name. * @var string diff --git a/src/Console/Commands/MigrationMigrateCommand.php b/src/Console/Commands/MigrationMigrateCommand.php index 6db852fed..6036e8092 100644 --- a/src/Console/Commands/MigrationMigrateCommand.php +++ b/src/Console/Commands/MigrationMigrateCommand.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Console\Commands; @@ -29,7 +29,6 @@ */ class MigrationMigrateCommand extends QtCommand { - /** * The console command name. * @var string @@ -71,7 +70,7 @@ public function exec() $direction = $this->getArgument('direction') ?: MigrationManager::UPGRADE; - if ($direction == 'down' && !$this->confirm("This operation will revert all the database changes, including the data. Continue?")) { + if ($direction == 'down' && !$this->confirm('This operation will revert all the database changes, including the data. Continue?')) { $this->info('Operation was canceled!'); return; } diff --git a/src/Console/Commands/ModuleGenerateCommand.php b/src/Console/Commands/ModuleGenerateCommand.php index bcaf814bf..205e4a5bf 100644 --- a/src/Console/Commands/ModuleGenerateCommand.php +++ b/src/Console/Commands/ModuleGenerateCommand.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Console\Commands; @@ -58,7 +58,7 @@ class ModuleGenerateCommand extends QtCommand protected $options = [ ['yes', 'y', 'none', 'Module enabled status'], ['template', 't', 'optional', 'The module template', 'DefaultWeb'], - ['with-assets', 'a', 'none', 'Install module will assets'] + ['with-assets', 'a', 'none', 'Install module will assets'], ]; /** @@ -86,4 +86,4 @@ public function exec() $this->error($e->getMessage()); } } -} \ No newline at end of file +} diff --git a/src/Console/Commands/OpenApiCommand.php b/src/Console/Commands/OpenApiCommand.php index 17e35966e..c432086df 100644 --- a/src/Console/Commands/OpenApiCommand.php +++ b/src/Console/Commands/OpenApiCommand.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Console\Commands; @@ -33,7 +33,6 @@ */ class OpenApiCommand extends QtCommand { - /** * File System * @var FileSystem diff --git a/src/Console/Commands/ResourceCacheClearCommand.php b/src/Console/Commands/ResourceCacheClearCommand.php index 03e7c07f7..5a3ec413d 100644 --- a/src/Console/Commands/ResourceCacheClearCommand.php +++ b/src/Console/Commands/ResourceCacheClearCommand.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Console\Commands; @@ -29,213 +29,212 @@ */ class ResourceCacheClearCommand extends QtCommand { + /** + * Command name + * @var string + */ + protected $name = 'cache:clear'; + + /** + * Command description + * @var string + */ + protected $description = 'Clears resource cache'; + + /** + * Command help text + * @var string + */ + protected $help = 'The command will clear the resource cache'; + + /** + * Command options + * @var array + */ + protected $options = [ + ['all', 'all', 'none', ''], + ['type', 't', 'required', ''], + ['module', 'm', 'required', ''], + ]; + + /** + * @var array + */ + protected $types = ['views', 'asserts']; - /** - * Command name - * @var string - */ - protected $name = 'cache:clear'; - - /** - * Command description - * @var string - */ - protected $description = 'Clears resource cache'; - - /** - * Command help text - * @var string - */ - protected $help = 'The command will clear the resource cache'; - - /** - * Command options - * @var array - */ - protected $options = [ - ['all', 'all', 'none', ''], - ['type', 't', 'required', ''], - ['module', 'm', 'required', ''] - ]; - - /** - * @var array - */ - protected $types = ['views', 'asserts']; - - /** - * @var array - */ - protected $modules; - - /** - * @var string|null - */ - protected $type = null; - - /** - * @var string|null - */ - protected $module = null; - - /** - * @var string - */ - protected $cacheDir; - - /** - * @var object - */ - protected $fs; + /** + * @var array + */ + protected $modules; + + /** + * @var string|null + */ + protected $type = null; + + /** + * @var string|null + */ + protected $module = null; + + /** + * @var string + */ + protected $cacheDir; + + /** + * @var object + */ + protected $fs; /** * @throws BaseException */ - public function exec() - { - try { - $this->importConfig(); - $this->initModule($this->getOption('module')); - $this->initType($this->getOption('type')); - }catch (Exception $e){ - $this->error($e->getMessage()); - return; - } - - $this->fs = FileSystemFactory::get(); - - if (!$this->fs->isDirectory($this->cacheDir)) { - $this->error('Cache directory does not exist or is not accessible.'); - return; - } - - if ($this->module || $this->type) { - $this->clearResourceModuleAndType($this->module, $this->type); - } elseif (!empty($this->getOption('all'))) { - $this->removeFilesFromDirectory($this->cacheDir); - } else { - $this->error('Please specify at least one of the following options: --all, --module=moduleName or --type=typeName!'); - return; - } - - $this->info('Resource cache cleared successfully.'); - } - - /** - * @return void - */ - private function importModules() - { - try { - if (!config()->has('modules')) { - config()->import(new Setup('config', 'modules')); - } - - if (config()->has('modules') && is_array(config()->get('modules.modules'))){ - $this->modules = array_keys(array_change_key_case(config()->get('modules.modules'))); - } - } catch (ConfigException|DiException|ReflectionException $e) { - $this->error($e->getMessage()); - return; - } - } - - /** - * @return void - * @throws ConfigException - * @throws DiException - * @throws ReflectionException - */ - private function importConfig(): void - { - if (!config()->has('view_cache')) { - config()->import(new Setup('config', 'view_cache')); - } - - $this->cacheDir = base_dir() . DS . config()->get('view_cache.cache_dir', 'cache'); - } - - /** - * @param string|null $moduleOption - * @return void - * @throws Exception - */ - private function initModule(?string $moduleOption): void - { - if (!in_array($moduleOption, [null, '', '0'], true)) { - $this->importModules(); - $module = strtolower($moduleOption); - - if (in_array($module, $this->modules)) { - $this->module = $module; - } else { - throw new Exception('Module {'. $module .'} does not exist.'); - } - } - } - - /** - * @param string|null $typeOption - * @return void - * @throws Exception - */ - private function initType(?string $typeOption): void - { - if (!in_array($typeOption, [null, '', '0'], true)) { - $type = strtolower($typeOption); - - if (in_array($type, $this->types)) { - $this->type = $type; - } else { - throw new Exception('Cache type {'. $type .'} is invalid.'); - } - } - } - - /** - * @param string|null $moduleName - * @param string|null $type - * @return void - */ - private function clearResourceModuleAndType(?string $moduleName = null, ?string $type = null): void - { - $dir = $this->cacheDir; - - if ($type) { - $dir = $dir . DS . strtolower($type); - } - - if ($moduleName) { - if (!$type) { - $dir = $dir . DS . '*'; - } - - $dir = $dir . DS . strtolower($moduleName); - } - - $this->removeFilesFromDirectory($dir); - } - - /** - * @param string $dir - * @return void - */ - private function removeFilesFromDirectory(string $dir): void - { - $entries = $this->fs->glob($dir . DS . '*'); - - foreach ($entries as $entry) { - if ($this->fs->isDirectory($entry)) { - $this->removeFilesFromDirectory($entry); - - if ($this->fs->fileName($entry) !== config()->get('view_cache.cache_dir', 'cache') && - count($this->fs->glob($entry . DS . '*')) === 0 - ) { - $this->fs->removeDirectory($entry); - } - } else { - $this->fs->remove($entry); - } - } - } -} \ No newline at end of file + public function exec() + { + try { + $this->importConfig(); + $this->initModule($this->getOption('module')); + $this->initType($this->getOption('type')); + } catch (Exception $e) { + $this->error($e->getMessage()); + return; + } + + $this->fs = FileSystemFactory::get(); + + if (!$this->fs->isDirectory($this->cacheDir)) { + $this->error('Cache directory does not exist or is not accessible.'); + return; + } + + if ($this->module || $this->type) { + $this->clearResourceModuleAndType($this->module, $this->type); + } elseif (!empty($this->getOption('all'))) { + $this->removeFilesFromDirectory($this->cacheDir); + } else { + $this->error('Please specify at least one of the following options: --all, --module=moduleName or --type=typeName!'); + return; + } + + $this->info('Resource cache cleared successfully.'); + } + + /** + * @return void + */ + private function importModules() + { + try { + if (!config()->has('modules')) { + config()->import(new Setup('config', 'modules')); + } + + if (config()->has('modules') && is_array(config()->get('modules.modules'))) { + $this->modules = array_keys(array_change_key_case(config()->get('modules.modules'))); + } + } catch (ConfigException|DiException|ReflectionException $e) { + $this->error($e->getMessage()); + return; + } + } + + /** + * @return void + * @throws ConfigException + * @throws DiException + * @throws ReflectionException + */ + private function importConfig(): void + { + if (!config()->has('view_cache')) { + config()->import(new Setup('config', 'view_cache')); + } + + $this->cacheDir = base_dir() . DS . config()->get('view_cache.cache_dir', 'cache'); + } + + /** + * @param string|null $moduleOption + * @return void + * @throws Exception + */ + private function initModule(?string $moduleOption): void + { + if (!in_array($moduleOption, [null, '', '0'], true)) { + $this->importModules(); + $module = strtolower($moduleOption); + + if (in_array($module, $this->modules)) { + $this->module = $module; + } else { + throw new Exception('Module {' . $module . '} does not exist.'); + } + } + } + + /** + * @param string|null $typeOption + * @return void + * @throws Exception + */ + private function initType(?string $typeOption): void + { + if (!in_array($typeOption, [null, '', '0'], true)) { + $type = strtolower($typeOption); + + if (in_array($type, $this->types)) { + $this->type = $type; + } else { + throw new Exception('Cache type {' . $type . '} is invalid.'); + } + } + } + + /** + * @param string|null $moduleName + * @param string|null $type + * @return void + */ + private function clearResourceModuleAndType(?string $moduleName = null, ?string $type = null): void + { + $dir = $this->cacheDir; + + if ($type) { + $dir = $dir . DS . strtolower($type); + } + + if ($moduleName) { + if (!$type) { + $dir = $dir . DS . '*'; + } + + $dir = $dir . DS . strtolower($moduleName); + } + + $this->removeFilesFromDirectory($dir); + } + + /** + * @param string $dir + * @return void + */ + private function removeFilesFromDirectory(string $dir): void + { + $entries = $this->fs->glob($dir . DS . '*'); + + foreach ($entries as $entry) { + if ($this->fs->isDirectory($entry)) { + $this->removeFilesFromDirectory($entry); + + if ($this->fs->fileName($entry) !== config()->get('view_cache.cache_dir', 'cache') && + count($this->fs->glob($entry . DS . '*')) === 0 + ) { + $this->fs->removeDirectory($entry); + } + } else { + $this->fs->remove($entry); + } + } + } +} diff --git a/src/Console/Commands/RouteListCommand.php b/src/Console/Commands/RouteListCommand.php index f1f015f13..c432b4b83 100644 --- a/src/Console/Commands/RouteListCommand.php +++ b/src/Console/Commands/RouteListCommand.php @@ -62,7 +62,7 @@ public function exec() $module = $this->getOption('module'); if ($module) { - $routes = array_filter($routes, fn($route) => strtolower($route['module']) === strtolower($module)); + $routes = array_filter($routes, fn ($route) => strtolower($route['module']) === strtolower($module)); if ($routes === []) { $this->error('The module is not found'); @@ -117,4 +117,4 @@ private function composeTableRow(array $route, int $maxContentLength = 25): arra $middlewares, ]; } -} \ No newline at end of file +} diff --git a/src/Console/Commands/ServeCommand.php b/src/Console/Commands/ServeCommand.php index cd3ac950b..a9bdbbeff 100644 --- a/src/Console/Commands/ServeCommand.php +++ b/src/Console/Commands/ServeCommand.php @@ -23,21 +23,20 @@ */ class ServeCommand extends QtCommand { - /** * Platform Windows */ - const PLATFORM_WINDOWS = 'WINNT'; + public const PLATFORM_WINDOWS = 'WINNT'; /** * Platform Linux */ - const PLATFORM_LINUX = 'Linux'; + public const PLATFORM_LINUX = 'Linux'; /** * Platform Mac */ - const PLATFORM_MAC = 'Darwin'; + public const PLATFORM_MAC = 'Darwin'; /** * The console command name. @@ -172,4 +171,4 @@ protected function port() $port = $this->getOption('port') ?: $this->defaultPort; return $port + $this->portOffset; } -} \ No newline at end of file +} diff --git a/src/Console/Commands/VersionCommand.php b/src/Console/Commands/VersionCommand.php index c3975db76..17d7863f9 100644 --- a/src/Console/Commands/VersionCommand.php +++ b/src/Console/Commands/VersionCommand.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Console\Commands; @@ -29,7 +29,6 @@ */ class VersionCommand extends QtCommand { - /** * Command name * @var string diff --git a/src/Console/Contracts/CommandInterface.php b/src/Console/Contracts/CommandInterface.php index eb47153cf..7f8934eab 100644 --- a/src/Console/Contracts/CommandInterface.php +++ b/src/Console/Contracts/CommandInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.6.0 + * @since 3.0.0 */ namespace Quantum\Console\Contracts; @@ -25,4 +25,4 @@ interface CommandInterface */ public function exec(); -} \ No newline at end of file +} diff --git a/src/Console/QtCommand.php b/src/Console/QtCommand.php index 4ae697a68..754fd75c3 100644 --- a/src/Console/QtCommand.php +++ b/src/Console/QtCommand.php @@ -28,7 +28,6 @@ */ abstract class QtCommand extends Command implements CommandInterface { - /** * Console command name * @var string @@ -228,4 +227,4 @@ private function setOptions() } } } -} \ No newline at end of file +} diff --git a/src/Contracts/StorageInterface.php b/src/Contracts/StorageInterface.php index 2b98bb445..435827298 100644 --- a/src/Contracts/StorageInterface.php +++ b/src/Contracts/StorageInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.8.0 + * @since 3.0.0 */ namespace Quantum\Contracts; @@ -20,7 +20,6 @@ */ interface StorageInterface { - /** * Gets whole storage data */ diff --git a/src/Debugger/Debugger.php b/src/Debugger/Debugger.php index fbe344b9e..10ba8f68e 100644 --- a/src/Debugger/Debugger.php +++ b/src/Debugger/Debugger.php @@ -30,31 +30,30 @@ */ class Debugger { - /** * Messages tab */ - const MESSAGES = 'messages'; + public const MESSAGES = 'messages'; /** * Queries tab */ - const QUERIES = 'queries'; + public const QUERIES = 'queries'; /** * Routes tab */ - const ROUTES = 'routes'; + public const ROUTES = 'routes'; /** * Hooks tab */ - const HOOKS = 'hooks'; + public const HOOKS = 'hooks'; /** * Mails tab */ - const MAILS = 'mails'; + public const MAILS = 'mails'; /** * Store @@ -141,7 +140,7 @@ public function initStore() Debugger::QUERIES, Debugger::ROUTES, Debugger::HOOKS, - Debugger::MAILS + Debugger::MAILS, ]); } diff --git a/src/Debugger/DebuggerStore.php b/src/Debugger/DebuggerStore.php index 650a73841..ce8e24656 100644 --- a/src/Debugger/DebuggerStore.php +++ b/src/Debugger/DebuggerStore.php @@ -1,4 +1,5 @@ * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Debugger; diff --git a/src/Di/Di.php b/src/Di/Di.php index cf89c1ac6..8e9a4a818 100644 --- a/src/Di/Di.php +++ b/src/Di/Di.php @@ -28,7 +28,6 @@ */ class Di { - /** * @var array */ @@ -137,7 +136,7 @@ public static function autowire(callable $entry, array $args = []): array { if ($entry instanceof Closure) { $reflection = new ReflectionFunction($entry); - } elseif(is_array($entry)) { + } elseif (is_array($entry)) { [$target, $method] = $entry; $reflection = new ReflectionMethod($target, $method); } else { diff --git a/src/Di/Enums/ExceptionMessages.php b/src/Di/Enums/ExceptionMessages.php index fe8ad2e95..6fcd882c6 100644 --- a/src/Di/Enums/ExceptionMessages.php +++ b/src/Di/Enums/ExceptionMessages.php @@ -22,16 +22,15 @@ */ final class ExceptionMessages extends BaseExceptionMessages { + public const DEPENDENCY_NOT_REGISTERED = 'The dependency `{%1}` is not registered.'; - const DEPENDENCY_NOT_REGISTERED = 'The dependency `{%1}` is not registered.'; + public const DEPENDENCY_ALREADY_REGISTERED = 'The dependency `{%1}` is already registered.'; - const DEPENDENCY_ALREADY_REGISTERED = 'The dependency `{%1}` is already registered.'; + public const DEPENDENCY_NOT_INSTANTIABLE = 'The dependency `{%1}` is not instantiable.'; - const DEPENDENCY_NOT_INSTANTIABLE = 'The dependency `{%1}` is not instantiable.'; + public const INVALID_ABSTRACT_DEPENDENCY = 'The dependency `{%1}` is not valid abstract class.'; - const INVALID_ABSTRACT_DEPENDENCY = 'The dependency `{%1}` is not valid abstract class.'; + public const CIRCULAR_DEPENDENCY = 'Circular dependency detected: `{%1}`'; - const CIRCULAR_DEPENDENCY = 'Circular dependency detected: `{%1}`'; - - const INVALID_CALLABLE = 'Invalid callable provided: expected Closure or array-style callable `{%1}`'; -} \ No newline at end of file + public const INVALID_CALLABLE = 'Invalid callable provided: expected Closure or array-style callable `{%1}`'; +} diff --git a/src/Di/Exceptions/DiException.php b/src/Di/Exceptions/DiException.php index 22bc74b78..4056e7886 100644 --- a/src/Di/Exceptions/DiException.php +++ b/src/Di/Exceptions/DiException.php @@ -31,7 +31,10 @@ class DiException extends BaseException */ public static function dependencyNotRegistered(string $name): DiException { - return new self(_message(ExceptionMessages::DEPENDENCY_NOT_REGISTERED, [$name]), E_ERROR); + return new self( + _message(ExceptionMessages::DEPENDENCY_NOT_REGISTERED, [$name]), + E_ERROR + ); } /** @@ -40,7 +43,10 @@ public static function dependencyNotRegistered(string $name): DiException */ public static function dependencyAlreadyRegistered(string $name): DiException { - return new self(_message(ExceptionMessages::DEPENDENCY_ALREADY_REGISTERED, $name), E_ERROR); + return new self( + _message(ExceptionMessages::DEPENDENCY_ALREADY_REGISTERED, $name), + E_ERROR + ); } /** @@ -49,7 +55,10 @@ public static function dependencyAlreadyRegistered(string $name): DiException */ public static function dependencyNotInstantiable(string $name): DiException { - return new self(_message(ExceptionMessages::DEPENDENCY_NOT_INSTANTIABLE, $name), E_ERROR); + return new self( + _message(ExceptionMessages::DEPENDENCY_NOT_INSTANTIABLE, $name), + E_ERROR + ); } /** @@ -58,7 +67,10 @@ public static function dependencyNotInstantiable(string $name): DiException */ public static function invalidAbstractDependency(string $name): DiException { - return new self(_message(ExceptionMessages::INVALID_ABSTRACT_DEPENDENCY, $name), E_ERROR); + return new self( + _message(ExceptionMessages::INVALID_ABSTRACT_DEPENDENCY, $name), + E_ERROR + ); } /** @@ -67,7 +79,10 @@ public static function invalidAbstractDependency(string $name): DiException */ public static function circularDependency(string $chain): DiException { - return new self(_message(ExceptionMessages::CIRCULAR_DEPENDENCY, [$chain]), 0); + return new self( + _message(ExceptionMessages::CIRCULAR_DEPENDENCY, [$chain]), + E_ERROR + ); } /** @@ -76,6 +91,9 @@ public static function circularDependency(string $chain): DiException */ public static function invalidCallable(?string $entry = null): DiException { - return new self(_message(ExceptionMessages::INVALID_CALLABLE, [$entry]), E_ERROR); + return new self( + _message(ExceptionMessages::INVALID_CALLABLE, [$entry]), + E_ERROR + ); } } diff --git a/src/Environment/Enums/Env.php b/src/Environment/Enums/Env.php index 913415405..749794e0e 100644 --- a/src/Environment/Enums/Env.php +++ b/src/Environment/Enums/Env.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Environment\Enums; @@ -44,4 +44,4 @@ final class Env * Local environment - developer's local machine environment. */ public const LOCAL = 'local'; -} \ No newline at end of file +} diff --git a/src/Environment/Enums/ExceptionMessages.php b/src/Environment/Enums/ExceptionMessages.php index 43d2b45e9..ac277b0c2 100644 --- a/src/Environment/Enums/ExceptionMessages.php +++ b/src/Environment/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Environment\Enums; @@ -22,7 +22,7 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const IMMUTABLE_ENVIRONMENT = 'The environment is immutable. Modifications are not allowed.'; + public const IMMUTABLE_ENVIRONMENT = 'The environment is immutable. Modifications are not allowed.'; - const ENVIRONMENT_NOT_LOADED = 'Environment not loaded. Call `load()` method first.'; -} \ No newline at end of file + public const ENVIRONMENT_NOT_LOADED = 'Environment not loaded. Call `load()` method first.'; +} diff --git a/src/Environment/Environment.php b/src/Environment/Environment.php index 30e99b1b3..57a24e75d 100644 --- a/src/Environment/Environment.php +++ b/src/Environment/Environment.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Environment; @@ -32,7 +32,6 @@ */ class Environment { - /** * Environment file * @var string @@ -100,7 +99,7 @@ public function load(Setup $setup) $appEnv = $envConfig['app_env'] ?? Env::PRODUCTION; - $this->envFile = ".env" . ($appEnv !== Env::PRODUCTION ? ".$appEnv" : ''); + $this->envFile = '.env' . ($appEnv !== Env::PRODUCTION ? ".$appEnv" : ''); if (!file_exists(App::getBaseDir() . DS . $this->envFile)) { throw EnvException::fileNotFound($this->envFile); @@ -188,10 +187,10 @@ public function updateRow(string $key, ?string $value) if ($row) { $envFileContent = file_get_contents($envFilePath); - $envFileContent = preg_replace('/^' . preg_quote($row, '/') . '/m', $key . "=" . $value, $envFileContent); + $envFileContent = preg_replace('/^' . preg_quote($row, '/') . '/m', $key . '=' . $value, $envFileContent); file_put_contents($envFilePath, $envFileContent); } else { - file_put_contents($envFilePath, PHP_EOL . $key . "=" . $value . PHP_EOL, FILE_APPEND); + file_put_contents($envFilePath, PHP_EOL . $key . '=' . $value . PHP_EOL, FILE_APPEND); } $this->envContent = Dotenv::createMutable(App::getBaseDir(), $this->envFile)->load(); @@ -212,4 +211,4 @@ private function findKeyRow(string $key): ?string return null; } -} \ No newline at end of file +} diff --git a/src/Environment/Exceptions/EnvException.php b/src/Environment/Exceptions/EnvException.php index 3eb882bfa..f8be14b51 100644 --- a/src/Environment/Exceptions/EnvException.php +++ b/src/Environment/Exceptions/EnvException.php @@ -25,7 +25,6 @@ */ class EnvException extends BaseException { - /** * @return EnvException */ diff --git a/src/Environment/Helpers/env.php b/src/Environment/Helpers/env.php index 5ff0f2efd..5be3a12e4 100644 --- a/src/Environment/Helpers/env.php +++ b/src/Environment/Helpers/env.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\Environment\Exceptions\EnvException; @@ -25,4 +25,4 @@ function env(string $var, $default = null) { return Environment::getInstance()->getValue($var, $default); -} \ No newline at end of file +} diff --git a/src/Environment/Helpers/server.php b/src/Environment/Helpers/server.php index d907e1447..7750542bd 100644 --- a/src/Environment/Helpers/server.php +++ b/src/Environment/Helpers/server.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ use Quantum\Environment\Server; @@ -44,4 +44,4 @@ function getallheaders(): array { return Server::getInstance()->getAllHeaders(); } -} \ No newline at end of file +} diff --git a/src/Environment/Server.php b/src/Environment/Server.php index b7bfa56d7..d08e9051e 100644 --- a/src/Environment/Server.php +++ b/src/Environment/Server.php @@ -20,13 +20,11 @@ */ class Server { - /** * @var array */ private $server; - private static $instance = null; /** @@ -188,7 +186,7 @@ public function ip(): ?string /** * @return array */ - function getAllHeaders(): array + public function getAllHeaders(): array { $data = $this->all(); @@ -220,4 +218,4 @@ public function acceptedLang(): ?string return strtolower(substr(trim($first), 0, 2)); } -} \ No newline at end of file +} diff --git a/src/Hook/Enums/ExceptionMessages.php b/src/Hook/Enums/ExceptionMessages.php index 72c6ee17a..95fa922fa 100644 --- a/src/Hook/Enums/ExceptionMessages.php +++ b/src/Hook/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Hook\Enums; @@ -22,7 +22,7 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const DUPLICATE_HOOK_NAME = 'The Hook `{%1}` already registered.'; + public const DUPLICATE_HOOK_NAME = 'The Hook `{%1}` already registered.'; - const UNREGISTERED_HOOK_NAME = 'The Hook `{%1}` was not registered.'; -} \ No newline at end of file + public const UNREGISTERED_HOOK_NAME = 'The Hook `{%1}` was not registered.'; +} diff --git a/src/Hook/Exceptions/HookException.php b/src/Hook/Exceptions/HookException.php index ccbe7df54..a8ab404a2 100644 --- a/src/Hook/Exceptions/HookException.php +++ b/src/Hook/Exceptions/HookException.php @@ -48,4 +48,4 @@ public static function unregisteredHookName(string $name): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Hook/Helpers/hook.php b/src/Hook/Helpers/hook.php index d4abd2ae5..688adfd1c 100644 --- a/src/Hook/Helpers/hook.php +++ b/src/Hook/Helpers/hook.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\Hook\HookManager; @@ -21,4 +21,4 @@ function hook(): HookManager { return HookManager::getInstance(); -} \ No newline at end of file +} diff --git a/src/Hook/HookManager.php b/src/Hook/HookManager.php index a75cef874..470f79b08 100644 --- a/src/Hook/HookManager.php +++ b/src/Hook/HookManager.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Hook; @@ -26,11 +26,10 @@ */ class HookManager { - /** - * Core hooks + * Core hooks */ - const CORE_HOOKS = []; + public const CORE_HOOKS = []; /** * Registered hooks store @@ -118,7 +117,7 @@ public static function getRegistered(): array } /** - * Registers new hook + * Registers new hook * @param string $name * @throws HookException */ diff --git a/src/Http/Enums/ContentType.php b/src/Http/Enums/ContentType.php index eb34c898d..20992b492 100644 --- a/src/Http/Enums/ContentType.php +++ b/src/Http/Enums/ContentType.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Http\Enums; @@ -20,7 +20,6 @@ */ final class ContentType { - /** * HTML content type */ @@ -55,4 +54,4 @@ final class ContentType * Default content type for binary streams */ public const OCTET_STREAM = 'application/octet-stream'; -} \ No newline at end of file +} diff --git a/src/Http/Enums/StatusCode.php b/src/Http/Enums/StatusCode.php index a539ee8c7..7ed31d39f 100644 --- a/src/Http/Enums/StatusCode.php +++ b/src/Http/Enums/StatusCode.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Http\Enums; @@ -86,4 +86,4 @@ final class StatusCode public const LOOP_DETECTED = 508; public const NOT_EXTENDED = 510; public const NETWORK_AUTHENTICATION_REQUIRED = 511; -} \ No newline at end of file +} diff --git a/src/Http/Exceptions/HttpException.php b/src/Http/Exceptions/HttpException.php index 5ca4a19d6..284e41a36 100644 --- a/src/Http/Exceptions/HttpException.php +++ b/src/Http/Exceptions/HttpException.php @@ -11,7 +11,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Http\Exceptions; @@ -24,5 +24,4 @@ */ class HttpException extends BaseException { - } diff --git a/src/Http/Helpers/http.php b/src/Http/Helpers/http.php index 9ca108c48..510c674d7 100644 --- a/src/Http/Helpers/http.php +++ b/src/Http/Helpers/http.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ use Quantum\Config\Exceptions\ConfigException; @@ -132,4 +132,4 @@ function page_not_found() StatusCode::NOT_FOUND ); } -} \ No newline at end of file +} diff --git a/src/Http/Request.php b/src/Http/Request.php index d1c9a410a..0ec72cb30 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Http; @@ -59,7 +59,6 @@ */ class Request { - /** * @param string $function The function name * @param array $arguments @@ -79,4 +78,4 @@ public static function __callStatic(string $function, array $arguments) { return HttpRequest::$function(...$arguments); } -} \ No newline at end of file +} diff --git a/src/Http/Request/HttpRequest.php b/src/Http/Request/HttpRequest.php index d72ee920a..3e794e29e 100644 --- a/src/Http/Request/HttpRequest.php +++ b/src/Http/Request/HttpRequest.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Http\Request; @@ -36,7 +36,6 @@ */ abstract class HttpRequest { - use Header; use Body; use Url; @@ -49,17 +48,17 @@ abstract class HttpRequest /** * Available methods */ - const METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']; + public const METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']; /** * Default port for HTTP */ - const DEFAULT_HTTP_PORT = 80; + public const DEFAULT_HTTP_PORT = 80; /** * Default port for HTTPS */ - const DEFAULT_HTTPS_PORT = 443; + public const DEFAULT_HTTPS_PORT = 443; /** * Request method @@ -107,7 +106,6 @@ public static function init(Server $server) self::$initialized = true; } - /** * Flushes the request header , body and files */ @@ -279,4 +277,4 @@ private static function setRequestHeaders() { self::$__headers = array_change_key_case((array)getallheaders()); } -} \ No newline at end of file +} diff --git a/src/Http/Response.php b/src/Http/Response.php index 9c4350522..45aac302f 100644 --- a/src/Http/Response.php +++ b/src/Http/Response.php @@ -2,14 +2,14 @@ /** * Quantum PHP Framework - * + * * An open source software development framework for PHP - * + * * @package Quantum * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Http; @@ -46,7 +46,6 @@ */ class Response { - /** * @param string $function The function name * @param array $arguments @@ -66,4 +65,4 @@ public static function __callStatic(string $function, array $arguments) { return HttpResponse::$function(...$arguments); } -} \ No newline at end of file +} diff --git a/src/Http/Response/HttpResponse.php b/src/Http/Response/HttpResponse.php index 6482479ec..dbdd93eef 100644 --- a/src/Http/Response/HttpResponse.php +++ b/src/Http/Response/HttpResponse.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Http\Response; @@ -28,7 +28,6 @@ */ abstract class HttpResponse { - use Header; use Body; use Status; @@ -97,4 +96,4 @@ public static function send() echo self::getContent(); } -} \ No newline at end of file +} diff --git a/src/Http/Traits/Request/Body.php b/src/Http/Traits/Request/Body.php index ac82720d9..527a64290 100644 --- a/src/Http/Traits/Request/Body.php +++ b/src/Http/Traits/Request/Body.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Http\Traits\Request; @@ -23,7 +23,6 @@ */ trait Body { - /** * Request body * @var array @@ -49,7 +48,7 @@ public static function has(string $key): bool */ public static function get(string $key, ?string $default = null, bool $raw = false) { - if(!self::has($key)) { + if (!self::has($key)) { return $default; } @@ -97,4 +96,4 @@ public static function delete(string $key) unset(self::$__request[$key]); } } -} \ No newline at end of file +} diff --git a/src/Http/Traits/Request/File.php b/src/Http/Traits/Request/File.php index 4ecb02193..05e841f14 100644 --- a/src/Http/Traits/Request/File.php +++ b/src/Http/Traits/Request/File.php @@ -25,7 +25,6 @@ */ trait File { - /** * Files * @var array @@ -111,4 +110,4 @@ public static function handleFiles(array $files): array return $formatted; } } -} \ No newline at end of file +} diff --git a/src/Http/Traits/Request/Header.php b/src/Http/Traits/Request/Header.php index 73724a244..b3222c24e 100644 --- a/src/Http/Traits/Request/Header.php +++ b/src/Http/Traits/Request/Header.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Http\Traits\Request; @@ -20,7 +20,6 @@ */ trait Header { - /** * Request headers * @var array @@ -101,7 +100,6 @@ public static function getAuthorizationBearer(): ?string return $bearerToken; } - /** * Gets Basic Auth Credentials * @return array|null @@ -162,4 +160,4 @@ private static function normalizeHeaderKey(string $key): array return [$keyWithHyphens, $keyWithUnderscores]; } -} \ No newline at end of file +} diff --git a/src/Http/Traits/Request/Internal.php b/src/Http/Traits/Request/Internal.php index 617fec6a3..83dc2e4ab 100644 --- a/src/Http/Traits/Request/Internal.php +++ b/src/Http/Traits/Request/Internal.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Http\Traits\Request; @@ -27,7 +27,6 @@ */ trait Internal { - /** * Creates an internal request for testing purposes * @param string $method @@ -46,8 +45,7 @@ public static function create( array $params = [], array $headers = [], array $files = [] - ) - { + ) { $parsed = parse_url($url); $server = Server::getInstance(); @@ -120,4 +118,4 @@ protected static function detectAndSetContentType($server, ?array $data = null, $server->set('CONTENT_TYPE', ContentType::HTML); } } -} \ No newline at end of file +} diff --git a/src/Http/Traits/Request/Params.php b/src/Http/Traits/Request/Params.php index 932cbc403..356c195f0 100644 --- a/src/Http/Traits/Request/Params.php +++ b/src/Http/Traits/Request/Params.php @@ -9,12 +9,11 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Http\Traits\Request; - use Quantum\Config\Exceptions\ConfigException; use Quantum\App\Exceptions\BaseException; use Quantum\Di\Exceptions\DiException; @@ -27,7 +26,6 @@ */ trait Params { - /** * Request content type * @var string|null @@ -122,4 +120,4 @@ private static function getRawInput(): string { return file_get_contents('php://input'); } -} \ No newline at end of file +} diff --git a/src/Http/Traits/Request/Query.php b/src/Http/Traits/Request/Query.php index 17245fc7a..32627a3dd 100644 --- a/src/Http/Traits/Request/Query.php +++ b/src/Http/Traits/Request/Query.php @@ -20,7 +20,6 @@ */ trait Query { - /** * Query string * @var string|null @@ -55,7 +54,7 @@ public static function getQueryParam(string $key): ?string if (self::$__query === null) { return null; } - + $query = explode('&', self::$__query); foreach ($query as $items) { @@ -79,4 +78,4 @@ public static function setQueryParam(string $key, string $value) $queryParams[] = $key . '=' . $value; self::$__query = implode('&', $queryParams); } -} \ No newline at end of file +} diff --git a/src/Http/Traits/Request/RawInput.php b/src/Http/Traits/Request/RawInput.php index 5a79b4a8e..90c61a29d 100644 --- a/src/Http/Traits/Request/RawInput.php +++ b/src/Http/Traits/Request/RawInput.php @@ -29,7 +29,6 @@ */ trait RawInput { - /** * Parses raw input data and returns parsed parameters and files * @param string $rawInput @@ -245,7 +244,7 @@ private static function parseFileData(string $block): array $name, $filename, $contentType, - $content + $content, ]; } @@ -317,4 +316,4 @@ private static function arrayParam(string $parameter) return $parameter; } -} \ No newline at end of file +} diff --git a/src/Http/Traits/Request/Url.php b/src/Http/Traits/Request/Url.php index 6090c7a4a..b2b9c0317 100644 --- a/src/Http/Traits/Request/Url.php +++ b/src/Http/Traits/Request/Url.php @@ -20,7 +20,6 @@ */ trait Url { - /** * Scheme * @var string|null @@ -117,7 +116,6 @@ public static function setUri(string $uri) self::$__uri = ltrim($uri, '/'); } - /** * Returns the URI segment at the specified index. * @param int $index @@ -139,9 +137,9 @@ public static function getAllSegments(): array if (self::$__uri === null) { return ['zero_segment']; } - + $segments = explode('/', trim(parse_url(self::$__uri)['path'], '/')); array_unshift($segments, 'zero_segment'); return $segments; } -} \ No newline at end of file +} diff --git a/src/Http/Traits/Response/Body.php b/src/Http/Traits/Response/Body.php index c45ffc8fd..3fde453d9 100644 --- a/src/Http/Traits/Response/Body.php +++ b/src/Http/Traits/Response/Body.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Http\Traits\Response; @@ -27,7 +27,6 @@ */ trait Body { - /** * Response * @var array @@ -141,7 +140,7 @@ public static function jsonp(string $callback, ?array $data = null, ?int $code = */ public static function getJsonPData(array $data): string { - return self::$callbackFunction . '(' . json_encode($data) . ")"; + return self::$callbackFunction . '(' . json_encode($data) . ')'; } /** @@ -292,4 +291,4 @@ private static function formatJsonp(): string { return self::getJsonPData(self::all()); } -} \ No newline at end of file +} diff --git a/src/Http/Traits/Response/Header.php b/src/Http/Traits/Response/Header.php index b3890e38b..30a70f3a0 100644 --- a/src/Http/Traits/Response/Header.php +++ b/src/Http/Traits/Response/Header.php @@ -23,7 +23,6 @@ */ trait Header { - /** * Response headers * @var array @@ -110,4 +109,4 @@ public static function redirect(string $url, int $code = 302) self::setHeader('Location', $url); stop(); } -} \ No newline at end of file +} diff --git a/src/Http/Traits/Response/Status.php b/src/Http/Traits/Response/Status.php index 349b43af2..81abdf25b 100644 --- a/src/Http/Traits/Response/Status.php +++ b/src/Http/Traits/Response/Status.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Http\Traits\Response; @@ -23,7 +23,6 @@ */ trait Status { - /** * Status code * @var int @@ -147,4 +146,4 @@ public static function getStatusText(): string { return self::getText(self::$__statusCode); } -} \ No newline at end of file +} diff --git a/src/Libraries/Archive/Adapters/PharAdapter.php b/src/Libraries/Archive/Adapters/PharAdapter.php index 0e66db2bb..3a80fbed9 100644 --- a/src/Libraries/Archive/Adapters/PharAdapter.php +++ b/src/Libraries/Archive/Adapters/PharAdapter.php @@ -28,7 +28,6 @@ */ class PharAdapter implements ArchiveInterface { - /** * @var FileSystem */ @@ -251,4 +250,4 @@ private function openArchive(): void $this->requiresReopen = false; } -} \ No newline at end of file +} diff --git a/src/Libraries/Archive/Adapters/ZipAdapter.php b/src/Libraries/Archive/Adapters/ZipAdapter.php index 68ee98e4a..2e8964266 100644 --- a/src/Libraries/Archive/Adapters/ZipAdapter.php +++ b/src/Libraries/Archive/Adapters/ZipAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Archive\Adapters; @@ -28,7 +28,6 @@ */ class ZipAdapter implements ArchiveInterface { - /** * @var FileSystem */ @@ -49,7 +48,6 @@ class ZipAdapter implements ArchiveInterface */ private $requiresReopen = true; - /** * @throws BaseException */ @@ -237,4 +235,4 @@ private function openArchive() $this->requiresReopen = false; } -} \ No newline at end of file +} diff --git a/src/Libraries/Archive/Archive.php b/src/Libraries/Archive/Archive.php index 0e1d1ab45..c19f6dec0 100644 --- a/src/Libraries/Archive/Archive.php +++ b/src/Libraries/Archive/Archive.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Archive; @@ -34,16 +34,15 @@ */ class Archive { - /** * Phar */ - const PHAR = 'phar'; + public const PHAR = 'phar'; /** * Zip */ - const ZIP = 'zip'; + public const ZIP = 'zip'; /** * @var ArchiveInterface @@ -80,4 +79,4 @@ public function __call(string $method, ?array $arguments) return $this->adapter->$method(...$arguments); } -} \ No newline at end of file +} diff --git a/src/Libraries/Archive/Contracts/ArchiveInterface.php b/src/Libraries/Archive/Contracts/ArchiveInterface.php index 3d9abe1e0..a9907a3c9 100644 --- a/src/Libraries/Archive/Contracts/ArchiveInterface.php +++ b/src/Libraries/Archive/Contracts/ArchiveInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Archive\Contracts; @@ -84,4 +84,4 @@ public function deleteFile(string $filename): bool; * @return bool */ public function deleteMultipleFiles(array $fileNames): bool; -} \ No newline at end of file +} diff --git a/src/Libraries/Archive/Enums/ExceptionMessages.php b/src/Libraries/Archive/Enums/ExceptionMessages.php index 74ffd52bb..293e682b5 100644 --- a/src/Libraries/Archive/Enums/ExceptionMessages.php +++ b/src/Libraries/Archive/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Archive\Enums; @@ -22,7 +22,7 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const CANT_OPEN = 'The archive `{%1}` can not be opened'; + public const CANT_OPEN = 'The archive `{%1}` can not be opened'; - const NAME_NOT_SET = 'Archive name is not set'; -} \ No newline at end of file + public const NAME_NOT_SET = 'Archive name is not set'; +} diff --git a/src/Libraries/Archive/Exceptions/ArchiveException.php b/src/Libraries/Archive/Exceptions/ArchiveException.php index b2edc4f0a..647918871 100644 --- a/src/Libraries/Archive/Exceptions/ArchiveException.php +++ b/src/Libraries/Archive/Exceptions/ArchiveException.php @@ -47,4 +47,4 @@ public static function missingArchiveName(): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Archive/Factories/ArchiveFactory.php b/src/Libraries/Archive/Factories/ArchiveFactory.php index 17facf281..f396243ad 100644 --- a/src/Libraries/Archive/Factories/ArchiveFactory.php +++ b/src/Libraries/Archive/Factories/ArchiveFactory.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Archive\Factories; @@ -26,11 +26,10 @@ */ class ArchiveFactory { - /** * Supported adapters */ - const ADAPTERS = [ + public const ADAPTERS = [ Archive::PHAR => PharAdapter::class, Archive::ZIP => ZipAdapter::class, ]; @@ -67,6 +66,6 @@ private static function createInstance(string $type): Archive $adapterClass = self::ADAPTERS[$type]; - return new Archive(new $adapterClass); + return new Archive(new $adapterClass()); } -} \ No newline at end of file +} diff --git a/src/Libraries/Asset/Asset.php b/src/Libraries/Asset/Asset.php index 8a17e04bf..37cdd9aac 100644 --- a/src/Libraries/Asset/Asset.php +++ b/src/Libraries/Asset/Asset.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.0 + * @since 3.0.0 * */ @@ -21,16 +21,15 @@ */ class Asset { - /** * Type CSS */ - const CSS = 1; + public const CSS = 1; /** * Type JS */ - const JS = 2; + public const JS = 2; /** * @var int @@ -148,8 +147,8 @@ public function url(): string public function tag(): string { return _message( - $this->templates[$this->type], - [$this->url(), implode(' ', $this->attributes)] - ) . PHP_EOL; + $this->templates[$this->type], + [$this->url(), implode(' ', $this->attributes)] + ) . PHP_EOL; } -} \ No newline at end of file +} diff --git a/src/Libraries/Asset/AssetManager.php b/src/Libraries/Asset/AssetManager.php index ffb3b4846..685c91f9a 100644 --- a/src/Libraries/Asset/AssetManager.php +++ b/src/Libraries/Asset/AssetManager.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Asset; @@ -23,11 +23,10 @@ */ class AssetManager { - /** * Assets store types */ - const STORES = [ + public const STORES = [ 'css' => Asset::CSS, 'js' => Asset::JS, ]; @@ -216,4 +215,4 @@ private function setPosition(Asset $asset, int $index) $this->published[$type][$index] = $asset; } } -} \ No newline at end of file +} diff --git a/src/Libraries/Asset/Enums/ExceptionMessages.php b/src/Libraries/Asset/Enums/ExceptionMessages.php index 3fabe56f5..ed4cb01f7 100644 --- a/src/Libraries/Asset/Enums/ExceptionMessages.php +++ b/src/Libraries/Asset/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Asset\Enums; @@ -22,7 +22,7 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const POSITION_IN_USE = 'Position `{%1}` for asset `{%2}` is in use'; + public const POSITION_IN_USE = 'Position `{%1}` for asset `{%2}` is in use'; - const NAME_IN_USE = 'The name {%1} is in use'; -} \ No newline at end of file + public const NAME_IN_USE = 'The name {%1} is in use'; +} diff --git a/src/Libraries/Asset/Exceptions/AssetException.php b/src/Libraries/Asset/Exceptions/AssetException.php index 4a32bfcb7..1f5d47ca3 100644 --- a/src/Libraries/Asset/Exceptions/AssetException.php +++ b/src/Libraries/Asset/Exceptions/AssetException.php @@ -31,7 +31,10 @@ class AssetException extends \Exception */ public static function positionInUse(int $position, string $name): AssetException { - return new self(_message(ExceptionMessages::POSITION_IN_USE, [$position, $name]), E_WARNING); + return new self( + _message(ExceptionMessages::POSITION_IN_USE, [$position, $name]), + E_WARNING + ); } /** @@ -40,6 +43,9 @@ public static function positionInUse(int $position, string $name): AssetExceptio */ public static function nameInUse(?string $name): AssetException { - return new self(_message(ExceptionMessages::NAME_IN_USE, [$name]), E_WARNING); + return new self( + _message(ExceptionMessages::NAME_IN_USE, [$name]), + E_WARNING + ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Asset/Helpers/asset.php b/src/Libraries/Asset/Helpers/asset.php index 095187253..4484e702b 100644 --- a/src/Libraries/Asset/Helpers/asset.php +++ b/src/Libraries/Asset/Helpers/asset.php @@ -35,4 +35,4 @@ function asset(): AssetManager function assets(string $type): void { AssetManager::getInstance()->dump(AssetManager::STORES[$type]); -} \ No newline at end of file +} diff --git a/src/Libraries/Auth/Adapters/JwtAuthAdapter.php b/src/Libraries/Auth/Adapters/JwtAuthAdapter.php index ba6303d19..bca67e65a 100644 --- a/src/Libraries/Auth/Adapters/JwtAuthAdapter.php +++ b/src/Libraries/Auth/Adapters/JwtAuthAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Auth\Adapters; @@ -34,7 +34,6 @@ */ class JwtAuthAdapter implements AuthenticatableInterface { - use AuthTrait; /** @@ -120,7 +119,7 @@ public function refreshUser(string $uuid): bool { $user = $this->authService->get('uuid', $uuid); - if(!$user) { + if (!$user) { return false; } @@ -153,7 +152,7 @@ protected function getUpdatedTokens(User $user): array { return [ $this->keyFields[AuthKeys::REFRESH_TOKEN] => $this->generateToken(), - $this->keyFields[AuthKeys::ACCESS_TOKEN] => base64_encode($this->jwt->setData($this->getVisibleFields($user))->compose()) + $this->keyFields[AuthKeys::ACCESS_TOKEN] => base64_encode($this->jwt->setData($this->getVisibleFields($user))->compose()), ]; } @@ -229,4 +228,4 @@ private function getUserFromRefreshToken(): ?User return null; } -} \ No newline at end of file +} diff --git a/src/Libraries/Auth/Adapters/SessionAuthAdapter.php b/src/Libraries/Auth/Adapters/SessionAuthAdapter.php index 6bf2638ce..fbde6e208 100644 --- a/src/Libraries/Auth/Adapters/SessionAuthAdapter.php +++ b/src/Libraries/Auth/Adapters/SessionAuthAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Auth\Adapters; @@ -36,7 +36,6 @@ */ class SessionAuthAdapter implements AuthenticatableInterface { - use AuthTrait; /** @@ -233,4 +232,4 @@ private function removeRememberToken() cookie()->delete($this->keyFields[AuthKeys::REMEMBER_TOKEN]); } } -} \ No newline at end of file +} diff --git a/src/Libraries/Auth/Auth.php b/src/Libraries/Auth/Auth.php index 2d92afc99..44ae2dca7 100644 --- a/src/Libraries/Auth/Auth.php +++ b/src/Libraries/Auth/Auth.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Auth; @@ -28,16 +28,15 @@ */ class Auth { - /** * Web */ - const SESSION = 'session'; + public const SESSION = 'session'; /** * Api */ - const JWT = 'jwt'; + public const JWT = 'jwt'; /** * @var AuthenticatableInterface @@ -75,4 +74,4 @@ public function __call(string $method, ?array $arguments) return $this->adapter->$method(...$arguments); } -} \ No newline at end of file +} diff --git a/src/Libraries/Auth/Contracts/AuthServiceInterface.php b/src/Libraries/Auth/Contracts/AuthServiceInterface.php index 317ae34cd..139d5380e 100644 --- a/src/Libraries/Auth/Contracts/AuthServiceInterface.php +++ b/src/Libraries/Auth/Contracts/AuthServiceInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Auth\Contracts; @@ -22,7 +22,6 @@ */ interface AuthServiceInterface { - /** * Get * @param string $field @@ -31,11 +30,11 @@ interface AuthServiceInterface */ public function get(string $field, ?string $value): ?User; - /** - * Add - * @param array $data - * @return User - */ + /** + * Add + * @param array $data + * @return User + */ public function add(array $data): User; /** @@ -52,4 +51,4 @@ public function update(string $field, ?string $value, array $data): ?User; * @return array */ public function userSchema(): array; -} \ No newline at end of file +} diff --git a/src/Libraries/Auth/Contracts/AuthenticatableInterface.php b/src/Libraries/Auth/Contracts/AuthenticatableInterface.php index 538099d91..aa93ed739 100644 --- a/src/Libraries/Auth/Contracts/AuthenticatableInterface.php +++ b/src/Libraries/Auth/Contracts/AuthenticatableInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Auth\Contracts; @@ -22,11 +22,10 @@ */ interface AuthenticatableInterface { - /** * Auth user key */ - const AUTH_USER = 'auth_user'; + public const AUTH_USER = 'auth_user'; /** * Sign In @@ -53,4 +52,4 @@ public function check(): bool; * @return User|null */ public function user(): ?User; -} \ No newline at end of file +} diff --git a/src/Libraries/Auth/Enums/AuthKeys.php b/src/Libraries/Auth/Enums/AuthKeys.php index c4df5a2ed..e4c160a4d 100644 --- a/src/Libraries/Auth/Enums/AuthKeys.php +++ b/src/Libraries/Auth/Enums/AuthKeys.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Auth\Enums; @@ -23,50 +23,50 @@ class AuthKeys /** * One time password key */ - const OTP = 'otp'; + public const OTP = 'otp'; /** * One time password expiry key */ - const OTP_EXPIRY = 'otpExpiry'; + public const OTP_EXPIRY = 'otpExpiry'; /** * One time password token key */ - const OTP_TOKEN = 'otpToken'; + public const OTP_TOKEN = 'otpToken'; /** * Username key */ - const USERNAME = 'username'; + public const USERNAME = 'username'; /** * Password key */ - const PASSWORD = 'password'; + public const PASSWORD = 'password'; /** * Access token key */ - const ACCESS_TOKEN = 'accessToken'; + public const ACCESS_TOKEN = 'accessToken'; /** * Refresh token key */ - const REFRESH_TOKEN = 'refreshToken'; + public const REFRESH_TOKEN = 'refreshToken'; /** * Activation token key */ - const ACTIVATION_TOKEN = 'activationToken'; + public const ACTIVATION_TOKEN = 'activationToken'; /** * Reset token key */ - const RESET_TOKEN = 'resetToken'; + public const RESET_TOKEN = 'resetToken'; /** * Remember token key */ - const REMEMBER_TOKEN = 'rememberToken'; -} \ No newline at end of file + public const REMEMBER_TOKEN = 'rememberToken'; +} diff --git a/src/Libraries/Auth/Enums/ExceptionMessages.php b/src/Libraries/Auth/Enums/ExceptionMessages.php index b4e4af7c5..752e2da08 100644 --- a/src/Libraries/Auth/Enums/ExceptionMessages.php +++ b/src/Libraries/Auth/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Auth\Enums; @@ -22,13 +22,13 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const INCORRECT_USER_SCHEMA = 'User schema does not contains all key fields.'; + public const INCORRECT_USER_SCHEMA = 'User schema does not contains all key fields.'; - const VERIFICATION_CODE_EXPIRED = 'Verification code expired.'; + public const VERIFICATION_CODE_EXPIRED = 'Verification code expired.'; - const INCORRECT_VERIFICATION_CODE = 'Incorrect verification code.'; + public const INCORRECT_VERIFICATION_CODE = 'Incorrect verification code.'; - const INACTIVE_ACCOUNT = 'The account is not activated.'; + public const INACTIVE_ACCOUNT = 'The account is not activated.'; - const INCORRECT_CREDENTIALS = 'Incorrect credentials.'; -} \ No newline at end of file + public const INCORRECT_CREDENTIALS = 'Incorrect credentials.'; +} diff --git a/src/Libraries/Auth/Exceptions/AuthException.php b/src/Libraries/Auth/Exceptions/AuthException.php index 32d26a46d..28c6099e8 100644 --- a/src/Libraries/Auth/Exceptions/AuthException.php +++ b/src/Libraries/Auth/Exceptions/AuthException.php @@ -79,4 +79,4 @@ public static function incorrectUserSchema(): self E_ERROR ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Auth/Factories/AuthFactory.php b/src/Libraries/Auth/Factories/AuthFactory.php index 64f8d20d6..dfe3ad30a 100644 --- a/src/Libraries/Auth/Factories/AuthFactory.php +++ b/src/Libraries/Auth/Factories/AuthFactory.php @@ -35,11 +35,10 @@ */ class AuthFactory { - /** * Supported adapters */ - const ADAPTERS = [ + public const ADAPTERS = [ Auth::SESSION => SessionAuthAdapter::class, Auth::JWT => JwtAuthAdapter::class, ]; @@ -140,4 +139,4 @@ private static function createJwtInstance(string $adapter): ?JwtToken { return $adapter === Auth::JWT ? (new JwtToken())->setLeeway(1)->setClaims((array)config()->get('auth.claims')) : null; } -} \ No newline at end of file +} diff --git a/src/Libraries/Auth/Helpers/auth.php b/src/Libraries/Auth/Helpers/auth.php index 3ca631a67..596080893 100644 --- a/src/Libraries/Auth/Helpers/auth.php +++ b/src/Libraries/Auth/Helpers/auth.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\Libraries\Auth\Exceptions\AuthException; @@ -34,4 +34,4 @@ function auth(?string $adapter = null): Auth { return AuthFactory::get($adapter); -} \ No newline at end of file +} diff --git a/src/Libraries/Auth/Traits/AuthTrait.php b/src/Libraries/Auth/Traits/AuthTrait.php index 2abcc3ca4..9d5cdc39d 100644 --- a/src/Libraries/Auth/Traits/AuthTrait.php +++ b/src/Libraries/Auth/Traits/AuthTrait.php @@ -37,7 +37,6 @@ */ trait AuthTrait { - /** * @var Mailer */ @@ -103,7 +102,7 @@ public function signup(array $userData, ?array $customData = null): User $body = [ 'user' => $user, - 'activationToken' => $activationToken + 'activationToken' => $activationToken, ]; if ($customData) { @@ -154,7 +153,7 @@ public function forget(string $username): ?string $body = [ 'user' => $user, - 'resetToken' => $resetToken + 'resetToken' => $resetToken, ]; $this->mailer->setSubject(t('common.reset_password')); @@ -184,7 +183,7 @@ public function reset(string $token, string $password) $token, [ $this->keyFields[AuthKeys::PASSWORD] => $this->hasher->hash($password), - $this->keyFields[AuthKeys::RESET_TOKEN] => '' + $this->keyFields[AuthKeys::RESET_TOKEN] => '', ] ); } @@ -263,7 +262,7 @@ protected function twoStepVerification(User $user): string $body = [ 'user' => $user, - 'code' => $otp + 'code' => $otp, ]; $this->mailer->setSubject(t('common.otp')); @@ -396,4 +395,4 @@ protected function isTwoFactorEnabled(): bool { return filter_var(config()->get('auth.two_fa'), FILTER_VALIDATE_BOOLEAN); } -} \ No newline at end of file +} diff --git a/src/Libraries/Auth/User.php b/src/Libraries/Auth/User.php index 6234bfa7c..895e5279a 100644 --- a/src/Libraries/Auth/User.php +++ b/src/Libraries/Auth/User.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Auth; @@ -20,7 +20,6 @@ */ class User { - /** * @var array */ diff --git a/src/Libraries/Cache/Adapters/DatabaseAdapter.php b/src/Libraries/Cache/Adapters/DatabaseAdapter.php index 4ce043f6b..dab6eab84 100644 --- a/src/Libraries/Cache/Adapters/DatabaseAdapter.php +++ b/src/Libraries/Cache/Adapters/DatabaseAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Cache\Adapters; @@ -27,7 +27,6 @@ */ class DatabaseAdapter implements CacheInterface { - /** * @var int */ @@ -197,4 +196,4 @@ private function keyHash(string $key): string { return sha1($this->prefix . $key); } -} \ No newline at end of file +} diff --git a/src/Libraries/Cache/Adapters/FileAdapter.php b/src/Libraries/Cache/Adapters/FileAdapter.php index a7834ba8e..137e92d2b 100644 --- a/src/Libraries/Cache/Adapters/FileAdapter.php +++ b/src/Libraries/Cache/Adapters/FileAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Cache\Adapters; @@ -30,7 +30,6 @@ */ class FileAdapter implements CacheInterface { - /** * @var FileSystem */ @@ -40,7 +39,7 @@ class FileAdapter implements CacheInterface * @var int */ private $ttl; - + /** * @var string */ @@ -218,4 +217,4 @@ private function getPath(string $key): string { return $this->cacheDir . DS . sha1($this->prefix . $key); } -} \ No newline at end of file +} diff --git a/src/Libraries/Cache/Adapters/MemcachedAdapter.php b/src/Libraries/Cache/Adapters/MemcachedAdapter.php index 393a87dd3..bb8b085ff 100644 --- a/src/Libraries/Cache/Adapters/MemcachedAdapter.php +++ b/src/Libraries/Cache/Adapters/MemcachedAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Cache\Adapters; @@ -28,7 +28,6 @@ */ class MemcachedAdapter implements CacheInterface { - /** * @var int */ @@ -179,4 +178,4 @@ private function keyHash(string $key): string { return sha1($this->prefix . $key); } -} \ No newline at end of file +} diff --git a/src/Libraries/Cache/Adapters/RedisAdapter.php b/src/Libraries/Cache/Adapters/RedisAdapter.php index 7a1318838..4b43c9257 100644 --- a/src/Libraries/Cache/Adapters/RedisAdapter.php +++ b/src/Libraries/Cache/Adapters/RedisAdapter.php @@ -27,7 +27,6 @@ */ class RedisAdapter implements CacheInterface { - /** * @var int */ @@ -177,4 +176,4 @@ private function keyHash(string $key): string { return sha1($this->prefix . $key); } -} \ No newline at end of file +} diff --git a/src/Libraries/Cache/Cache.php b/src/Libraries/Cache/Cache.php index 537092646..f6068858f 100644 --- a/src/Libraries/Cache/Cache.php +++ b/src/Libraries/Cache/Cache.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Cache; @@ -32,26 +32,25 @@ */ class Cache { - /** * File adapter */ - const FILE = 'file'; + public const FILE = 'file'; /** * Database adapter */ - const DATABASE = 'database'; + public const DATABASE = 'database'; /** * Memcached adapter */ - const MEMCACHED = 'memcached'; + public const MEMCACHED = 'memcached'; /** * Redis adapter */ - const REDIS = 'redis'; + public const REDIS = 'redis'; /** * @var CacheInterface @@ -90,4 +89,4 @@ public function __call(string $method, ?array $arguments) return $this->adapter->$method(...$arguments); } -} \ No newline at end of file +} diff --git a/src/Libraries/Cache/Enums/ExceptionMessages.php b/src/Libraries/Cache/Enums/ExceptionMessages.php index bff512b43..f9b910412 100644 --- a/src/Libraries/Cache/Enums/ExceptionMessages.php +++ b/src/Libraries/Cache/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Cache\Enums; @@ -22,5 +22,5 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const ARGUMENT_NOT_ITERABLE = 'The argument {%1} is not iterable'; -} \ No newline at end of file + public const ARGUMENT_NOT_ITERABLE = 'The argument {%1} is not iterable'; +} diff --git a/src/Libraries/Cache/Exceptions/CacheException.php b/src/Libraries/Cache/Exceptions/CacheException.php index 0371253be..87818205a 100644 --- a/src/Libraries/Cache/Exceptions/CacheException.php +++ b/src/Libraries/Cache/Exceptions/CacheException.php @@ -11,7 +11,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Cache\Exceptions; @@ -24,5 +24,4 @@ */ class CacheException extends BaseException { - -} \ No newline at end of file +} diff --git a/src/Libraries/Cache/Factories/CacheFactory.php b/src/Libraries/Cache/Factories/CacheFactory.php index 0752d8185..c45c2031a 100644 --- a/src/Libraries/Cache/Factories/CacheFactory.php +++ b/src/Libraries/Cache/Factories/CacheFactory.php @@ -32,11 +32,10 @@ */ class CacheFactory { - /** * Supported adapters */ - const ADAPTERS = [ + public const ADAPTERS = [ Cache::FILE => FileAdapter::class, Cache::DATABASE => DatabaseAdapter::class, Cache::MEMCACHED => MemcachedAdapter::class, @@ -96,4 +95,4 @@ private static function getAdapterClass(string $adapter): string return self::ADAPTERS[$adapter]; } -} \ No newline at end of file +} diff --git a/src/Libraries/Cache/Helpers/cache.php b/src/Libraries/Cache/Helpers/cache.php index 6ce0f6360..f7d708727 100644 --- a/src/Libraries/Cache/Helpers/cache.php +++ b/src/Libraries/Cache/Helpers/cache.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\Libraries\Cache\Factories\CacheFactory; @@ -29,4 +29,4 @@ function cache(?string $adapter = null): Cache { return CacheFactory::get($adapter); -} \ No newline at end of file +} diff --git a/src/Libraries/Captcha/Adapters/HcaptchaAdapter.php b/src/Libraries/Captcha/Adapters/HcaptchaAdapter.php index 53ed8a811..f2fa2f20a 100644 --- a/src/Libraries/Captcha/Adapters/HcaptchaAdapter.php +++ b/src/Libraries/Captcha/Adapters/HcaptchaAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Captcha\Adapters; @@ -24,12 +24,11 @@ */ class HcaptchaAdapter implements CaptchaInterface { - use CaptchaTrait; - const VERIFY_URL = 'https://hcaptcha.com/siteverify'; + public const VERIFY_URL = 'https://hcaptcha.com/siteverify'; - const CLIENT_API = 'https://hcaptcha.com/1/api.js?onload=onLoadCallback&recaptchacompat=off'; + public const CLIENT_API = 'https://hcaptcha.com/1/api.js?onload=onLoadCallback&recaptchacompat=off'; /** * @var string @@ -54,4 +53,4 @@ public function __construct(array $params, HttpClient $httpClient) $this->siteKey = $params['site_key']; $this->type = $params['type'] ?? null; } -} \ No newline at end of file +} diff --git a/src/Libraries/Captcha/Adapters/RecaptchaAdapter.php b/src/Libraries/Captcha/Adapters/RecaptchaAdapter.php index 9f0aac7de..54d1447fb 100644 --- a/src/Libraries/Captcha/Adapters/RecaptchaAdapter.php +++ b/src/Libraries/Captcha/Adapters/RecaptchaAdapter.php @@ -24,12 +24,11 @@ */ class RecaptchaAdapter implements CaptchaInterface { - use CaptchaTrait; - const VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; + public const VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; - const CLIENT_API = 'https://www.google.com/recaptcha/api.js'; + public const CLIENT_API = 'https://www.google.com/recaptcha/api.js'; /** * @var string @@ -54,4 +53,4 @@ public function __construct(array $params, HttpClient $httpClient) $this->siteKey = $params['site_key']; $this->type = $params['type'] ?? null; } -} \ No newline at end of file +} diff --git a/src/Libraries/Captcha/Captcha.php b/src/Libraries/Captcha/Captcha.php index 85004ebda..e981472d7 100644 --- a/src/Libraries/Captcha/Captcha.php +++ b/src/Libraries/Captcha/Captcha.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Captcha; @@ -30,16 +30,15 @@ */ class Captcha { - /** * HCaptcha adapter */ - const HCAPTCHA = 'hcaptcha'; + public const HCAPTCHA = 'hcaptcha'; /** * ReCaptcha adapter */ - const RECAPTCHA = 'recaptcha'; + public const RECAPTCHA = 'recaptcha'; /** * @var CaptchaInterface @@ -76,4 +75,4 @@ public function __call(string $method, ?array $arguments) return $this->adapter->$method(...$arguments); } -} \ No newline at end of file +} diff --git a/src/Libraries/Captcha/Contracts/CaptchaInterface.php b/src/Libraries/Captcha/Contracts/CaptchaInterface.php index 2622a86f4..56e9b0691 100644 --- a/src/Libraries/Captcha/Contracts/CaptchaInterface.php +++ b/src/Libraries/Captcha/Contracts/CaptchaInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Captcha\Contracts; @@ -23,17 +23,17 @@ interface CaptchaInterface /** * Max time difference */ - const MAX_TIME_DIFF = 60; + public const MAX_TIME_DIFF = 60; /** * Captcha visible */ - const CAPTCHA_VISIBLE = 'visible'; + public const CAPTCHA_VISIBLE = 'visible'; /** * Captcha invisible */ - const CAPTCHA_INVISIBLE = 'invisible'; + public const CAPTCHA_INVISIBLE = 'invisible'; /** * @return string @@ -67,4 +67,4 @@ public function verify(string $response); * @return string|null */ public function getErrorMessage(): ?string; -} \ No newline at end of file +} diff --git a/src/Libraries/Captcha/Exceptions/CaptchaException.php b/src/Libraries/Captcha/Exceptions/CaptchaException.php index 78fef1e9f..ff4f51f5c 100644 --- a/src/Libraries/Captcha/Exceptions/CaptchaException.php +++ b/src/Libraries/Captcha/Exceptions/CaptchaException.php @@ -11,7 +11,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Captcha\Exceptions; @@ -24,5 +24,4 @@ */ class CaptchaException extends BaseException { - -} \ No newline at end of file +} diff --git a/src/Libraries/Captcha/Factories/CaptchaFactory.php b/src/Libraries/Captcha/Factories/CaptchaFactory.php index a363222f2..3cc447d86 100644 --- a/src/Libraries/Captcha/Factories/CaptchaFactory.php +++ b/src/Libraries/Captcha/Factories/CaptchaFactory.php @@ -31,11 +31,10 @@ */ class CaptchaFactory { - /** * Supported adapters */ - const ADAPTERS = [ + public const ADAPTERS = [ Captcha::HCAPTCHA => HcaptchaAdapter::class, Captcha::RECAPTCHA => RecaptchaAdapter::class, ]; @@ -93,4 +92,4 @@ private static function getAdapterClass(string $adapter): string return self::ADAPTERS[$adapter]; } -} \ No newline at end of file +} diff --git a/src/Libraries/Captcha/Helpers/captcha.php b/src/Libraries/Captcha/Helpers/captcha.php index ae08ddbe4..ab36c426a 100644 --- a/src/Libraries/Captcha/Helpers/captcha.php +++ b/src/Libraries/Captcha/Helpers/captcha.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\Libraries\Captcha\Factories\CaptchaFactory; @@ -29,4 +29,4 @@ function captcha(?string $adapter = null): Captcha { return CaptchaFactory::get($adapter); -} \ No newline at end of file +} diff --git a/src/Libraries/Captcha/Traits/CaptchaTrait.php b/src/Libraries/Captcha/Traits/CaptchaTrait.php index ee05c1a63..28e65fbf3 100644 --- a/src/Libraries/Captcha/Traits/CaptchaTrait.php +++ b/src/Libraries/Captcha/Traits/CaptchaTrait.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Captcha\Traits; @@ -31,7 +31,6 @@ */ trait CaptchaTrait { - /** * @var string */ @@ -140,7 +139,7 @@ public function verify(string $code): bool $query = [ 'secret' => $this->secretKey, 'response' => $code, - 'remoteip' => get_user_ip() + 'remoteip' => get_user_ip(), ]; $response = $this->http @@ -227,7 +226,7 @@ protected function isValidCaptchaType($type): bool { $captchaTypes = [ self::CAPTCHA_VISIBLE, - self::CAPTCHA_INVISIBLE + self::CAPTCHA_INVISIBLE, ]; return in_array($type, $captchaTypes, true); @@ -256,4 +255,4 @@ protected function detectReplayAttack(string $challengeTs): bool { return time() - strtotime($challengeTs) > self::MAX_TIME_DIFF; } -} \ No newline at end of file +} diff --git a/src/Libraries/Cookie/Contracts/CookieStorageInterface.php b/src/Libraries/Cookie/Contracts/CookieStorageInterface.php index f71a67901..250e0152a 100644 --- a/src/Libraries/Cookie/Contracts/CookieStorageInterface.php +++ b/src/Libraries/Cookie/Contracts/CookieStorageInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Cookie\Contracts; @@ -22,7 +22,6 @@ */ interface CookieStorageInterface extends StorageInterface { - /** * Sets data by given key * @param string $key @@ -41,4 +40,4 @@ public function set(string $key, $value = '', int $time = 0, string $path = '/', * @param string $path */ public function delete(string $key, string $path = '/'); -} \ No newline at end of file +} diff --git a/src/Libraries/Cookie/Cookie.php b/src/Libraries/Cookie/Cookie.php index 85eecf5f8..5154f91e1 100644 --- a/src/Libraries/Cookie/Cookie.php +++ b/src/Libraries/Cookie/Cookie.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Cookie; @@ -23,7 +23,6 @@ */ class Cookie implements CookieStorageInterface { - /** * Cookie storage * @var array $storage @@ -124,4 +123,4 @@ public function flush() } } } -} \ No newline at end of file +} diff --git a/src/Libraries/Cookie/Helpers/cookie.php b/src/Libraries/Cookie/Helpers/cookie.php index aa8d644b0..98738979b 100644 --- a/src/Libraries/Cookie/Helpers/cookie.php +++ b/src/Libraries/Cookie/Helpers/cookie.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ use Quantum\Libraries\Cookie\Cookie; @@ -21,4 +21,4 @@ function cookie(): Cookie { return Cookie::getInstance($_COOKIE); -} \ No newline at end of file +} diff --git a/src/Libraries/Csrf/Csrf.php b/src/Libraries/Csrf/Csrf.php index 7d7f87f49..0b9fe234e 100644 --- a/src/Libraries/Csrf/Csrf.php +++ b/src/Libraries/Csrf/Csrf.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Csrf; @@ -32,12 +32,12 @@ class Csrf /** * Request methods to validate against */ - const METHODS = ['POST', 'PUT', 'PATCH', 'DELETE']; + public const METHODS = ['POST', 'PUT', 'PATCH', 'DELETE']; /** * Csrf token key */ - const TOKEN_KEY = 'csrf-token'; + public const TOKEN_KEY = 'csrf-token'; /** * @var Csrf @@ -115,4 +115,4 @@ public function checkToken(?Request $request): bool return true; } -} \ No newline at end of file +} diff --git a/src/Libraries/Csrf/Enums/ExceptionMessages.php b/src/Libraries/Csrf/Enums/ExceptionMessages.php index 206ea7155..d5aa90b36 100644 --- a/src/Libraries/Csrf/Enums/ExceptionMessages.php +++ b/src/Libraries/Csrf/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Csrf\Enums; @@ -22,7 +22,7 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const CSRF_TOKEN_MISSING = 'CSRF Token is missing'; + public const CSRF_TOKEN_MISSING = 'CSRF Token is missing'; - const CSRF_TOKEN_MISMATCH = 'CSRF Token does not matched'; -} \ No newline at end of file + public const CSRF_TOKEN_MISMATCH = 'CSRF Token does not matched'; +} diff --git a/src/Libraries/Csrf/Exceptions/CsrfException.php b/src/Libraries/Csrf/Exceptions/CsrfException.php index 7aa69fbd4..f0720f781 100644 --- a/src/Libraries/Csrf/Exceptions/CsrfException.php +++ b/src/Libraries/Csrf/Exceptions/CsrfException.php @@ -46,4 +46,4 @@ public static function tokenNotMatched(): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Csrf/Helpers/csrf.php b/src/Libraries/Csrf/Helpers/csrf.php index 160e68478..09970aff5 100644 --- a/src/Libraries/Csrf/Helpers/csrf.php +++ b/src/Libraries/Csrf/Helpers/csrf.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\App\Exceptions\BaseException; @@ -39,4 +39,4 @@ function csrf_token(): ?string } return csrf()->generateToken($appKey); -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Idiorm/IdiormDbal.php b/src/Libraries/Database/Adapters/Idiorm/IdiormDbal.php index bfc377206..1017fcbfd 100644 --- a/src/Libraries/Database/Adapters/Idiorm/IdiormDbal.php +++ b/src/Libraries/Database/Adapters/Idiorm/IdiormDbal.php @@ -35,7 +35,6 @@ */ class IdiormDbal implements DbalInterface, RelationalInterface { - use Transaction; use Model; use Result; @@ -47,22 +46,22 @@ class IdiormDbal implements DbalInterface, RelationalInterface /** * SQLite driver */ - const DRIVER_SQLITE = 'sqlite'; + public const DRIVER_SQLITE = 'sqlite'; /** * MySQL driver */ - const DRIVER_MYSQL = 'mysql'; + public const DRIVER_MYSQL = 'mysql'; /** * PostgresSQL driver */ - const DRIVER_PGSQL = 'pgsql'; + public const DRIVER_PGSQL = 'pgsql'; /** * Default charset */ - const DEFAULT_CHARSET = 'utf8'; + public const DEFAULT_CHARSET = 'utf8'; /** * Associated model name @@ -151,8 +150,7 @@ public function __construct( string $idColumn = 'id', array $foreignKeys = [], array $hidden = [] - ) - { + ) { $this->modelName = $modelName; $this->table = $table; $this->idColumn = $idColumn; @@ -312,4 +310,4 @@ protected static function buildConnectionString(string $driver, array $config): throw new InvalidArgumentException("Unsupported driver: $driver"); } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Idiorm/IdiormPatch.php b/src/Libraries/Database/Adapters/Idiorm/IdiormPatch.php index 329b7282b..567c962f7 100644 --- a/src/Libraries/Database/Adapters/Idiorm/IdiormPatch.php +++ b/src/Libraries/Database/Adapters/Idiorm/IdiormPatch.php @@ -22,7 +22,6 @@ */ class IdiormPatch extends ORM { - /** * @var object */ @@ -66,7 +65,7 @@ public function use(object $ormModel): IdiormPatch */ public function leftJoin(string $table, array $constraint, string $table_alias = null): object { - return $this->addJoin("LEFT", $table, $constraint, $table_alias); + return $this->addJoin('LEFT', $table, $constraint, $table_alias); } /** @@ -78,7 +77,7 @@ public function leftJoin(string $table, array $constraint, string $table_alias = */ public function rightJoin(string $table, array $constraint, string $table_alias = null): object { - return $this->addJoin("RIGHT", $table, $constraint, $table_alias); + return $this->addJoin('RIGHT', $table, $constraint, $table_alias); } /** diff --git a/src/Libraries/Database/Adapters/Idiorm/Statements/Criteria.php b/src/Libraries/Database/Adapters/Idiorm/Statements/Criteria.php index 8f58e8caa..4a0fb8ee6 100644 --- a/src/Libraries/Database/Adapters/Idiorm/Statements/Criteria.php +++ b/src/Libraries/Database/Adapters/Idiorm/Statements/Criteria.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Adapters\Idiorm\Statements; @@ -23,7 +23,6 @@ */ trait Criteria { - /** * @inheritDoc * @throws DatabaseException @@ -137,4 +136,4 @@ protected function orCriteria(array $orCriterias) $this->getOrmModel()->where_raw($clause, $params); } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Idiorm/Statements/Join.php b/src/Libraries/Database/Adapters/Idiorm/Statements/Join.php index c94df2d65..61dcf6cdf 100644 --- a/src/Libraries/Database/Adapters/Idiorm/Statements/Join.php +++ b/src/Libraries/Database/Adapters/Idiorm/Statements/Join.php @@ -27,7 +27,6 @@ */ trait Join { - /** * @inheritDoc * @throws BaseException @@ -120,7 +119,7 @@ protected function applyHasRelation(QtModel $relatedModel, array $relation): voi [ $relatedModel->table . '.' . $relation['foreign_key'], '=', - $this->table . '.' . $relation['local_key'] + $this->table . '.' . $relation['local_key'], ] ); } @@ -138,7 +137,7 @@ protected function applyBelongsTo(QtModel $relatedModel, array $relation): void [ $relatedModel->table . '.' . $relation['local_key'], '=', - $this->table . '.' . $relation['foreign_key'] + $this->table . '.' . $relation['foreign_key'], ] ); } @@ -169,4 +168,4 @@ private function getValidatedRelation(QtModel $modelToJoin): array return $relation; } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Idiorm/Statements/Model.php b/src/Libraries/Database/Adapters/Idiorm/Statements/Model.php index 63d644b73..3fb2052b6 100644 --- a/src/Libraries/Database/Adapters/Idiorm/Statements/Model.php +++ b/src/Libraries/Database/Adapters/Idiorm/Statements/Model.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Adapters\Idiorm\Statements; @@ -23,7 +23,6 @@ */ trait Model { - /** * @inheritDoc * @throws DatabaseException @@ -73,4 +72,4 @@ public function deleteMany(): bool { return $this->getOrmModel()->delete_many(); } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Idiorm/Statements/Query.php b/src/Libraries/Database/Adapters/Idiorm/Statements/Query.php index 9e48f9dcd..ba770792c 100644 --- a/src/Libraries/Database/Adapters/Idiorm/Statements/Query.php +++ b/src/Libraries/Database/Adapters/Idiorm/Statements/Query.php @@ -23,7 +23,6 @@ */ trait Query { - /** * @inheritDoc * @throws DatabaseException @@ -124,4 +123,4 @@ public static function fetchColumns(string $table): array return $columns; } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Idiorm/Statements/Reducer.php b/src/Libraries/Database/Adapters/Idiorm/Statements/Reducer.php index 33fe09bc0..c63f1fabd 100644 --- a/src/Libraries/Database/Adapters/Idiorm/Statements/Reducer.php +++ b/src/Libraries/Database/Adapters/Idiorm/Statements/Reducer.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Adapters\Idiorm\Statements; @@ -25,7 +25,6 @@ */ trait Reducer { - /** * @inheritDoc * @throws DatabaseException @@ -92,4 +91,4 @@ public function limit(int $limit): DbalInterface $this->getOrmModel()->limit($limit); return $this; } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Idiorm/Statements/Result.php b/src/Libraries/Database/Adapters/Idiorm/Statements/Result.php index 8627780dc..22898417f 100644 --- a/src/Libraries/Database/Adapters/Idiorm/Statements/Result.php +++ b/src/Libraries/Database/Adapters/Idiorm/Statements/Result.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.6 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Adapters\Idiorm\Statements; @@ -23,7 +23,6 @@ */ trait Result { - /** * @inheritDoc * @throws DatabaseException @@ -112,4 +111,4 @@ public function setHidden($result): array { return array_diff_key($result, array_flip($this->hidden)); } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Idiorm/Statements/Transaction.php b/src/Libraries/Database/Adapters/Idiorm/Statements/Transaction.php index 493f9053a..7d0d3ce50 100644 --- a/src/Libraries/Database/Adapters/Idiorm/Statements/Transaction.php +++ b/src/Libraries/Database/Adapters/Idiorm/Statements/Transaction.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Adapters\Idiorm\Statements; @@ -23,7 +23,6 @@ */ trait Transaction { - /** * Begins a transaction * @throws BaseException @@ -62,4 +61,4 @@ public static function rollback(): void (self::$ormClass)::get_db()->rollBack(); } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Sleekdb/SleekDbal.php b/src/Libraries/Database/Adapters/Sleekdb/SleekDbal.php index bdfc81417..dc92a9535 100644 --- a/src/Libraries/Database/Adapters/Sleekdb/SleekDbal.php +++ b/src/Libraries/Database/Adapters/Sleekdb/SleekDbal.php @@ -35,7 +35,6 @@ */ class SleekDbal implements DbalInterface { - use Model; use Result; use Criteria; @@ -170,8 +169,7 @@ public function __construct( string $idColumn = 'id', array $foreignKeys = [], array $hidden = [] - ) - { + ) { $this->modelName = $modelName; $this->table = $table; $this->idColumn = $idColumn; @@ -376,4 +374,4 @@ protected function resetBuilderState(): void $this->joins = []; $this->queryBuilder = null; } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Sleekdb/Statements/Criteria.php b/src/Libraries/Database/Adapters/Sleekdb/Statements/Criteria.php index 76234db51..3f03b3a39 100644 --- a/src/Libraries/Database/Adapters/Sleekdb/Statements/Criteria.php +++ b/src/Libraries/Database/Adapters/Sleekdb/Statements/Criteria.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Adapters\Sleekdb\Statements; @@ -23,7 +23,6 @@ */ trait Criteria { - /** * @inheritDoc * @throws DatabaseException @@ -125,13 +124,13 @@ protected function sanitizeValue($value) ']' => '\]', '{' => '\{', '}' => '\}', - '|' => '\|' + '|' => '\|', ]; if (is_array($value)) { - return array_map(fn($v) => is_string($v) ? strtr($v, $escapeMap) : $v, $value); + return array_map(fn ($v) => is_string($v) ? strtr($v, $escapeMap) : $v, $value); } return is_string($value) ? strtr($value, $escapeMap) : $value; } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Sleekdb/Statements/Join.php b/src/Libraries/Database/Adapters/Sleekdb/Statements/Join.php index fce6f03e2..e0fcc7fd8 100644 --- a/src/Libraries/Database/Adapters/Sleekdb/Statements/Join.php +++ b/src/Libraries/Database/Adapters/Sleekdb/Statements/Join.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Adapters\Sleekdb\Statements; @@ -28,7 +28,6 @@ */ trait Join { - /** * @inheritDoc */ @@ -136,7 +135,7 @@ private function applyHasRelation(QueryBuilder $queryBuilder, array $currentItem $queryBuilder->where([ $relation['foreign_key'], '=', - $currentItem[$relation['local_key']] + $currentItem[$relation['local_key']], ]); } @@ -158,7 +157,7 @@ private function applyBelongsTo(QueryBuilder $queryBuilder, array $currentItem, $queryBuilder->where([ $relation['local_key'], '=', - $currentItem[$relation['foreign_key']] + $currentItem[$relation['foreign_key']], ]); } @@ -189,4 +188,4 @@ private function getValidatedRelation(SleekDbal $currentModel, QtModel $relatedM return $relation; } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Sleekdb/Statements/Model.php b/src/Libraries/Database/Adapters/Sleekdb/Statements/Model.php index be5b20b38..5ac41591b 100644 --- a/src/Libraries/Database/Adapters/Sleekdb/Statements/Model.php +++ b/src/Libraries/Database/Adapters/Sleekdb/Statements/Model.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.6 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Adapters\Sleekdb\Statements; @@ -29,7 +29,6 @@ */ trait Model { - /** * @inheritDoc */ @@ -99,4 +98,4 @@ public function deleteMany(): bool { return $this->getBuilder()->getQuery()->delete(); } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Sleekdb/Statements/Reducer.php b/src/Libraries/Database/Adapters/Sleekdb/Statements/Reducer.php index c7ae0b923..da05533a8 100644 --- a/src/Libraries/Database/Adapters/Sleekdb/Statements/Reducer.php +++ b/src/Libraries/Database/Adapters/Sleekdb/Statements/Reducer.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Adapters\Sleekdb\Statements; @@ -24,7 +24,6 @@ */ trait Reducer { - /** * @inheritDoc */ @@ -100,4 +99,4 @@ private function selectPatch(array $columns): array return $columns; } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Adapters/Sleekdb/Statements/Result.php b/src/Libraries/Database/Adapters/Sleekdb/Statements/Result.php index c093870c8..da535cfe0 100644 --- a/src/Libraries/Database/Adapters/Sleekdb/Statements/Result.php +++ b/src/Libraries/Database/Adapters/Sleekdb/Statements/Result.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Adapters\Sleekdb\Statements; @@ -28,7 +28,6 @@ */ trait Result { - abstract protected function resetBuilderState(): void; /** @@ -146,4 +145,4 @@ public function setHidden($result): array { return array_diff_key($result, array_flip($this->hidden)); } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Contracts/DbalInterface.php b/src/Libraries/Database/Contracts/DbalInterface.php index 20beb8180..ed8094192 100644 --- a/src/Libraries/Database/Contracts/DbalInterface.php +++ b/src/Libraries/Database/Contracts/DbalInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Contracts; @@ -22,7 +22,6 @@ */ interface DbalInterface { - /** * Connects to database * @param array $config diff --git a/src/Libraries/Database/Contracts/RelationalInterface.php b/src/Libraries/Database/Contracts/RelationalInterface.php index d8b5f0e1c..c1e2032e0 100644 --- a/src/Libraries/Database/Contracts/RelationalInterface.php +++ b/src/Libraries/Database/Contracts/RelationalInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Contracts; @@ -20,7 +20,6 @@ */ interface RelationalInterface { - /** * Raw execute * @param string $query @@ -92,4 +91,4 @@ public function leftJoin(string $table, array $constraint, ?string $tableAlias = */ public function rightJoin(string $table, array $constraint, ?string $tableAlias = null): DbalInterface; -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Database.php b/src/Libraries/Database/Database.php index 002760caa..7a27c8a9e 100644 --- a/src/Libraries/Database/Database.php +++ b/src/Libraries/Database/Database.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Database; @@ -31,11 +31,10 @@ */ class Database { - use TransactionTrait; use RelationalTrait; - const ADAPTERS = [ + public const ADAPTERS = [ 'sleekdb' => SleekDbal::class, 'mysql' => IdiormDbal::class, 'sqlite' => IdiormDbal::class, @@ -126,4 +125,4 @@ private function getAdapterClass(string $adapter): string return self::ADAPTERS[$adapter]; } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Enums/ExceptionMessages.php b/src/Libraries/Database/Enums/ExceptionMessages.php index e9549048a..52afeef0a 100644 --- a/src/Libraries/Database/Enums/ExceptionMessages.php +++ b/src/Libraries/Database/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Enums; @@ -22,11 +22,11 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const INCORRECT_CONFIG = 'The structure of config is not correct'; + public const INCORRECT_CONFIG = 'The structure of config is not correct'; - const NOT_SUPPORTED_OPERATOR = 'The operator `{%1}` is not supported'; + public const NOT_SUPPORTED_OPERATOR = 'The operator `{%1}` is not supported'; - const TABLE_ALREADY_EXISTS = 'The table `{%1}` is already exists'; + public const TABLE_ALREADY_EXISTS = 'The table `{%1}` is already exists'; - const TABLE_NOT_EXISTS = 'The table `{%1}` does not exists'; -} \ No newline at end of file + public const TABLE_NOT_EXISTS = 'The table `{%1}` does not exists'; +} diff --git a/src/Libraries/Database/Enums/Key.php b/src/Libraries/Database/Enums/Key.php index da872e7d2..8765969c3 100644 --- a/src/Libraries/Database/Enums/Key.php +++ b/src/Libraries/Database/Enums/Key.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Enums; @@ -20,30 +20,29 @@ */ class Key { - /** * Primary key definition */ - const PRIMARY = 'primary'; + public const PRIMARY = 'primary'; /** * Index key definition */ - const INDEX = 'index'; + public const INDEX = 'index'; /** * Unique key definition */ - const UNIQUE = 'unique'; + public const UNIQUE = 'unique'; /** * Full-text key definition */ - const FULLTEXT = 'fulltext'; + public const FULLTEXT = 'fulltext'; /** * Spatial key definition */ - const SPATIAL = 'spatial'; + public const SPATIAL = 'spatial'; } diff --git a/src/Libraries/Database/Enums/Relation.php b/src/Libraries/Database/Enums/Relation.php index 014231180..d6c56116f 100644 --- a/src/Libraries/Database/Enums/Relation.php +++ b/src/Libraries/Database/Enums/Relation.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Enums; @@ -18,9 +18,10 @@ * Class Relation * @package Quantum\Libraries\Database */ -class Relation { - const HAS_ONE = 'hasOne'; - const HAS_MANY = 'hasMany'; - const BELONGS_TO = 'belongsTo'; - const BELONGS_TO_MANY = 'belongsToMany'; -} \ No newline at end of file +class Relation +{ + public const HAS_ONE = 'hasOne'; + public const HAS_MANY = 'hasMany'; + public const BELONGS_TO = 'belongsTo'; + public const BELONGS_TO_MANY = 'belongsToMany'; +} diff --git a/src/Libraries/Database/Enums/Type.php b/src/Libraries/Database/Enums/Type.php index 1f36a192f..b190f4220 100644 --- a/src/Libraries/Database/Enums/Type.php +++ b/src/Libraries/Database/Enums/Type.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Enums; @@ -20,90 +20,89 @@ */ class Type { - /** * Type integer */ - const INT = 'int'; + public const INT = 'int'; /** * Type tiny integer */ - const TINYINT = 'tinyint'; + public const TINYINT = 'tinyint'; /** * Type float */ - const FLOAT = 'float'; + public const FLOAT = 'float'; /** * Type double */ - const DOUBLE = 'double'; + public const DOUBLE = 'double'; /** * Type decimal */ - const DECIMAL = 'decimal'; + public const DECIMAL = 'decimal'; /** * Type boolean */ - const BOOL = 'bool'; + public const BOOL = 'bool'; /** * Type char */ - const CHAR = 'char'; + public const CHAR = 'char'; /** * Type varchar */ - const VARCHAR = 'varchar'; + public const VARCHAR = 'varchar'; /** * Type text */ - const TEXT = 'text'; + public const TEXT = 'text'; /** * Type binary */ - const BINARY = 'binary'; + public const BINARY = 'binary'; /** * Type blob */ - const BLOB = 'blob'; + public const BLOB = 'blob'; /** * Type enum */ - const ENUM = 'enum'; + public const ENUM = 'enum'; /** * Type date */ - const DATE = 'date'; + public const DATE = 'date'; /** * Type datetime */ - const DATETIME = 'datetime'; + public const DATETIME = 'datetime'; /** * Type timestamp */ - const TIMESTAMP = 'timestamp'; + public const TIMESTAMP = 'timestamp'; /** * Type json */ - const JSON = 'json'; + public const JSON = 'json'; /** * Type geometry */ - const GEOMETRY = 'geometry'; + public const GEOMETRY = 'geometry'; } diff --git a/src/Libraries/Database/Exceptions/DatabaseException.php b/src/Libraries/Database/Exceptions/DatabaseException.php index 7b8f1fab4..cef0a7118 100644 --- a/src/Libraries/Database/Exceptions/DatabaseException.php +++ b/src/Libraries/Database/Exceptions/DatabaseException.php @@ -25,7 +25,6 @@ */ class DatabaseException extends BaseException { - /** * @return DatabaseException */ @@ -72,4 +71,4 @@ public static function tableDoesNotExists(string $name): self E_ERROR ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Factories/TableFactory.php b/src/Libraries/Database/Factories/TableFactory.php index 3ff30f206..c5e7d3e15 100644 --- a/src/Libraries/Database/Factories/TableFactory.php +++ b/src/Libraries/Database/Factories/TableFactory.php @@ -24,7 +24,6 @@ */ class TableFactory { - /** * Creates new table * @param string $name @@ -113,4 +112,4 @@ private function createInstance(string $name): Table { return new Table($name); } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Schemas/Column.php b/src/Libraries/Database/Schemas/Column.php index 80636d4f3..315dd1bab 100644 --- a/src/Libraries/Database/Schemas/Column.php +++ b/src/Libraries/Database/Schemas/Column.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Schemas; @@ -22,101 +22,100 @@ */ class Column { - /** * Action add */ - const ADD = 'ADD'; + public const ADD = 'ADD'; /** * Action modify */ - const MODIFY = 'MODIFY'; + public const MODIFY = 'MODIFY'; /** * Action rename */ - const RENAME = 'RENAME'; + public const RENAME = 'RENAME'; /** * Action drop */ - const DROP = 'DROP'; + public const DROP = 'DROP'; /** * Action add index */ - const ADD_INDEX = 'ADD_INDEX'; + public const ADD_INDEX = 'ADD_INDEX'; /** * Action drop index */ - const DROP_INDEX = 'DROP_INDEX'; + public const DROP_INDEX = 'DROP_INDEX'; /** * Name property */ - const NAME = 'name'; + public const NAME = 'name'; /** * New Name property */ - const NEW_NAME = 'newName'; + public const NEW_NAME = 'newName'; /** * Type property */ - const TYPE = 'type'; + public const TYPE = 'type'; /** * Constraint property */ - const CONSTRAINT = 'constraint'; + public const CONSTRAINT = 'constraint'; /** * Attribute property */ - const ATTRIBUTE = 'attribute'; + public const ATTRIBUTE = 'attribute'; /** * Nullable property */ - const NULLABLE = 'nullable'; + public const NULLABLE = 'nullable'; /** * Default property */ - const DEFAULT = 'default'; + public const DEFAULT = 'default'; /** * After column property */ - const AFTER = 'afterColumn'; + public const AFTER = 'afterColumn'; /** * Comment property */ - const COMMENT = 'comment'; + public const COMMENT = 'comment'; /** * Auto increment property */ - const AUTO_INCREMENT = 'autoincrement'; + public const AUTO_INCREMENT = 'autoincrement'; /** * Attribute binary */ - const ATTR_BINARY = 'BINARY'; + public const ATTR_BINARY = 'BINARY'; /** * Attribute unsigned */ - const ATTR_UNSIGNED = 'UNSIGNED'; + public const ATTR_UNSIGNED = 'UNSIGNED'; /** * Attribute zero fill */ - const ATTR_ZEROFILL = 'UNSIGNED ZEROFILL'; + public const ATTR_ZEROFILL = 'UNSIGNED ZEROFILL'; /** * @var string @@ -301,7 +300,6 @@ public function spatial(string $name = null) } } - /** * Adds or removes nullable property * @param bool $indeed diff --git a/src/Libraries/Database/Schemas/Table.php b/src/Libraries/Database/Schemas/Table.php index a3a93065b..316a944a1 100644 --- a/src/Libraries/Database/Schemas/Table.php +++ b/src/Libraries/Database/Schemas/Table.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Schemas; @@ -38,28 +38,27 @@ */ class Table { - use TableTrait; /** * Action create */ - const CREATE = 1; + public const CREATE = 1; /** * Action alter */ - const ALTER = 2; + public const ALTER = 2; /** * Action drop */ - const DROP = 3; + public const DROP = 3; /** * Action rename */ - const RENAME = 4; + public const RENAME = 4; /** * @var string @@ -150,7 +149,7 @@ public function addColumn(string $name, string $type, $constraint = null): Table { $this->columns[] = [ 'column' => new Column($name, $type, $constraint), - 'action' => $this->action == self::ALTER ? Column::ADD : null + 'action' => $this->action == self::ALTER ? Column::ADD : null, ]; return $this; @@ -168,7 +167,7 @@ public function modifyColumn(string $name, string $type, $constraint = null): Ta if ($this->action == self::ALTER) { $this->columns[] = [ 'column' => new Column($name, $type, $constraint), - 'action' => Column::MODIFY + 'action' => Column::MODIFY, ]; } @@ -185,7 +184,7 @@ public function renameColumn(string $oldName, string $newName) if ($this->action == self::ALTER) { $this->columns[] = [ 'column' => (new Column($oldName))->renameTo($newName), - 'action' => Column::RENAME + 'action' => Column::RENAME, ]; } } @@ -199,7 +198,7 @@ public function dropColumn(string $name) if ($this->action == self::ALTER) { $this->columns[] = [ 'column' => new Column($name), - 'action' => Column::DROP + 'action' => Column::DROP, ]; } } @@ -215,7 +214,7 @@ public function addIndex(string $columnName, string $indexType, string $indexNam if ($this->action == self::ALTER) { $this->columns[] = [ 'column' => new Column($columnName), - 'action' => Column::ADD_INDEX + 'action' => Column::ADD_INDEX, ]; $this->$indexType($indexName); @@ -231,7 +230,7 @@ public function dropIndex(string $indexName) if ($this->action == self::ALTER) { $this->columns[] = [ 'column' => (new Column('dummy'))->indexDrop($indexName), - 'action' => Column::DROP_INDEX + 'action' => Column::DROP_INDEX, ]; } } @@ -333,4 +332,4 @@ private function columnKey(): int { return (int)array_key_last($this->columns); } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Traits/RelationalTrait.php b/src/Libraries/Database/Traits/RelationalTrait.php index f768cf586..b0ad27736 100644 --- a/src/Libraries/Database/Traits/RelationalTrait.php +++ b/src/Libraries/Database/Traits/RelationalTrait.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.6 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Traits; @@ -22,7 +22,6 @@ */ trait RelationalTrait { - /** * Raw execute * @param string $query @@ -92,4 +91,4 @@ protected static function resolveQuery(string $method, string $query = '', array { return self::getInstance()->getOrmClass()::$method($query, $parameters); } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Traits/TableTrait.php b/src/Libraries/Database/Traits/TableTrait.php index 090f55f00..332a6cfe6 100644 --- a/src/Libraries/Database/Traits/TableTrait.php +++ b/src/Libraries/Database/Traits/TableTrait.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Database\Traits; @@ -23,7 +23,6 @@ */ trait TableTrait { - /** * Generates create table statement * @return string @@ -221,7 +220,7 @@ protected function indexesSql(): string $this->indexKeysSql(Key::INDEX), $this->indexKeysSql(Key::UNIQUE), $this->indexKeysSql(Key::FULLTEXT), - $this->indexKeysSql(Key::SPATIAL) + $this->indexKeysSql(Key::SPATIAL), ]; return implode(', ', array_filter($indexes)); @@ -247,4 +246,4 @@ protected function dropIndexesSql(): string return $sql; } -} \ No newline at end of file +} diff --git a/src/Libraries/Database/Traits/TransactionTrait.php b/src/Libraries/Database/Traits/TransactionTrait.php index 9a48f72df..f7f218f3b 100644 --- a/src/Libraries/Database/Traits/TransactionTrait.php +++ b/src/Libraries/Database/Traits/TransactionTrait.php @@ -1,5 +1,17 @@ + * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) + * @link http://quantum.softberg.org/ + * @since 3.0.0 + */ + namespace Quantum\Libraries\Database\Traits; use Quantum\Libraries\Database\Exceptions\DatabaseException; @@ -12,7 +24,6 @@ */ trait TransactionTrait { - /** * Begins a transaction * @throws BaseException @@ -79,4 +90,4 @@ public static function transaction(callable $callback) throw $e; } } -} \ No newline at end of file +} diff --git a/src/Libraries/Encryption/Adapters/AsymmetricEncryptionAdapter.php b/src/Libraries/Encryption/Adapters/AsymmetricEncryptionAdapter.php index 40a18a2b6..f3e359c57 100644 --- a/src/Libraries/Encryption/Adapters/AsymmetricEncryptionAdapter.php +++ b/src/Libraries/Encryption/Adapters/AsymmetricEncryptionAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Encryption\Adapters; @@ -24,16 +24,15 @@ */ class AsymmetricEncryptionAdapter implements EncryptionInterface { - /** * Digest algorithm */ - const DIGEST_ALGO = 'SHA512'; + public const DIGEST_ALGO = 'SHA512'; /** * Key bits */ - const KEY_BITS = 1024; + public const KEY_BITS = 1024; /** * @var string @@ -64,7 +63,7 @@ public function __construct() */ public function encrypt(string $plain): string { - if(!$this->publicKey) { + if (!$this->publicKey) { throw CryptorException::publicKeyNotProvided(); } @@ -96,7 +95,7 @@ public function decrypt(string $encrypted): string private function generateKeyPair(): array { $resource = openssl_pkey_new([ - "private_key_type" => OPENSSL_KEYTYPE_RSA, + 'private_key_type' => OPENSSL_KEYTYPE_RSA, 'private_key_bits' => self::KEY_BITS, 'digest_alg' => self::DIGEST_ALGO, ]); @@ -110,7 +109,7 @@ private function generateKeyPair(): array return [ 'private' => $privateKey, - 'public' => $publicKey + 'public' => $publicKey, ]; } -} \ No newline at end of file +} diff --git a/src/Libraries/Encryption/Adapters/SymmetricEncryptionAdapter.php b/src/Libraries/Encryption/Adapters/SymmetricEncryptionAdapter.php index 78075172d..883b5a88a 100644 --- a/src/Libraries/Encryption/Adapters/SymmetricEncryptionAdapter.php +++ b/src/Libraries/Encryption/Adapters/SymmetricEncryptionAdapter.php @@ -25,11 +25,10 @@ */ class SymmetricEncryptionAdapter implements EncryptionInterface { - /** * Cipher method */ - const CIPHER_METHOD = 'aes-256-cbc'; + public const CIPHER_METHOD = 'aes-256-cbc'; /** * @var string @@ -97,4 +96,4 @@ private function generateIV(): string $length = openssl_cipher_iv_length(self::CIPHER_METHOD); return openssl_random_pseudo_bytes($length); } -} \ No newline at end of file +} diff --git a/src/Libraries/Encryption/Contracts/EncryptionInterface.php b/src/Libraries/Encryption/Contracts/EncryptionInterface.php index b5af15cc9..5f58c16ee 100644 --- a/src/Libraries/Encryption/Contracts/EncryptionInterface.php +++ b/src/Libraries/Encryption/Contracts/EncryptionInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Encryption\Contracts; @@ -20,7 +20,6 @@ */ interface EncryptionInterface { - /** * @param string $plain * @return string @@ -32,4 +31,4 @@ public function encrypt(string $plain): string; * @return string */ public function decrypt(string $encrypted): string; -} \ No newline at end of file +} diff --git a/src/Libraries/Encryption/Cryptor.php b/src/Libraries/Encryption/Cryptor.php index 03631e178..a509821b6 100644 --- a/src/Libraries/Encryption/Cryptor.php +++ b/src/Libraries/Encryption/Cryptor.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Encryption; @@ -27,16 +27,15 @@ */ class Cryptor { - /** * Symmetric */ - const SYMMETRIC = 'symmetric'; + public const SYMMETRIC = 'symmetric'; /** * Asymmetric */ - const ASYMMETRIC = 'asymmetric'; + public const ASYMMETRIC = 'asymmetric'; /** * @var EncryptionInterface @@ -81,4 +80,4 @@ public function __call(string $method, ?array $arguments) return $this->adapter->$method(...$arguments); } -} \ No newline at end of file +} diff --git a/src/Libraries/Encryption/Enums/ExceptionMessages.php b/src/Libraries/Encryption/Enums/ExceptionMessages.php index 05e278b79..0d421bfe6 100644 --- a/src/Libraries/Encryption/Enums/ExceptionMessages.php +++ b/src/Libraries/Encryption/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Encryption\Enums; @@ -22,11 +22,10 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const PUBLIC_KEY_MISSING = 'Public key is not provided'; + public const PUBLIC_KEY_MISSING = 'Public key is not provided'; - const PRIVATE_KEY_MISSING = 'Private key is not provided'; + public const PRIVATE_KEY_MISSING = 'Private key is not provided'; - const INVALID_CIPHER = 'The cipher is invalid'; + public const INVALID_CIPHER = 'The cipher is invalid'; - -} \ No newline at end of file +} diff --git a/src/Libraries/Encryption/Exceptions/CryptorException.php b/src/Libraries/Encryption/Exceptions/CryptorException.php index 8cbb56a49..e53614064 100644 --- a/src/Libraries/Encryption/Exceptions/CryptorException.php +++ b/src/Libraries/Encryption/Exceptions/CryptorException.php @@ -25,7 +25,6 @@ */ class CryptorException extends BaseException { - /** * @return CryptorException */ @@ -58,4 +57,4 @@ public static function invalidCipher(): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Encryption/Factories/CryptorFactory.php b/src/Libraries/Encryption/Factories/CryptorFactory.php index 65d6f1f5b..5b75963c1 100644 --- a/src/Libraries/Encryption/Factories/CryptorFactory.php +++ b/src/Libraries/Encryption/Factories/CryptorFactory.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Encryption\Factories; @@ -26,11 +26,10 @@ */ class CryptorFactory { - /** * Supported adapters */ - const ADAPTERS = [ + public const ADAPTERS = [ Cryptor::SYMMETRIC => SymmetricEncryptionAdapter::class, Cryptor::ASYMMETRIC => AsymmetricEncryptionAdapter::class, ]; @@ -67,6 +66,6 @@ private static function createInstance(string $type): Cryptor $adapterClass = self::ADAPTERS[$type]; - return new Cryptor(new $adapterClass); + return new Cryptor(new $adapterClass()); } -} \ No newline at end of file +} diff --git a/src/Libraries/Encryption/Helpers/encryption.php b/src/Libraries/Encryption/Helpers/encryption.php index 777528345..ce0e9c90e 100644 --- a/src/Libraries/Encryption/Helpers/encryption.php +++ b/src/Libraries/Encryption/Helpers/encryption.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\Libraries\Encryption\Factories\CryptorFactory; @@ -49,4 +49,4 @@ function crypto_decode(string $encryptedData, string $type = Cryptor::SYMMETRIC) } return $decryptedData; -} \ No newline at end of file +} diff --git a/src/Libraries/Hasher/Enums/ExceptionMessages.php b/src/Libraries/Hasher/Enums/ExceptionMessages.php index 5e1608f03..f190dff22 100644 --- a/src/Libraries/Hasher/Enums/ExceptionMessages.php +++ b/src/Libraries/Hasher/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Hasher\Enums; @@ -22,7 +22,7 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const ALGORITHM_NOT_SUPPORTED = 'The algorithm {%1} not supported.'; + public const ALGORITHM_NOT_SUPPORTED = 'The algorithm {%1} not supported.'; - const INVALID_BCRYPT_COST = 'Provided bcrypt cost is invalid.'; -} \ No newline at end of file + public const INVALID_BCRYPT_COST = 'Provided bcrypt cost is invalid.'; +} diff --git a/src/Libraries/Hasher/Exceptions/HasherException.php b/src/Libraries/Hasher/Exceptions/HasherException.php index 6ea4c280f..58537d415 100644 --- a/src/Libraries/Hasher/Exceptions/HasherException.php +++ b/src/Libraries/Hasher/Exceptions/HasherException.php @@ -25,7 +25,6 @@ */ class HasherException extends BaseException { - /** * * @param string $algorithm @@ -50,4 +49,4 @@ public static function invalidBcryptCost(): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Hasher/Hasher.php b/src/Libraries/Hasher/Hasher.php index 2d3f6c33e..2706a0e22 100644 --- a/src/Libraries/Hasher/Hasher.php +++ b/src/Libraries/Hasher/Hasher.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Hasher; @@ -22,7 +22,6 @@ */ class Hasher { - /** * Default algorithm for hashing */ @@ -41,7 +40,7 @@ class Hasher /** * The cost - * @var int + * @var int */ private $cost = self::DEFAULT_COST; @@ -134,4 +133,4 @@ public function info(string $hash): ?array { return password_get_info($hash); } -} \ No newline at end of file +} diff --git a/src/Libraries/HttpClient/Enums/ExceptionMessages.php b/src/Libraries/HttpClient/Enums/ExceptionMessages.php index 7c9c1fbc9..8c89d0924 100644 --- a/src/Libraries/HttpClient/Enums/ExceptionMessages.php +++ b/src/Libraries/HttpClient/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\HttpClient\Enums; @@ -22,5 +22,5 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const REQUEST_NOT_CREATED = 'Request is not created.'; -} \ No newline at end of file + public const REQUEST_NOT_CREATED = 'Request is not created.'; +} diff --git a/src/Libraries/HttpClient/Exceptions/HttpClientException.php b/src/Libraries/HttpClient/Exceptions/HttpClientException.php index cfaf8326c..dc9f3543d 100644 --- a/src/Libraries/HttpClient/Exceptions/HttpClientException.php +++ b/src/Libraries/HttpClient/Exceptions/HttpClientException.php @@ -25,7 +25,6 @@ */ class HttpClientException extends BaseException { - /** * @return HttpClientException */ @@ -37,4 +36,4 @@ public static function requestNotCreated(): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Libraries/HttpClient/HttpClient.php b/src/Libraries/HttpClient/HttpClient.php index 871f0b059..7542816f4 100644 --- a/src/Libraries/HttpClient/HttpClient.php +++ b/src/Libraries/HttpClient/HttpClient.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\HttpClient; @@ -33,26 +33,25 @@ */ class HttpClient { - /** * Available methods */ - const METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']; + public const METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']; /** * Response headers section */ - const RESPONSE_HEADERS = 'headers'; + public const RESPONSE_HEADERS = 'headers'; /** * Response cookies section */ - const RESPONSE_COOKIES = 'cookies'; + public const RESPONSE_COOKIES = 'cookies'; /** * Response body section */ - const RESPONSE_BODY = 'body'; + public const RESPONSE_BODY = 'body'; /** * @var MultiCurl|Curl @@ -360,14 +359,14 @@ private function handleResponse(Curl $instance) if ($instance->isError()) { $this->errors[$instance->getId()] = [ 'code' => $instance->getErrorCode(), - 'message' => $instance->getErrorMessage() + 'message' => $instance->getErrorMessage(), ]; } $this->response[$instance->getId()] = [ self::RESPONSE_HEADERS => $this->formatHeaders($instance->getResponseHeaders()), self::RESPONSE_COOKIES => $instance->getResponseCookies(), - self::RESPONSE_BODY => $instance->getResponse() + self::RESPONSE_BODY => $instance->getResponse(), ]; } @@ -418,4 +417,4 @@ private function interceptCall(string $method, array $arguments): void break; } } -} \ No newline at end of file +} diff --git a/src/Libraries/Jwt/Enums/ExceptionMessages.php b/src/Libraries/Jwt/Enums/ExceptionMessages.php index b1e8a608f..5b3f1b619 100644 --- a/src/Libraries/Jwt/Enums/ExceptionMessages.php +++ b/src/Libraries/Jwt/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Jwt\Enums; @@ -22,5 +22,5 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const MISSING_PAYLOAD = 'JWT payload is missing.'; -} \ No newline at end of file + public const MISSING_PAYLOAD = 'JWT payload is missing.'; +} diff --git a/src/Libraries/Jwt/Exceptions/JwtException.php b/src/Libraries/Jwt/Exceptions/JwtException.php index 0792fb1f4..3448a7066 100644 --- a/src/Libraries/Jwt/Exceptions/JwtException.php +++ b/src/Libraries/Jwt/Exceptions/JwtException.php @@ -25,7 +25,6 @@ */ class JwtException extends BaseException { - /** * @return JwtException */ @@ -36,4 +35,4 @@ public static function payloadNotFound(): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Jwt/JwtToken.php b/src/Libraries/Jwt/JwtToken.php index ea37a493d..16dda62f7 100644 --- a/src/Libraries/Jwt/JwtToken.php +++ b/src/Libraries/Jwt/JwtToken.php @@ -26,7 +26,6 @@ */ class JwtToken extends JWT { - /** * JWT secret key * @var string @@ -172,4 +171,4 @@ public function fetchClaim(string $key) { return $this->fetchedPayload->$key ?? null; } -} \ No newline at end of file +} diff --git a/src/Libraries/Lang/Enums/ExceptionMessages.php b/src/Libraries/Lang/Enums/ExceptionMessages.php index 904334cc6..665e5f0d3 100644 --- a/src/Libraries/Lang/Enums/ExceptionMessages.php +++ b/src/Libraries/Lang/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Lang\Enums; @@ -22,7 +22,7 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const TRANSLATION_FILES_NOT_FOUND = 'Translation files not found.'; + public const TRANSLATION_FILES_NOT_FOUND = 'Translation files not found.'; - const MISCONFIGURED_DEFAULT_LANG = 'Misconfigured lang default config.'; -} \ No newline at end of file + public const MISCONFIGURED_DEFAULT_LANG = 'Misconfigured lang default config.'; +} diff --git a/src/Libraries/Lang/Exceptions/LangException.php b/src/Libraries/Lang/Exceptions/LangException.php index 3bc696259..30ed55f43 100644 --- a/src/Libraries/Lang/Exceptions/LangException.php +++ b/src/Libraries/Lang/Exceptions/LangException.php @@ -25,7 +25,6 @@ */ class LangException extends BaseException { - /** * @return LangException */ @@ -47,4 +46,4 @@ public static function misconfiguredDefaultConfig(): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Lang/Factories/LangFactory.php b/src/Libraries/Lang/Factories/LangFactory.php index dad189f1e..6549f6a2f 100644 --- a/src/Libraries/Lang/Factories/LangFactory.php +++ b/src/Libraries/Lang/Factories/LangFactory.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Lang\Factories; @@ -29,7 +29,6 @@ */ class LangFactory { - /** * @var Lang|null Cached Lang instance */ @@ -144,4 +143,4 @@ private static function getLangFromHeader(array $supported): ?string return $acceptedLang && in_array($acceptedLang, $supported) ? $acceptedLang : null; } -} \ No newline at end of file +} diff --git a/src/Libraries/Lang/Helpers/lang.php b/src/Libraries/Lang/Helpers/lang.php index 6558cf3be..732285c8f 100644 --- a/src/Libraries/Lang/Helpers/lang.php +++ b/src/Libraries/Lang/Helpers/lang.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ use Quantum\Libraries\Lang\Exceptions\LangException; @@ -58,4 +58,4 @@ function t(string $key, $params = null): ?string function _t(string $key, $params = null) { echo t($key, $params); -} \ No newline at end of file +} diff --git a/src/Libraries/Lang/Lang.php b/src/Libraries/Lang/Lang.php index 3d95b2acf..87039c29c 100644 --- a/src/Libraries/Lang/Lang.php +++ b/src/Libraries/Lang/Lang.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Lang; @@ -25,19 +25,18 @@ */ class Lang { - /** - * @var string|null + * @var string|null */ private $currentLang = null; /** - * @var Translator + * @var Translator */ private $translator; /** - * @var bool + * @var bool */ private $isEnabled; @@ -113,4 +112,4 @@ public function flush(): void { $this->translator->flush(); } -} \ No newline at end of file +} diff --git a/src/Libraries/Lang/Translator.php b/src/Libraries/Lang/Translator.php index 86bff14b3..2c5686598 100644 --- a/src/Libraries/Lang/Translator.php +++ b/src/Libraries/Lang/Translator.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Lang; @@ -30,9 +30,8 @@ */ class Translator { - protected $lang; - + /** * @var Data|null */ @@ -62,11 +61,11 @@ public function loadTranslations(): void } $langDir = modules_dir() . DS . current_module() . DS . 'resources' . DS . 'lang' . DS . $this->lang; - $files = fs()->glob($langDir . DS . "*.php"); + $files = fs()->glob($langDir . DS . '*.php'); if (is_array($files) && !count($files)) { $langDir = base_dir() . DS . 'shared' . DS . 'resources' . DS . 'lang' . DS . $this->lang; - $files = fs()->glob($langDir . DS . "*.php"); + $files = fs()->glob($langDir . DS . '*.php'); if (is_array($files) && !count($files)) { throw LangException::translationsNotFound(); @@ -113,4 +112,4 @@ public function flush(): void { $this->translations = null; } -} \ No newline at end of file +} diff --git a/src/Libraries/Logger/Adapters/DailyAdapter.php b/src/Libraries/Logger/Adapters/DailyAdapter.php index 6701594d1..7f0477142 100644 --- a/src/Libraries/Logger/Adapters/DailyAdapter.php +++ b/src/Libraries/Logger/Adapters/DailyAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Logger\Adapters; @@ -29,7 +29,6 @@ */ class DailyAdapter implements ReportableInterface { - use LoggerTrait; /** @@ -60,4 +59,4 @@ protected function initialize(array $params): void $this->logFile = $params['path'] . DS . date('Y-m-d') . '.log'; } -} \ No newline at end of file +} diff --git a/src/Libraries/Logger/Adapters/MessageAdapter.php b/src/Libraries/Logger/Adapters/MessageAdapter.php index 147ec09b3..a2b7c3ea3 100644 --- a/src/Libraries/Logger/Adapters/MessageAdapter.php +++ b/src/Libraries/Logger/Adapters/MessageAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Logger\Adapters; @@ -24,7 +24,6 @@ */ class MessageAdapter implements ReportableInterface { - /** * @param string $level * @param $message @@ -43,4 +42,4 @@ public function report(string $level, $message, ?array $context = []) } } -} \ No newline at end of file +} diff --git a/src/Libraries/Logger/Adapters/SingleAdapter.php b/src/Libraries/Logger/Adapters/SingleAdapter.php index 163a59e89..7f99e32e5 100644 --- a/src/Libraries/Logger/Adapters/SingleAdapter.php +++ b/src/Libraries/Logger/Adapters/SingleAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Logger\Adapters; @@ -29,7 +29,6 @@ */ class SingleAdapter implements ReportableInterface { - use LoggerTrait; /** @@ -60,4 +59,4 @@ protected function initialize(array $params): void $this->logFile = $params['path']; } -} \ No newline at end of file +} diff --git a/src/Libraries/Logger/Contracts/ReportableInterface.php b/src/Libraries/Logger/Contracts/ReportableInterface.php index f7dbbf6cc..095ee2ddc 100644 --- a/src/Libraries/Logger/Contracts/ReportableInterface.php +++ b/src/Libraries/Logger/Contracts/ReportableInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Logger\Contracts; @@ -20,7 +20,6 @@ */ interface ReportableInterface { - /** * Reports the message * @param string $level @@ -29,4 +28,4 @@ interface ReportableInterface */ public function report(string $level, $message, ?array $context = []); -} \ No newline at end of file +} diff --git a/src/Libraries/Logger/Enums/ExceptionMessages.php b/src/Libraries/Logger/Enums/ExceptionMessages.php index 9d8a65632..cb814e7e4 100644 --- a/src/Libraries/Logger/Enums/ExceptionMessages.php +++ b/src/Libraries/Logger/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Logger\Enums; @@ -22,7 +22,7 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const LOG_PATH_NOT_DIRECTORY = 'Log path is not point to a directory.'; + public const LOG_PATH_NOT_DIRECTORY = 'Log path is not point to a directory.'; - const LOG_PATH_NOT_FILE = 'Log path is not point to a file.'; -} \ No newline at end of file + public const LOG_PATH_NOT_FILE = 'Log path is not point to a file.'; +} diff --git a/src/Libraries/Logger/Exceptions/LoggerException.php b/src/Libraries/Logger/Exceptions/LoggerException.php index b229dd195..f42a774fc 100644 --- a/src/Libraries/Logger/Exceptions/LoggerException.php +++ b/src/Libraries/Logger/Exceptions/LoggerException.php @@ -25,7 +25,6 @@ */ class LoggerException extends BaseException { - /** * @param string $name * @return LoggerException @@ -49,4 +48,4 @@ public static function logPathIsNotFile(string $name): self E_ERROR ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Logger/Factories/LoggerFactory.php b/src/Libraries/Logger/Factories/LoggerFactory.php index 634716879..95325e790 100644 --- a/src/Libraries/Logger/Factories/LoggerFactory.php +++ b/src/Libraries/Logger/Factories/LoggerFactory.php @@ -32,11 +32,10 @@ */ class LoggerFactory { - /** * Supported adapters */ - const ADAPTERS = [ + public const ADAPTERS = [ Logger::SINGLE => SingleAdapter::class, Logger::DAILY => DailyAdapter::class, Logger::MESSAGE => MessageAdapter::class, @@ -107,4 +106,4 @@ private static function getAdapterClass(string $adapter): string return self::ADAPTERS[$adapter]; } -} \ No newline at end of file +} diff --git a/src/Libraries/Logger/Helpers/logger.php b/src/Libraries/Logger/Helpers/logger.php index a930edece..a64077b72 100644 --- a/src/Libraries/Logger/Helpers/logger.php +++ b/src/Libraries/Logger/Helpers/logger.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\Libraries\Logger\Factories\LoggerFactory; @@ -104,4 +104,4 @@ function info($var, array $context = []) function debug($var, array $context = []) { LoggerFactory::get()->debug($var, $context); -} \ No newline at end of file +} diff --git a/src/Libraries/Logger/Logger.php b/src/Libraries/Logger/Logger.php index 6ce139bc4..10016fc38 100644 --- a/src/Libraries/Logger/Logger.php +++ b/src/Libraries/Logger/Logger.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.6 + * @since 3.0.0 */ namespace Quantum\Libraries\Logger; @@ -24,22 +24,20 @@ */ class Logger implements LoggerInterface { - /** * Single logger adapter */ - const SINGLE = 'single'; - + public const SINGLE = 'single'; /** * Daily logger adapter */ - const DAILY = 'daily'; + public const DAILY = 'daily'; /** * Message logger adapter */ - const MESSAGE = 'message'; + public const MESSAGE = 'message'; /** * @var ReportableInterface @@ -135,4 +133,4 @@ public function log($level, $message, array $context = []) $this->adapter->report($level, $message, $context); } } -} \ No newline at end of file +} diff --git a/src/Libraries/Logger/LoggerConfig.php b/src/Libraries/Logger/LoggerConfig.php index c59ed3cbd..1a232002a 100644 --- a/src/Libraries/Logger/LoggerConfig.php +++ b/src/Libraries/Logger/LoggerConfig.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Logger; @@ -23,7 +23,7 @@ class LoggerConfig /** * Log levels mapped to integer values. */ - const LOG_LEVELS = [ + public const LOG_LEVELS = [ 'debug' => 100, 'info' => 200, 'notice' => 250, @@ -37,7 +37,7 @@ class LoggerConfig /** * Default log level. */ - const DEFAULT_LOG_LEVEL = 'error'; + public const DEFAULT_LOG_LEVEL = 'error'; /** * @var string @@ -74,4 +74,4 @@ public static function getLogLevel(string $errorType): int { return self::LOG_LEVELS[$errorType] ?? self::LOG_LEVELS[self::DEFAULT_LOG_LEVEL]; } -} \ No newline at end of file +} diff --git a/src/Libraries/Logger/Traits/LoggerTrait.php b/src/Libraries/Logger/Traits/LoggerTrait.php index 91c9b4e99..0ddf4fd9d 100644 --- a/src/Libraries/Logger/Traits/LoggerTrait.php +++ b/src/Libraries/Logger/Traits/LoggerTrait.php @@ -9,10 +9,9 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ - namespace Quantum\Libraries\Logger\Traits; use Quantum\Libraries\Logger\Exceptions\LoggerException; @@ -24,7 +23,6 @@ */ trait LoggerTrait { - /** * @var FileSystem */ @@ -64,11 +62,11 @@ public function report(string $level, $message, ?array $context = []): void protected function formatMessage(string $level, $message, ?array $context = []): string { return sprintf( - "[%s] %s: %s%s", + '[%s] %s: %s%s', date('Y-m-d H:i:s'), ucfirst($level), is_array($message) ? json_encode($message, JSON_PRETTY_PRINT) : $message, isset($context['trace']) ? (PHP_EOL . $context['trace'] . PHP_EOL) : PHP_EOL ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Mailer/Adapters/MailgunAdapter.php b/src/Libraries/Mailer/Adapters/MailgunAdapter.php index 028f8c96e..6a2c97da7 100644 --- a/src/Libraries/Mailer/Adapters/MailgunAdapter.php +++ b/src/Libraries/Mailer/Adapters/MailgunAdapter.php @@ -25,7 +25,6 @@ */ class MailgunAdapter implements MailerInterface { - use MailerTrait; /** @@ -70,7 +69,7 @@ public function __construct(array $params) */ private function prepare() { - $this->data['from'] = $this->from['name'] . " " . $this->from['email']; + $this->data['from'] = $this->from['name'] . ' ' . $this->from['email']; $to = []; foreach ($this->addresses as $address) { @@ -90,7 +89,7 @@ private function prepare() $body = is_array($this->message) ? implode('', $this->message) : $this->message; } - $this->data['html'] = trim(str_replace("\n", "", $body)); + $this->data['html'] = trim(str_replace("\n", '', $body)); } } @@ -105,7 +104,7 @@ private function sendEmail(): bool ->setMethod('POST') ->setHeaders([ 'Authorization' => 'Basic ' . base64_encode('api:' . $this->apiKey), - 'Content-Type' => 'application/x-www-form-urlencoded' + 'Content-Type' => 'application/x-www-form-urlencoded', ]) ->setData(json_encode($this->data)) ->start(); @@ -115,4 +114,4 @@ private function sendEmail(): bool return false; } } -} \ No newline at end of file +} diff --git a/src/Libraries/Mailer/Adapters/MandrillAdapter.php b/src/Libraries/Mailer/Adapters/MandrillAdapter.php index 2b9ae326b..ed958cb80 100644 --- a/src/Libraries/Mailer/Adapters/MandrillAdapter.php +++ b/src/Libraries/Mailer/Adapters/MandrillAdapter.php @@ -25,7 +25,6 @@ */ class MandrillAdapter implements MailerInterface { - use MailerTrait; /** @@ -85,7 +84,7 @@ private function prepare() $body = is_array($this->message) ? implode('', $this->message) : $this->message; } - $message['html'] = trim(str_replace("\n", "", $body)); + $message['html'] = trim(str_replace("\n", '', $body)); } $this->data['message'] = $message; @@ -108,4 +107,4 @@ private function sendEmail(): bool return false; } } -} \ No newline at end of file +} diff --git a/src/Libraries/Mailer/Adapters/SendgridAdapter.php b/src/Libraries/Mailer/Adapters/SendgridAdapter.php index e2fc13163..22ccf6e40 100644 --- a/src/Libraries/Mailer/Adapters/SendgridAdapter.php +++ b/src/Libraries/Mailer/Adapters/SendgridAdapter.php @@ -25,7 +25,6 @@ */ class SendgridAdapter implements MailerInterface { - use MailerTrait; /** @@ -72,7 +71,7 @@ public function prepare() $this->data['from'] = $this->from; $this->data['personalizations'] = [ - ['to' => $this->addresses] + ['to' => $this->addresses], ]; if ($this->subject) { @@ -89,8 +88,8 @@ public function prepare() $this->data['content'] = [ [ 'type' => 'text/html', - 'value' => trim(str_replace("\n", "", $body)) - ] + 'value' => trim(str_replace("\n", '', $body)), + ], ]; } } @@ -106,7 +105,7 @@ private function sendEmail(): bool ->setMethod('POST') ->setHeaders([ 'Authorization' => 'Bearer ' . $this->apiKey, - 'Content-Type' => 'application/json' + 'Content-Type' => 'application/json', ]) ->setData(json_encode($this->data)) ->start(); @@ -116,4 +115,4 @@ private function sendEmail(): bool return false; } } -} \ No newline at end of file +} diff --git a/src/Libraries/Mailer/Adapters/SendinblueAdapter.php b/src/Libraries/Mailer/Adapters/SendinblueAdapter.php index 7abf44940..f3b4417ab 100644 --- a/src/Libraries/Mailer/Adapters/SendinblueAdapter.php +++ b/src/Libraries/Mailer/Adapters/SendinblueAdapter.php @@ -25,7 +25,6 @@ */ class SendinblueAdapter implements MailerInterface { - use MailerTrait; /** @@ -83,7 +82,7 @@ private function prepare() $body = is_array($this->message) ? implode('', $this->message) : $this->message; } - $this->data['htmlContent'] = trim(str_replace("\n", "", $body)); + $this->data['htmlContent'] = trim(str_replace("\n", '', $body)); } } @@ -99,7 +98,7 @@ private function sendEmail(): bool ->setHeaders([ 'Accept' => 'application/json', 'Content-type' => 'application/json', - 'api-key' => $this->apiKey + 'api-key' => $this->apiKey, ]) ->setData(json_encode($this->data)) ->start(); @@ -109,4 +108,4 @@ private function sendEmail(): bool return false; } } -} \ No newline at end of file +} diff --git a/src/Libraries/Mailer/Adapters/SmtpAdapter.php b/src/Libraries/Mailer/Adapters/SmtpAdapter.php index b3de08fb9..850cd4a32 100644 --- a/src/Libraries/Mailer/Adapters/SmtpAdapter.php +++ b/src/Libraries/Mailer/Adapters/SmtpAdapter.php @@ -27,7 +27,6 @@ */ class SmtpAdapter implements MailerInterface { - use MailerTrait; /** @@ -101,7 +100,7 @@ public function setReplay(string $email, ?string $name = null): SmtpAdapter { $this->replyToAddresses[] = [ 'email' => $email, - 'name' => $name + 'name' => $name, ]; return $this; @@ -126,7 +125,7 @@ public function setCC(string $email, ?string $name = null): SmtpAdapter { $this->ccAddresses[] = [ 'email' => $email, - 'name' => $name + 'name' => $name, ]; return $this; @@ -151,7 +150,7 @@ public function setBCC(string $email, ?string $name = null): SmtpAdapter { $this->bccAddresses[] = [ 'email' => $email, - 'name' => $name + 'name' => $name, ]; return $this; @@ -173,7 +172,8 @@ public function getBCCs(): array */ public function setAttachment(string $attachment): SmtpAdapter { - $this->attachments[] = $attachment;; + $this->attachments[] = $attachment; + ; return $this; } @@ -196,7 +196,7 @@ public function setStringAttachment(string $content, string $filename): SmtpAdap { $this->stringAttachments[] = [ 'content' => $content, - 'filename' => $filename + 'filename' => $filename, ]; return $this; @@ -245,7 +245,7 @@ private function prepare() $body = is_array($this->message) ? implode('', $this->message) : $this->message; } - $this->mailer->Body = trim(str_replace("\n", "", $body)); + $this->mailer->Body = trim(str_replace("\n", '', $body)); } $this->fillProperties('addAddress', $this->addresses); @@ -286,4 +286,4 @@ private function sendEmail(): bool { return $this->mailer->send(); } -} \ No newline at end of file +} diff --git a/src/Libraries/Mailer/Contracts/MailerInterface.php b/src/Libraries/Mailer/Contracts/MailerInterface.php index acdd26907..a0ffe9ffe 100644 --- a/src/Libraries/Mailer/Contracts/MailerInterface.php +++ b/src/Libraries/Mailer/Contracts/MailerInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Mailer\Contracts; @@ -20,7 +20,6 @@ */ interface MailerInterface { - /** * Sets the 'From' email and the name * @param string $email @@ -93,4 +92,4 @@ public function getBody(); * @return bool */ public function send(): bool; -} \ No newline at end of file +} diff --git a/src/Libraries/Mailer/Exceptions/MailerException.php b/src/Libraries/Mailer/Exceptions/MailerException.php index 9c0d23ea5..57a38003c 100644 --- a/src/Libraries/Mailer/Exceptions/MailerException.php +++ b/src/Libraries/Mailer/Exceptions/MailerException.php @@ -11,7 +11,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Mailer\Exceptions; @@ -24,5 +24,4 @@ */ class MailerException extends BaseException { - -} \ No newline at end of file +} diff --git a/src/Libraries/Mailer/Factories/MailerFactory.php b/src/Libraries/Mailer/Factories/MailerFactory.php index f57850cbd..1307a5137 100644 --- a/src/Libraries/Mailer/Factories/MailerFactory.php +++ b/src/Libraries/Mailer/Factories/MailerFactory.php @@ -33,11 +33,10 @@ */ class MailerFactory { - /** * Supported adapters */ - const ADAPTERS = [ + public const ADAPTERS = [ Mailer::SMTP => SmtpAdapter::class, Mailer::MAILGUN => MailgunAdapter::class, Mailer::MANDRILL => MandrillAdapter::class, @@ -98,4 +97,4 @@ private static function getAdapterClass(string $adapter): string return self::ADAPTERS[$adapter]; } -} \ No newline at end of file +} diff --git a/src/Libraries/Mailer/Helpers/mailer.php b/src/Libraries/Mailer/Helpers/mailer.php index 43ec30483..45d4ad382 100644 --- a/src/Libraries/Mailer/Helpers/mailer.php +++ b/src/Libraries/Mailer/Helpers/mailer.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\Libraries\Mailer\Factories\MailerFactory; @@ -29,4 +29,4 @@ function mailer(?string $adapter = null): Mailer { return MailerFactory::get($adapter); -} \ No newline at end of file +} diff --git a/src/Libraries/Mailer/MailTrap.php b/src/Libraries/Mailer/MailTrap.php index b818ae155..a063fca74 100644 --- a/src/Libraries/Mailer/MailTrap.php +++ b/src/Libraries/Mailer/MailTrap.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Libraries\Mailer; @@ -31,7 +31,6 @@ */ class MailTrap { - /** * @var FileSystem */ @@ -258,10 +257,10 @@ public function getParsedAttachments(): ?array $attachments[] = [ 'filename' => $parsedAttachment->getHeaderAttribute('content-disposition', 'filename'), 'content-type' => $parsedAttachment->getHeaderValue('content-type'), - 'content' => $parsedAttachment->getContents() + 'content' => $parsedAttachment->getContents(), ]; } return $attachments; } -} \ No newline at end of file +} diff --git a/src/Libraries/Mailer/Mailer.php b/src/Libraries/Mailer/Mailer.php index c449d4869..82ea97e0a 100644 --- a/src/Libraries/Mailer/Mailer.php +++ b/src/Libraries/Mailer/Mailer.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Mailer; @@ -35,31 +35,30 @@ */ class Mailer { - /** * SMTP adapter */ - const SMTP = 'smtp'; + public const SMTP = 'smtp'; /** * Mailgun adapter */ - const MAILGUN = 'mailgun'; + public const MAILGUN = 'mailgun'; /** * Mandrill adapter */ - const MANDRILL = 'mandrill'; + public const MANDRILL = 'mandrill'; /** * Sendgrid adapter */ - const SENDGRID = 'sendgrid'; + public const SENDGRID = 'sendgrid'; /** * Sendinblue adapter */ - const SENDINBLUE = 'sendinblue'; + public const SENDINBLUE = 'sendinblue'; /** * @var MailerInterface @@ -96,4 +95,4 @@ public function __call(string $method, ?array $arguments) return $this->adapter->$method(...$arguments); } -} \ No newline at end of file +} diff --git a/src/Libraries/Mailer/Traits/MailerTrait.php b/src/Libraries/Mailer/Traits/MailerTrait.php index 44f186955..8c5b417c6 100644 --- a/src/Libraries/Mailer/Traits/MailerTrait.php +++ b/src/Libraries/Mailer/Traits/MailerTrait.php @@ -29,7 +29,6 @@ */ trait MailerTrait { - /** * From address and name * @var array @@ -137,7 +136,7 @@ public function setAddress(string $email, ?string $name = null): MailerInterface { $this->addresses[] = [ 'email' => $email, - 'name' => $name + 'name' => $name, ]; return $this; @@ -359,4 +358,4 @@ private function resetFields() $this->mailer->clearCustomHeaders(); } } -} \ No newline at end of file +} diff --git a/src/Libraries/ResourceCache/Exceptions/ResourceCacheException.php b/src/Libraries/ResourceCache/Exceptions/ResourceCacheException.php index 31e04eda1..3246329b8 100644 --- a/src/Libraries/ResourceCache/Exceptions/ResourceCacheException.php +++ b/src/Libraries/ResourceCache/Exceptions/ResourceCacheException.php @@ -11,7 +11,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\ResourceCache\Exceptions; @@ -24,5 +24,4 @@ */ class ResourceCacheException extends BaseException { - -} \ No newline at end of file +} diff --git a/src/Libraries/ResourceCache/ViewCache.php b/src/Libraries/ResourceCache/ViewCache.php index 095d18649..6b1414ac7 100644 --- a/src/Libraries/ResourceCache/ViewCache.php +++ b/src/Libraries/ResourceCache/ViewCache.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\ResourceCache; @@ -33,7 +33,6 @@ */ class ViewCache { - /** * @var string */ @@ -296,4 +295,4 @@ protected function htmlMinifierExists(): bool { return class_exists(HtmlMin::class); } -} \ No newline at end of file +} diff --git a/src/Libraries/Session/Adapters/Database/DatabaseHandler.php b/src/Libraries/Session/Adapters/Database/DatabaseHandler.php index ba52d0b1e..557348db9 100644 --- a/src/Libraries/Session/Adapters/Database/DatabaseHandler.php +++ b/src/Libraries/Session/Adapters/Database/DatabaseHandler.php @@ -23,7 +23,6 @@ */ class DatabaseHandler implements SessionHandlerInterface { - /** * @var DbalInterface */ @@ -108,4 +107,4 @@ public function gc($max_lifetime) return 0; } -} \ No newline at end of file +} diff --git a/src/Libraries/Session/Adapters/Database/DatabaseSessionAdapter.php b/src/Libraries/Session/Adapters/Database/DatabaseSessionAdapter.php index 05018cf0f..cdd978865 100644 --- a/src/Libraries/Session/Adapters/Database/DatabaseSessionAdapter.php +++ b/src/Libraries/Session/Adapters/Database/DatabaseSessionAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Libraries\Session\Adapters\Database; @@ -25,13 +25,12 @@ */ class DatabaseSessionAdapter implements SessionStorageInterface { - use SessionTrait; /** * Session default table */ - const SESSION_TABLE = 'sessions'; + public const SESSION_TABLE = 'sessions'; /** * Session params @@ -76,4 +75,4 @@ protected function initializeSession(?array $params = null): void self::$params = $params; self::$storage = &$_SESSION; } -} \ No newline at end of file +} diff --git a/src/Libraries/Session/Adapters/Native/NativeSessionAdapter.php b/src/Libraries/Session/Adapters/Native/NativeSessionAdapter.php index 426d18c28..93eed5882 100644 --- a/src/Libraries/Session/Adapters/Native/NativeSessionAdapter.php +++ b/src/Libraries/Session/Adapters/Native/NativeSessionAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Session\Adapters\Native; @@ -24,13 +24,12 @@ */ class NativeSessionAdapter implements SessionStorageInterface { - use SessionTrait; /** * Session default timeout */ - const SESSION_TIMEOUT = 30 * 60; + public const SESSION_TIMEOUT = 30 * 60; /** * Session params @@ -75,4 +74,4 @@ protected function initializeSession(?array $params = null): void self::$params = $params; self::$storage = &$_SESSION; } -} \ No newline at end of file +} diff --git a/src/Libraries/Session/Contracts/SessionStorageInterface.php b/src/Libraries/Session/Contracts/SessionStorageInterface.php index c6c509df9..7309cc0ea 100644 --- a/src/Libraries/Session/Contracts/SessionStorageInterface.php +++ b/src/Libraries/Session/Contracts/SessionStorageInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Session\Contracts; @@ -22,7 +22,6 @@ */ interface SessionStorageInterface extends StorageInterface { - /** * Gets flash value by given key * @param string $key @@ -48,4 +47,4 @@ public function getId(): ?string; * @return bool */ public function regenerateId(): bool; -} \ No newline at end of file +} diff --git a/src/Libraries/Session/Enums/ExceptionMessages.php b/src/Libraries/Session/Enums/ExceptionMessages.php index 446ef5503..3a5b8c9e0 100644 --- a/src/Libraries/Session/Enums/ExceptionMessages.php +++ b/src/Libraries/Session/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Session\Enums; @@ -22,7 +22,7 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const SESSION_NOT_STARTED = 'Can not start the session.'; + public const SESSION_NOT_STARTED = 'Can not start the session.'; - const SESSION_NOT_DESTROYED = 'Can not destroy the session.'; -} \ No newline at end of file + public const SESSION_NOT_DESTROYED = 'Can not destroy the session.'; +} diff --git a/src/Libraries/Session/Exceptions/SessionException.php b/src/Libraries/Session/Exceptions/SessionException.php index 9486eb3ff..9e53463b2 100644 --- a/src/Libraries/Session/Exceptions/SessionException.php +++ b/src/Libraries/Session/Exceptions/SessionException.php @@ -46,4 +46,4 @@ public static function sessionNotDestroyed(): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Session/Factories/SessionFactory.php b/src/Libraries/Session/Factories/SessionFactory.php index 569226fef..bda0360a9 100644 --- a/src/Libraries/Session/Factories/SessionFactory.php +++ b/src/Libraries/Session/Factories/SessionFactory.php @@ -30,11 +30,10 @@ */ class SessionFactory { - /** * Supported adapters */ - const ADAPTERS = [ + public const ADAPTERS = [ Session::NATIVE => NativeSessionAdapter::class, Session::DATABASE => DatabaseSessionAdapter::class, ]; @@ -92,4 +91,4 @@ private static function getAdapterClass(string $adapter): string return self::ADAPTERS[$adapter]; } -} \ No newline at end of file +} diff --git a/src/Libraries/Session/Helpers/session.php b/src/Libraries/Session/Helpers/session.php index f50df6a8c..517329c05 100644 --- a/src/Libraries/Session/Helpers/session.php +++ b/src/Libraries/Session/Helpers/session.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\Libraries\Session\Factories\SessionFactory; @@ -29,4 +29,4 @@ function session(?string $adapter = null): Session { return SessionFactory::get($adapter); -} \ No newline at end of file +} diff --git a/src/Libraries/Session/Session.php b/src/Libraries/Session/Session.php index fe7d66647..d429fef6e 100644 --- a/src/Libraries/Session/Session.php +++ b/src/Libraries/Session/Session.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Session; @@ -34,16 +34,15 @@ */ class Session { - /** * Native session adapter */ - const NATIVE = 'native'; + public const NATIVE = 'native'; /** * Database session adapter */ - const DATABASE = 'database'; + public const DATABASE = 'database'; /** * @var SessionStorageInterface @@ -80,4 +79,4 @@ public function __call(string $method, ?array $arguments) return $this->adapter->$method(...$arguments); } -} \ No newline at end of file +} diff --git a/src/Libraries/Session/Traits/SessionTrait.php b/src/Libraries/Session/Traits/SessionTrait.php index b7fd64064..ee0973a78 100644 --- a/src/Libraries/Session/Traits/SessionTrait.php +++ b/src/Libraries/Session/Traits/SessionTrait.php @@ -22,7 +22,6 @@ */ trait SessionTrait { - /** * @inheritDoc */ @@ -132,4 +131,4 @@ public function regenerateId(): bool return $result; } -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Adapters/Dropbox/DropboxApp.php b/src/Libraries/Storage/Adapters/Dropbox/DropboxApp.php index 80c7c2c18..18c3b391d 100644 --- a/src/Libraries/Storage/Adapters/Dropbox/DropboxApp.php +++ b/src/Libraries/Storage/Adapters/Dropbox/DropboxApp.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Storage\Adapters\Dropbox; @@ -31,78 +31,77 @@ */ class DropboxApp implements CloudAppInterface { - use CloudAppTrait; /** * Authorization URL */ - const AUTH_URL = 'https://dropbox.com/oauth2/authorize'; + public const AUTH_URL = 'https://dropbox.com/oauth2/authorize'; /** * Token URL */ - const AUTH_TOKEN_URL = 'https://api.dropboxapi.com/oauth2/token'; + public const AUTH_TOKEN_URL = 'https://api.dropboxapi.com/oauth2/token'; /** * URL for remote procedure call endpoints */ - const RPC_API_URL = 'https://api.dropboxapi.com/2'; + public const RPC_API_URL = 'https://api.dropboxapi.com/2'; /** * URL for content endpoints */ - const CONTENT_API_URL = 'https://content.dropboxapi.com/2'; + public const CONTENT_API_URL = 'https://content.dropboxapi.com/2'; /** * Create folder endpoint */ - const ENDPOINT_CREATE_FOLDER = 'files/create_folder_v2'; + public const ENDPOINT_CREATE_FOLDER = 'files/create_folder_v2'; /** * Delete file endpoint */ - const ENDPOINT_DELETE_FILE = 'files/delete_v2'; + public const ENDPOINT_DELETE_FILE = 'files/delete_v2'; /** * Download file endpoint */ - const ENDPOINT_DOWNLOAD_FILE = 'files/download'; + public const ENDPOINT_DOWNLOAD_FILE = 'files/download'; /** * Upload file endpoint */ - const ENDPOINT_UPLOAD_FILE = 'files/upload'; + public const ENDPOINT_UPLOAD_FILE = 'files/upload'; /** * Move file endpoint */ - const ENDPOINT_MOVE_FILE = 'files/move_v2'; + public const ENDPOINT_MOVE_FILE = 'files/move_v2'; /** * Copy file endpoint */ - const ENDPOINT_COPY_FILE = 'files/copy_v2'; + public const ENDPOINT_COPY_FILE = 'files/copy_v2'; /** * Get metadata for file endpoint */ - const ENDPOINT_FILE_METADATA = 'files/get_metadata'; + public const ENDPOINT_FILE_METADATA = 'files/get_metadata'; /** * List folder endpoint */ - const ENDPOINT_LIST_FOLDER = 'files/list_folder'; + public const ENDPOINT_LIST_FOLDER = 'files/list_folder'; /** * Access token status indicating it needs refresh */ - const ACCESS_TOKEN_STATUS = ['invalid_access_token', 'expired_access_token']; + public const ACCESS_TOKEN_STATUS = ['invalid_access_token', 'expired_access_token']; /** * Error code for invalid token */ - const INVALID_TOKEN_ERROR_CODE = 401; + public const INVALID_TOKEN_ERROR_CODE = 401; /** * @var HttpClient @@ -203,7 +202,7 @@ private function fetchAccessTokenByRefreshToken(string $refreshToken): string 'refresh_token' => $refreshToken, 'grant_type' => 'refresh_token', 'client_id' => $this->appKey, - 'client_secret' => $this->appSecret + 'client_secret' => $this->appSecret, ]; $tokenUrl = self::AUTH_TOKEN_URL . '?' . http_build_query($params, '', '&'); @@ -226,7 +225,7 @@ public function rpcRequest(string $endpoint, ?array $params = []) { $headers = [ 'Authorization' => 'Bearer ' . $this->tokenService->getAccessToken(), - 'Content-Type' => 'application/json' + 'Content-Type' => 'application/json', ]; return $this->sendRequest(self::RPC_API_URL . '/' . $endpoint, $params, $headers); @@ -245,7 +244,7 @@ public function contentRequest(string $endpoint, array $params, string $content $headers = [ 'Authorization' => 'Bearer ' . $this->tokenService->getAccessToken(), 'Dropbox-API-Arg' => json_encode($params), - 'Content-Type' => 'application/octet-stream' + 'Content-Type' => 'application/octet-stream', ]; return $this->sendRequest(self::CONTENT_API_URL . '/' . $endpoint, $content, $headers); @@ -273,7 +272,7 @@ private function accessTokenNeedsRefresh(int $code, ?object $message = null): bo return false; } - if(isset($message->error)) { + if (isset($message->error)) { $error = (array)$message->error; if (!isset($error['.tag']) && !in_array($error['.tag'], self::ACCESS_TOKEN_STATUS)) { @@ -283,4 +282,4 @@ private function accessTokenNeedsRefresh(int $code, ?object $message = null): bo return true; } -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Adapters/Dropbox/DropboxFileSystemAdapter.php b/src/Libraries/Storage/Adapters/Dropbox/DropboxFileSystemAdapter.php index 70d88ed25..9f41f5733 100644 --- a/src/Libraries/Storage/Adapters/Dropbox/DropboxFileSystemAdapter.php +++ b/src/Libraries/Storage/Adapters/Dropbox/DropboxFileSystemAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Storage\Adapters\Dropbox; @@ -23,7 +23,6 @@ */ class DropboxFileSystemAdapter implements FilesystemAdapterInterface { - /** * @var DropboxApp */ @@ -81,8 +80,11 @@ public function get(string $filename) public function put(string $filename, string $content, ?string $parentId = null) { try { - $response = $this->dropboxApp->contentRequest(DropboxApp::ENDPOINT_UPLOAD_FILE, - ['path' => '/' . $filename, 'mode' => 'overwrite'], $content); + $response = $this->dropboxApp->contentRequest( + DropboxApp::ENDPOINT_UPLOAD_FILE, + ['path' => '/' . $filename, 'mode' => 'overwrite'], + $content + ); return $response->size; @@ -109,7 +111,7 @@ public function rename(string $oldName, string $newName): bool try { $this->dropboxApp->rpcRequest(DropboxApp::ENDPOINT_MOVE_FILE, [ 'from_path' => $this->dropboxApp->path($oldName), - 'to_path' => $this->dropboxApp->path($newName) + 'to_path' => $this->dropboxApp->path($newName), ]); return true; @@ -223,4 +225,4 @@ public function listDirectory(string $dirname) return false; } } -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveApp.php b/src/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveApp.php index 37816f2ab..e8253acb0 100644 --- a/src/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveApp.php +++ b/src/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveApp.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Storage\Adapters\GoogleDrive; @@ -29,48 +29,47 @@ */ class GoogleDriveApp implements CloudAppInterface { - use CloudAppTrait; /** * Authorization URL */ - const AUTH_URL = 'https://accounts.google.com/o/oauth2/v2/auth'; + public const AUTH_URL = 'https://accounts.google.com/o/oauth2/v2/auth'; /** * Authorization scope */ - const AUTH_SCOPE = 'https://www.googleapis.com/auth/drive'; + public const AUTH_SCOPE = 'https://www.googleapis.com/auth/drive'; /** * Token URL */ - const AUTH_TOKEN_URL = 'https://oauth2.googleapis.com/token'; + public const AUTH_TOKEN_URL = 'https://oauth2.googleapis.com/token'; /** * URL for file metadata operations */ - const FILE_METADATA_URL = 'https://www.googleapis.com/drive/v3/files'; + public const FILE_METADATA_URL = 'https://www.googleapis.com/drive/v3/files'; /** * URL for file media operations */ - const FILE_MEDIA_URL = 'https://www.googleapis.com/upload/drive/v3/files'; + public const FILE_MEDIA_URL = 'https://www.googleapis.com/upload/drive/v3/files'; /** * Folder mimetype */ - const FOLDER_MIMETYPE = 'application/vnd.google-apps.folder'; + public const FOLDER_MIMETYPE = 'application/vnd.google-apps.folder'; /** * Kind/Type of drive file */ - const DRIVE_FILE_KIND = 'drive#file'; + public const DRIVE_FILE_KIND = 'drive#file'; /** * Error code for invalid token */ - const INVALID_TOKEN_ERROR_CODE = 401; + public const INVALID_TOKEN_ERROR_CODE = 401; /** * @var HttpClient @@ -116,7 +115,7 @@ public function __construct(string $appKey, string $appSecret, TokenServiceInter * @throws CryptorException * @throws DatabaseException */ - public function getAuthUrl(string $redirectUrl, string $accessType = "offline"): string + public function getAuthUrl(string $redirectUrl, string $accessType = 'offline'): string { $params = [ 'client_id' => $this->appKey, @@ -144,7 +143,7 @@ public function fetchTokens(string $code, string $redirectUrl = ''): ?object 'grant_type' => 'authorization_code', 'client_id' => $this->appKey, 'client_secret' => $this->appSecret, - 'redirect_uri' => $redirectUrl + 'redirect_uri' => $redirectUrl, ]; $response = $this->sendRequest(self::AUTH_TOKEN_URL, $params); @@ -166,7 +165,7 @@ private function fetchAccessTokenByRefreshToken(string $refreshToken): string 'refresh_token' => $refreshToken, 'grant_type' => 'refresh_token', 'client_id' => $this->appKey, - 'client_secret' => $this->appSecret + 'client_secret' => $this->appSecret, ]; $response = $this->sendRequest(self::AUTH_TOKEN_URL, $params); @@ -190,10 +189,10 @@ public function rpcRequest(string $url, $params = [], string $method = 'POST', s try { $headers = [ 'Authorization' => 'Bearer ' . $this->tokenService->getAccessToken(), - 'Content-Type' => $contentType + 'Content-Type' => $contentType, ]; return $this->sendRequest($url, $params, $headers, $method); - }catch (Exception $e){ + } catch (Exception $e) { throw new Exception($e->getMessage(), (int)$e->getCode(), $e); } } @@ -206,7 +205,8 @@ public function rpcRequest(string $url, $params = [], string $method = 'POST', s * @return mixed|null * @throws Exception */ - public function getFileInfo(string $fileId, bool $media = false, array $params = []){ + public function getFileInfo(string $fileId, bool $media = false, array $params = []) + { $queryParam = $media ? '?alt=media' : '?fields=*'; return $this->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '/' . $fileId . $queryParam, $params, 'GET'); } @@ -221,4 +221,4 @@ private function accessTokenNeedsRefresh(int $code, ?object $message = null): bo { return $code === self::INVALID_TOKEN_ERROR_CODE; } -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveFileSystemAdapter.php b/src/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveFileSystemAdapter.php index f666de553..c232880b7 100644 --- a/src/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveFileSystemAdapter.php +++ b/src/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveFileSystemAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Storage\Adapters\GoogleDrive; @@ -23,7 +23,6 @@ */ class GoogleDriveFileSystemAdapter implements FilesystemAdapterInterface { - /** * @var GoogleDriveApp */ @@ -42,11 +41,11 @@ public function __construct(GoogleDriveApp $googleDriveApp) */ public function makeDirectory(string $dirname, ?string $parentId = null): bool { - try{ + try { $data = [ 'name' => $dirname, 'mimeType' => GoogleDriveApp::FOLDER_MIMETYPE, - 'parents' => $parentId ? [$parentId] : ['root'] + 'parents' => $parentId ? [$parentId] : ['root'], ]; $this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_METADATA_URL, $data); @@ -86,7 +85,7 @@ public function put(string $filename, string $content, ?string $parentId = null) $fileId = $filename; } else { $data = [ - 'name' => $filename, + 'name' => $filename, 'parents' => $parentId ? [$parentId] : ['root'], ]; @@ -131,7 +130,7 @@ public function rename(string $oldName, string $newName): bool { try { $data = [ - 'name' => $newName + 'name' => $newName, ]; $this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '/' . $oldName, $data, 'PATCH'); @@ -148,7 +147,7 @@ public function copy(string $source, string $dest = 'root'): bool { try { $data = [ - 'parents' => [$dest] + 'parents' => [$dest], ]; $this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '/' . $source . '/copy', $data); @@ -243,12 +242,12 @@ public function listDirectory(string $dirname) try { $params = [ 'q' => "'$dirname' in parents and trashed = false", - 'fields' => '*' + 'fields' => '*', ]; $response = (array)$this->googleDriveApp->rpcRequest(GoogleDriveApp::FILE_METADATA_URL . '?' . http_build_query($params), [], 'GET'); - return $response["files"]; + return $response['files']; } catch (Exception $e) { return false; } } -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Adapters/Local/LocalFileSystemAdapter.php b/src/Libraries/Storage/Adapters/Local/LocalFileSystemAdapter.php index 68a5a66f9..f7f791a0d 100644 --- a/src/Libraries/Storage/Adapters/Local/LocalFileSystemAdapter.php +++ b/src/Libraries/Storage/Adapters/Local/LocalFileSystemAdapter.php @@ -23,7 +23,6 @@ */ class LocalFileSystemAdapter implements LocalFilesystemAdapterInterface { - /** * @param string $dirname * @param string|null $parentId @@ -207,7 +206,7 @@ public function getLines(string $filename, int $offset = 0, ?int $length = null) { $lines = file($filename, FILE_IGNORE_NEW_LINES); - if(!$lines) { + if (!$lines) { return []; } @@ -265,4 +264,4 @@ public function include(string $file, bool $once = false) return include $file; } } -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Contracts/CloudAppInterface.php b/src/Libraries/Storage/Contracts/CloudAppInterface.php index 684009c94..b608b066d 100644 --- a/src/Libraries/Storage/Contracts/CloudAppInterface.php +++ b/src/Libraries/Storage/Contracts/CloudAppInterface.php @@ -22,7 +22,6 @@ */ interface CloudAppInterface { - /** * @param string $appKey * @param string $appSecret @@ -50,4 +49,4 @@ public function sendRequest( array $headers = [], string $method = 'POST' ); -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Contracts/FilesystemAdapterInterface.php b/src/Libraries/Storage/Contracts/FilesystemAdapterInterface.php index 0047e280a..84c7a39b5 100644 --- a/src/Libraries/Storage/Contracts/FilesystemAdapterInterface.php +++ b/src/Libraries/Storage/Contracts/FilesystemAdapterInterface.php @@ -20,7 +20,6 @@ */ interface FilesystemAdapterInterface { - /** * Makes a new directory * @param string $dirname @@ -125,4 +124,4 @@ public function isDirectory(string $dirname): bool; */ public function listDirectory(string $dirname); -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Contracts/LocalFilesystemAdapterInterface.php b/src/Libraries/Storage/Contracts/LocalFilesystemAdapterInterface.php index f19839c42..3425d9203 100644 --- a/src/Libraries/Storage/Contracts/LocalFilesystemAdapterInterface.php +++ b/src/Libraries/Storage/Contracts/LocalFilesystemAdapterInterface.php @@ -87,4 +87,4 @@ public function require(string $file, bool $once = false); * @return mixed */ public function include(string $file, bool $once = false); -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Contracts/TokenServiceInterface.php b/src/Libraries/Storage/Contracts/TokenServiceInterface.php index 06e15a980..c852be581 100644 --- a/src/Libraries/Storage/Contracts/TokenServiceInterface.php +++ b/src/Libraries/Storage/Contracts/TokenServiceInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Storage\Contracts; @@ -20,7 +20,6 @@ */ interface TokenServiceInterface { - /** * @return string */ @@ -38,4 +37,4 @@ public function getRefreshToken(): string; */ public function saveTokens(string $accessToken, ?string $refreshToken = null): bool; -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Enums/ExceptionMessages.php b/src/Libraries/Storage/Enums/ExceptionMessages.php index b0d10fd24..b718b1d5f 100644 --- a/src/Libraries/Storage/Enums/ExceptionMessages.php +++ b/src/Libraries/Storage/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Storage\Enums; @@ -22,11 +22,11 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const DIRECTORY_NOT_EXISTS = 'The directory {%1} does not exists.'; + public const DIRECTORY_NOT_EXISTS = 'The directory {%1} does not exists.'; - const DIRECTORY_NOT_WRITABLE = 'The directory {%1} is not writable.'; + public const DIRECTORY_NOT_WRITABLE = 'The directory {%1} is not writable.'; - const FILE_ALREADY_EXISTS = 'The file {%1} already exists.'; + public const FILE_ALREADY_EXISTS = 'The file {%1} already exists.'; - const FILE_TYPE_NOT_ALLOWED = 'The file type `{%1}` is not allowed.'; -} \ No newline at end of file + public const FILE_TYPE_NOT_ALLOWED = 'The file type `{%1}` is not allowed.'; +} diff --git a/src/Libraries/Storage/Exceptions/FileSystemException.php b/src/Libraries/Storage/Exceptions/FileSystemException.php index abd170e9d..9cda46e16 100644 --- a/src/Libraries/Storage/Exceptions/FileSystemException.php +++ b/src/Libraries/Storage/Exceptions/FileSystemException.php @@ -25,7 +25,6 @@ */ class FileSystemException extends BaseException { - /** * @param string $name * @return FileSystemException @@ -61,4 +60,4 @@ public static function fileAlreadyExists(string $path): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Exceptions/FileUploadException.php b/src/Libraries/Storage/Exceptions/FileUploadException.php index 96c1ddef7..db0be20dc 100644 --- a/src/Libraries/Storage/Exceptions/FileUploadException.php +++ b/src/Libraries/Storage/Exceptions/FileUploadException.php @@ -26,7 +26,6 @@ */ class FileUploadException extends BaseException { - /** * @param string $name * @return FileUploadException @@ -50,4 +49,4 @@ public static function incorrectMimeTypesConfig(string $name): self E_ERROR ); } -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Factories/FileSystemFactory.php b/src/Libraries/Storage/Factories/FileSystemFactory.php index fe8aba2c6..eecc17cc4 100644 --- a/src/Libraries/Storage/Factories/FileSystemFactory.php +++ b/src/Libraries/Storage/Factories/FileSystemFactory.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Libraries\Storage\Factories; @@ -38,11 +38,10 @@ */ class FileSystemFactory { - /** * Supported adapters */ - const ADAPTERS = [ + public const ADAPTERS = [ FileSystem::LOCAL => LocalFileSystemAdapter::class, FileSystem::DROPBOX => DropboxFileSystemAdapter::class, FileSystem::GDRIVE => GoogleDriveFileSystemAdapter::class, @@ -51,7 +50,7 @@ class FileSystemFactory /** * Supported apps */ - const APPS = [ + public const APPS = [ FileSystem::DROPBOX => DropboxApp::class, FileSystem::GDRIVE => GoogleDriveApp::class, ]; @@ -160,4 +159,4 @@ private static function createTokenService(string $adapter): TokenServiceInterfa return $tokenService; } -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/FileSystem.php b/src/Libraries/Storage/FileSystem.php index eb3108415..1781a2a6b 100644 --- a/src/Libraries/Storage/FileSystem.php +++ b/src/Libraries/Storage/FileSystem.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Storage; @@ -46,21 +46,20 @@ */ class FileSystem { - /** * Local adapter */ - const LOCAL = 'local'; + public const LOCAL = 'local'; /** * Dropbox adapter */ - const DROPBOX = 'dropbox'; + public const DROPBOX = 'dropbox'; /** * GoogleDrive adapter */ - const GDRIVE = 'gdrive'; + public const GDRIVE = 'gdrive'; /** * @var FilesystemAdapterInterface @@ -97,4 +96,4 @@ public function __call(string $method, ?array $arguments) return $this->adapter->$method(...$arguments); } -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Helpers/fs.php b/src/Libraries/Storage/Helpers/fs.php index 851030a06..20e5a8412 100644 --- a/src/Libraries/Storage/Helpers/fs.php +++ b/src/Libraries/Storage/Helpers/fs.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\Libraries\Storage\Factories\FileSystemFactory; @@ -18,7 +18,6 @@ use Quantum\Libraries\Storage\FileSystem; use Quantum\Di\Exceptions\DiException; - /** * Gets the FileSystem handler * @param string|null $adapter @@ -31,4 +30,4 @@ function fs(?string $adapter = null): FileSystem { return FileSystemFactory::get($adapter); -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/Traits/CloudAppTrait.php b/src/Libraries/Storage/Traits/CloudAppTrait.php index 62e0968ef..142cb4cfe 100644 --- a/src/Libraries/Storage/Traits/CloudAppTrait.php +++ b/src/Libraries/Storage/Traits/CloudAppTrait.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Libraries\Storage\Traits; @@ -24,7 +24,6 @@ */ trait CloudAppTrait { - /** * @inheritDoc * @throws BaseException @@ -66,4 +65,4 @@ public function sendRequest(string $uri, $data = null, array $headers = [], stri return $responseBody; } -} \ No newline at end of file +} diff --git a/src/Libraries/Storage/UploadedFile.php b/src/Libraries/Storage/UploadedFile.php index 94bacd962..625832cbb 100644 --- a/src/Libraries/Storage/UploadedFile.php +++ b/src/Libraries/Storage/UploadedFile.php @@ -38,7 +38,6 @@ */ class UploadedFile extends SplFileInfo { - /** * Local File System * @var LocalFilesystemAdapterInterface @@ -98,7 +97,7 @@ class UploadedFile extends SplFileInfo 4 => 'No file was uploaded', 6 => 'Missing a temporary folder', 7 => 'Failed to write file to disk', - 8 => 'A PHP extension stopped the file upload' + 8 => 'A PHP extension stopped the file upload', ]; /** @@ -264,7 +263,7 @@ public function getDimensions(): array return [ 'width' => $width, - 'height' => $height + 'height' => $height, ]; } @@ -468,4 +467,4 @@ protected function applyModifications($filePath) $image->save($filePath); } -} \ No newline at end of file +} diff --git a/src/Libraries/Transformer/Contracts/TransformerInterface.php b/src/Libraries/Transformer/Contracts/TransformerInterface.php index 2c654e693..19ff9263e 100644 --- a/src/Libraries/Transformer/Contracts/TransformerInterface.php +++ b/src/Libraries/Transformer/Contracts/TransformerInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.8.0 + * @since 3.0.0 */ namespace Quantum\Libraries\Transformer\Contracts; @@ -20,10 +20,9 @@ */ interface TransformerInterface { - /** * Defines the transformer signature * @param mixed $item */ public function transform($item); -} \ No newline at end of file +} diff --git a/src/Libraries/Transformer/Helpers/transformer.php b/src/Libraries/Transformer/Helpers/transformer.php index 17f78f0d3..b3f667875 100644 --- a/src/Libraries/Transformer/Helpers/transformer.php +++ b/src/Libraries/Transformer/Helpers/transformer.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ use Quantum\Libraries\Transformer\Contracts\TransformerInterface; @@ -24,4 +24,4 @@ function transform(array $data, TransformerInterface $transformer): array { return Transformer::transform($data, $transformer); -} \ No newline at end of file +} diff --git a/src/Libraries/Transformer/Transformer.php b/src/Libraries/Transformer/Transformer.php index e250eb127..aa04922d6 100644 --- a/src/Libraries/Transformer/Transformer.php +++ b/src/Libraries/Transformer/Transformer.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Libraries\Transformer; @@ -22,7 +22,6 @@ */ class Transformer { - /** * Applies the transformer on each item of the array * @param array $data @@ -33,4 +32,4 @@ public static function transform(array $data, TransformerInterface $transformer) { return array_map([$transformer, 'transform'], $data); } -} \ No newline at end of file +} diff --git a/src/Libraries/Validation/Rule.php b/src/Libraries/Validation/Rule.php index 6e04c417f..585fcd23e 100644 --- a/src/Libraries/Validation/Rule.php +++ b/src/Libraries/Validation/Rule.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Libraries\Validation; @@ -61,7 +61,6 @@ */ class Rule { - /** * @param string $name * @param array $params @@ -71,4 +70,4 @@ public static function __callStatic(string $name, array $params): array { return [$name => $params]; } -} \ No newline at end of file +} diff --git a/src/Libraries/Validation/Traits/File.php b/src/Libraries/Validation/Traits/File.php index e2c5d7ca8..c840c17db 100644 --- a/src/Libraries/Validation/Traits/File.php +++ b/src/Libraries/Validation/Traits/File.php @@ -23,7 +23,6 @@ */ trait File { - /** * Validates file size * @param UploadedFile $file @@ -87,4 +86,4 @@ public function imageDimensions(UploadedFile $file, ?int $width = null, ?int $he return true; } -} \ No newline at end of file +} diff --git a/src/Libraries/Validation/Traits/General.php b/src/Libraries/Validation/Traits/General.php index 2b3aadd33..1c6c2f710 100644 --- a/src/Libraries/Validation/Traits/General.php +++ b/src/Libraries/Validation/Traits/General.php @@ -29,7 +29,6 @@ */ trait General { - /** * Checks Field Required * @param string $value @@ -260,4 +259,4 @@ protected function captcha(string $value): bool return $captcha->verify($value); } -} \ No newline at end of file +} diff --git a/src/Libraries/Validation/Traits/Length.php b/src/Libraries/Validation/Traits/Length.php index ae43f37c0..d8d7676ff 100644 --- a/src/Libraries/Validation/Traits/Length.php +++ b/src/Libraries/Validation/Traits/Length.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Libraries\Validation\Traits; @@ -20,7 +20,6 @@ */ trait Length { - /** * Checks the min Length * @param string $value @@ -53,4 +52,4 @@ protected function exactLen(string $value, int $exactLength): bool { return mb_strlen($value) === $exactLength; } -} \ No newline at end of file +} diff --git a/src/Libraries/Validation/Traits/Lists.php b/src/Libraries/Validation/Traits/Lists.php index 5a41c4630..6471f4c45 100644 --- a/src/Libraries/Validation/Traits/Lists.php +++ b/src/Libraries/Validation/Traits/Lists.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Libraries\Validation\Traits; @@ -20,7 +20,6 @@ */ trait Lists { - /** * Validates that the field value is contained within a given string. * @param string $value @@ -45,7 +44,7 @@ protected function containsList(string $value, string ...$list): bool { $value = trim(strtolower($value)); - $list = array_map(fn($item) => trim(strtolower($item)), $list); + $list = array_map(fn ($item) => trim(strtolower($item)), $list); return in_array($value, $list); } @@ -60,8 +59,8 @@ protected function doesntContainsList(string $value, string ...$list): bool { $value = trim(strtolower($value)); - $list = array_map(fn($item) => trim(strtolower($item)), $list); + $list = array_map(fn ($item) => trim(strtolower($item)), $list); return !in_array($value, $list); } -} \ No newline at end of file +} diff --git a/src/Libraries/Validation/Traits/Resource.php b/src/Libraries/Validation/Traits/Resource.php index 6f8fc8e02..bcf648fea 100644 --- a/src/Libraries/Validation/Traits/Resource.php +++ b/src/Libraries/Validation/Traits/Resource.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Libraries\Validation\Traits; @@ -20,7 +20,6 @@ */ trait Resource { - /** * Checks for valid URL or subdomain * @param string $value @@ -84,4 +83,4 @@ protected function ipv6(string $value): bool { return filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false; } -} \ No newline at end of file +} diff --git a/src/Libraries/Validation/Traits/Type.php b/src/Libraries/Validation/Traits/Type.php index ee1e2a525..03e7d352c 100644 --- a/src/Libraries/Validation/Traits/Type.php +++ b/src/Libraries/Validation/Traits/Type.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Libraries\Validation\Traits; @@ -20,7 +20,6 @@ */ trait Type { - /** * Checks the alpha characters * @param string $value @@ -124,4 +123,4 @@ protected function maxNumeric(string $value, $maxValue): bool { return is_numeric($value) && is_numeric($maxValue) && ($value <= $maxValue); } -} \ No newline at end of file +} diff --git a/src/Libraries/Validation/Validator.php b/src/Libraries/Validation/Validator.php index e86177851..b0ba6a3b7 100644 --- a/src/Libraries/Validation/Validator.php +++ b/src/Libraries/Validation/Validator.php @@ -34,7 +34,6 @@ */ class Validator { - use General; use Type; use File; diff --git a/src/Loader/Exceptions/LoaderException.php b/src/Loader/Exceptions/LoaderException.php index 95d29d161..cf5cdf06a 100644 --- a/src/Loader/Exceptions/LoaderException.php +++ b/src/Loader/Exceptions/LoaderException.php @@ -4,14 +4,14 @@ /** * Quantum PHP Framework - * + * * An open source software development framework for PHP - * + * * @package Quantum * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Loader\Exceptions; @@ -20,11 +20,10 @@ /** * DatabaseException class - * + * * @package Quantum * @category Exceptions */ class LoaderException extends BaseException { - } diff --git a/src/Loader/Loader.php b/src/Loader/Loader.php index a7b2ad151..89b1f827b 100644 --- a/src/Loader/Loader.php +++ b/src/Loader/Loader.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Loader; @@ -23,7 +23,6 @@ */ class Loader { - /** * Current module * @var string @@ -88,7 +87,7 @@ public function set(string $property, $value): Loader */ public function loadDir(string $dir) { - foreach (glob($dir . DS . "*.php") as $filename) { + foreach (glob($dir . DS . '*.php') as $filename) { require_once $filename; } } @@ -166,4 +165,4 @@ private function resolveFilePath(): string return $filePath; } -} \ No newline at end of file +} diff --git a/src/Loader/Setup.php b/src/Loader/Setup.php index dbe28e554..c04e8365e 100644 --- a/src/Loader/Setup.php +++ b/src/Loader/Setup.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.8.0 + * @since 3.0.0 */ namespace Quantum\Loader; @@ -20,7 +20,6 @@ */ class Setup { - /** * @var bool */ diff --git a/src/Middleware/Enums/ExceptionMessages.php b/src/Middleware/Enums/ExceptionMessages.php index 2552ff81d..0f9d0083b 100644 --- a/src/Middleware/Enums/ExceptionMessages.php +++ b/src/Middleware/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Middleware\Enums; @@ -22,5 +22,5 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const MIDDLEWARE_NOT_FOUND = 'Middleware class `{%1}` not found.'; -} \ No newline at end of file + public const MIDDLEWARE_NOT_FOUND = 'Middleware class `{%1}` not found.'; +} diff --git a/src/Middleware/Exceptions/MiddlewareException.php b/src/Middleware/Exceptions/MiddlewareException.php index 4f7fa74f0..b1b021be6 100644 --- a/src/Middleware/Exceptions/MiddlewareException.php +++ b/src/Middleware/Exceptions/MiddlewareException.php @@ -25,7 +25,6 @@ */ class MiddlewareException extends BaseException { - /** * @param string $name * @return MiddlewareException @@ -37,4 +36,4 @@ public static function middlewareNotFound(string $name): self E_ERROR ); } -} \ No newline at end of file +} diff --git a/src/Middleware/MiddlewareManager.php b/src/Middleware/MiddlewareManager.php index 00a8a8adb..841efbd1a 100644 --- a/src/Middleware/MiddlewareManager.php +++ b/src/Middleware/MiddlewareManager.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Middleware; @@ -24,7 +24,6 @@ */ class MiddlewareManager { - /** * Middlewares queue * @var array @@ -86,4 +85,4 @@ private function getMiddleware(Request $request, Response $response): QtMiddlewa return new $middlewareClass($request, $response); } -} \ No newline at end of file +} diff --git a/src/Middleware/QtMiddleware.php b/src/Middleware/QtMiddleware.php index 77e0277bc..839b59b0a 100644 --- a/src/Middleware/QtMiddleware.php +++ b/src/Middleware/QtMiddleware.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.0.0 + * @since 3.0.0 */ namespace Quantum\Middleware; @@ -24,7 +24,6 @@ */ abstract class QtMiddleware { - /** * Apply * diff --git a/src/Migration/Enums/ExceptionMessages.php b/src/Migration/Enums/ExceptionMessages.php index 5ad3a9b74..47847bde3 100644 --- a/src/Migration/Enums/ExceptionMessages.php +++ b/src/Migration/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Migration\Enums; @@ -22,9 +22,9 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const WRONG_MIGRATION_DIRECTION = 'Migration direction can only be [up] or [down]'; + public const WRONG_MIGRATION_DIRECTION = 'Migration direction can only be [up] or [down]'; - const NOT_SUPPORTED_ACTION = 'The action `{%1}`, is not supported'; + public const NOT_SUPPORTED_ACTION = 'The action `{%1}`, is not supported'; - const NOTHING_TO_MIGRATE = 'Nothing to migrate'; -} \ No newline at end of file + public const NOTHING_TO_MIGRATE = 'Nothing to migrate'; +} diff --git a/src/Migration/Exceptions/MigrationException.php b/src/Migration/Exceptions/MigrationException.php index b9b1accd7..a6677ffd1 100644 --- a/src/Migration/Exceptions/MigrationException.php +++ b/src/Migration/Exceptions/MigrationException.php @@ -27,7 +27,6 @@ */ class MigrationException extends BaseException { - /** * @return MigrationException */ @@ -61,4 +60,4 @@ public static function nothingToMigrate(): self E_NOTICE ); } -} \ No newline at end of file +} diff --git a/src/Migration/MigrationManager.php b/src/Migration/MigrationManager.php index 5c5eb4bae..f9fdd7418 100644 --- a/src/Migration/MigrationManager.php +++ b/src/Migration/MigrationManager.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Migration; @@ -34,26 +34,25 @@ */ class MigrationManager { - /** * Migration direction for upgrade */ - const UPGRADE = 'up'; + public const UPGRADE = 'up'; /** * Migration direction for downgrade */ - const DOWNGRADE = 'down'; + public const DOWNGRADE = 'down'; /** * Available actions */ - const ACTIONS = ['create', 'alter', 'rename', 'drop']; + public const ACTIONS = ['create', 'alter', 'rename', 'drop']; /** * Supported drivers */ - const DRIVERS = ['mysql', 'pgsql', 'sqlite']; + public const DRIVERS = ['mysql', 'pgsql', 'sqlite']; /** * @var array @@ -320,7 +319,7 @@ private function getMigrationFiles(): array */ private function getMigratedEntries(): array { - return Database::query("SELECT * FROM " . MigrationTable::TABLE); + return Database::query('SELECT * FROM ' . MigrationTable::TABLE); } /** @@ -346,4 +345,4 @@ private function removeMigratedEntries(array $entries) Database::execute('DELETE FROM ' . MigrationTable::TABLE . ' WHERE migration=:migration', ['migration' => $entry]); } } -} \ No newline at end of file +} diff --git a/src/Migration/MigrationTable.php b/src/Migration/MigrationTable.php index 092cfa332..eba903755 100644 --- a/src/Migration/MigrationTable.php +++ b/src/Migration/MigrationTable.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Migration; @@ -24,11 +24,10 @@ */ class MigrationTable extends QtMigration { - /** * Migrations table name */ - const TABLE = 'migrations'; + public const TABLE = 'migrations'; /** * Creates the migrations table @@ -54,4 +53,4 @@ public function down(?TableFactory $tableFactory) { $tableFactory->drop(self::TABLE); } -} \ No newline at end of file +} diff --git a/src/Migration/QtMigration.php b/src/Migration/QtMigration.php index 8a0c5fb8a..048e6acb8 100644 --- a/src/Migration/QtMigration.php +++ b/src/Migration/QtMigration.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.7.0 + * @since 3.0.0 */ namespace Quantum\Migration; @@ -22,7 +22,6 @@ */ abstract class QtMigration { - /** * Upgrades with the specified migration class * @param TableFactory|null $tableFactory @@ -34,4 +33,4 @@ abstract public function up(?TableFactory $tableFactory); * @param TableFactory|null $tableFactory */ abstract public function down(?TableFactory $tableFactory); -} \ No newline at end of file +} diff --git a/src/Migration/Templates/MigrationTemplate.php b/src/Migration/Templates/MigrationTemplate.php index d14cdd162..fe181a72e 100644 --- a/src/Migration/Templates/MigrationTemplate.php +++ b/src/Migration/Templates/MigrationTemplate.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Migration\Templates; @@ -20,7 +20,6 @@ */ class MigrationTemplate { - /** * Create migration template * @param string $className @@ -137,4 +136,4 @@ public function down(?TableFactory $tableFactory) '; } -} \ No newline at end of file +} diff --git a/src/Model/Enums/ExceptionMessages.php b/src/Model/Enums/ExceptionMessages.php index d15460b3c..2d4f24afd 100644 --- a/src/Model/Enums/ExceptionMessages.php +++ b/src/Model/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Model\Enums; @@ -22,15 +22,15 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const INAPPROPRIATE_MODEL_PROPERTY = 'Inappropriate property `{%1}` for fillable object'; + public const INAPPROPRIATE_MODEL_PROPERTY = 'Inappropriate property `{%1}` for fillable object'; - const WRONG_RELATION = 'The model `{%1}` does not define relation with `{%2}`'; + public const WRONG_RELATION = 'The model `{%1}` does not define relation with `{%2}`'; - const RELATION_TYPE_MISSING = 'Relation type is missing for model `{%1}` with related model `{%2}`'; + public const RELATION_TYPE_MISSING = 'Relation type is missing for model `{%1}` with related model `{%2}`'; - const MISSING_RELATION_KEYS = 'Relation keys `foreign_key` or `local_key` are missing for model `{%1}` with related model `{%2}`'; + public const MISSING_RELATION_KEYS = 'Relation keys `foreign_key` or `local_key` are missing for model `{%1}` with related model `{%2}`'; - const MISSING_FOREIGN_KEY = 'Foreign key `{%1}` is missing in model `{%2}`'; + public const MISSING_FOREIGN_KEY = 'Foreign key `{%1}` is missing in model `{%2}`'; - const UNSUPPORTED_RELATION = 'Relation type `{%1}` is not supported'; -} \ No newline at end of file + public const UNSUPPORTED_RELATION = 'Relation type `{%1}` is not supported'; +} diff --git a/src/Model/Exceptions/ModelException.php b/src/Model/Exceptions/ModelException.php index 7d40482be..efc4ea77c 100644 --- a/src/Model/Exceptions/ModelException.php +++ b/src/Model/Exceptions/ModelException.php @@ -25,7 +25,6 @@ */ class ModelException extends BaseException { - /** * @param string $name * @return ModelException @@ -101,4 +100,4 @@ public static function unsupportedRelationType(string $relationType): self E_ERROR ); } -} \ No newline at end of file +} diff --git a/src/Model/Factories/ModelFactory.php b/src/Model/Factories/ModelFactory.php index 02e5feaed..7b6c3f5c9 100644 --- a/src/Model/Factories/ModelFactory.php +++ b/src/Model/Factories/ModelFactory.php @@ -26,7 +26,6 @@ */ class ModelFactory { - /** * Gets the Model * @param string $modelClass @@ -74,9 +73,8 @@ public static function createDynamicModel( string $idColumn = 'id', array $foreignKeys = [], array $hidden = [] - ): QtModel - { - $model = new class extends QtModel {}; + ): QtModel { + $model = new class () extends QtModel {}; $ormInstance = self::createOrmInstance($table, $modelName, $idColumn, $foreignKeys, $hidden); @@ -99,10 +97,9 @@ protected static function createOrmInstance( string $idColumn, array $foreignKeys = [], array $hidden = [] - ): DbalInterface - { + ): DbalInterface { $ormClass = Database::getInstance()->getOrmClass(); return new $ormClass($table, $modelName, $idColumn, $foreignKeys, $hidden); } -} \ No newline at end of file +} diff --git a/src/Model/Helpers/model.php b/src/Model/Helpers/model.php index d3c36a0fe..3b6cc978e 100644 --- a/src/Model/Helpers/model.php +++ b/src/Model/Helpers/model.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ use Quantum\Libraries\Database\Contracts\DbalInterface; @@ -45,8 +45,7 @@ function dynamicModel( string $idColumn = 'id', array $foreignKeys = [], array $hidden = [] -): QtModel -{ +): QtModel { return ModelFactory::createDynamicModel($table, $modelName, $idColumn, $foreignKeys, $hidden); } @@ -72,4 +71,4 @@ function wrapToModel(DbalInterface $ormInstance, string $modelClass): QtModel $model->setOrmInstance($ormInstance); return $model; -} \ No newline at end of file +} diff --git a/src/Model/ModelCollection.php b/src/Model/ModelCollection.php index 3c8684f02..8dadca400 100644 --- a/src/Model/ModelCollection.php +++ b/src/Model/ModelCollection.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Model; @@ -26,7 +26,6 @@ */ class ModelCollection implements Countable, IteratorAggregate { - /** * @var QtModel[] */ @@ -86,7 +85,7 @@ public function remove(QtModel $model): self { $this->processModels(); - $this->models = array_filter($this->models, fn($m) => $m !== $model); + $this->models = array_filter($this->models, fn ($m) => $m !== $model); $this->originalModels = $this->models; @@ -200,4 +199,4 @@ private function validateModel($model): void throw ModelException::notInstanceOf(get_class($model), QtModel::class); } } -} \ No newline at end of file +} diff --git a/src/Model/QtModel.php b/src/Model/QtModel.php index 98dd5e028..86d130163 100644 --- a/src/Model/QtModel.php +++ b/src/Model/QtModel.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Model; @@ -48,7 +48,6 @@ */ abstract class QtModel { - /** * The database table associated with model * @var string @@ -118,7 +117,7 @@ public function relations(): array */ public function get(): ModelCollection { - $models = array_map(fn($item) => wrapToModel($item, static::class), $this->ormInstance->get()); + $models = array_map(fn ($item) => wrapToModel($item, static::class), $this->ormInstance->get()); return new ModelCollection($models); } @@ -135,7 +134,7 @@ public function paginate(int $perPage, int $currentPage = 1): Paginator return PaginatorFactory::create(Paginator::MODEL, [ 'model' => $this, 'perPage' => $perPage, - 'page' => $currentPage + 'page' => $currentPage, ]); } @@ -165,12 +164,11 @@ public function fillObjectProps(array $props): QtModel /** * @return bool */ - public function isEmpty() : bool + public function isEmpty(): bool { return empty($this->asArray()); } - /** * Sets or gets the model property * @param string $property @@ -232,7 +230,7 @@ public function __sleep() return [ 'table', 'idColumn', - 'hidden' + 'hidden', ]; } -} \ No newline at end of file +} diff --git a/src/Model/Traits/SoftDeletes.php b/src/Model/Traits/SoftDeletes.php index dcabf4f2a..fede27b79 100644 --- a/src/Model/Traits/SoftDeletes.php +++ b/src/Model/Traits/SoftDeletes.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Model\Traits; @@ -25,7 +25,6 @@ */ trait SoftDeletes { - /** * @var bool */ @@ -186,4 +185,4 @@ protected function getDeleteAtColumn(): string return 'deleted_at'; } -} \ No newline at end of file +} diff --git a/src/Module/Enums/ExceptionMessages.php b/src/Module/Enums/ExceptionMessages.php index 91ae72022..60fb5bc3c 100644 --- a/src/Module/Enums/ExceptionMessages.php +++ b/src/Module/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Module\Enums; @@ -22,15 +22,15 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const MODULE_ROUTES_NOT_FOUND = 'Routes not found for module `{%1}`'; + public const MODULE_ROUTES_NOT_FOUND = 'Routes not found for module `{%1}`'; - const MODULE_CONFIG_NOT_FOUND = 'Config not found for a module'; + public const MODULE_CONFIG_NOT_FOUND = 'Config not found for a module'; - const MODULE_CREATION_INCOMPLETE = 'Module creation incomplete: missing files.'; + public const MODULE_CREATION_INCOMPLETE = 'Module creation incomplete: missing files.'; - const MISSING_MODULE_TEMPLATE = 'Template `{%1}` does not exist'; + public const MISSING_MODULE_TEMPLATE = 'Template `{%1}` does not exist'; - const MISSING_MODULE_DIRECTORY = 'Module directory does not exist, skipping config update.'; + public const MISSING_MODULE_DIRECTORY = 'Module directory does not exist, skipping config update.'; - const MODULE_ALREADY_EXISTS = 'A module or prefix named `{%1}` already exists'; -} \ No newline at end of file + public const MODULE_ALREADY_EXISTS = 'A module or prefix named `{%1}` already exists'; +} diff --git a/src/Module/Exceptions/ModuleException.php b/src/Module/Exceptions/ModuleException.php index 6cc09ba1f..7cfbb1437 100644 --- a/src/Module/Exceptions/ModuleException.php +++ b/src/Module/Exceptions/ModuleException.php @@ -4,9 +4,9 @@ /** * Quantum PHP Framework - * + * * An open source software development framework for PHP - * + * * @package Quantum * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) @@ -24,7 +24,6 @@ */ class ModuleException extends \Exception { - /** * @param string $name * @return ModuleException @@ -93,4 +92,4 @@ public static function moduleAlreadyExists(string $name): self E_ERROR ); } -} \ No newline at end of file +} diff --git a/src/Module/ModuleLoader.php b/src/Module/ModuleLoader.php index a1749a421..ad60626b0 100644 --- a/src/Module/ModuleLoader.php +++ b/src/Module/ModuleLoader.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Module; @@ -32,7 +32,6 @@ */ class ModuleLoader { - /** * @var array */ @@ -197,7 +196,7 @@ private function getModuleRoutes(string $module, Route $route): array throw ModuleException::moduleRoutesNotFound($module); } - if(empty(self::$moduleRoutes[$module])) { + if (empty(self::$moduleRoutes[$module])) { self::$moduleRoutes[$module] = $this->fs->require($moduleRoutes, true); } @@ -209,4 +208,4 @@ private function getModuleRoutes(string $module, Route $route): array return $route->getRuntimeRoutes(); } -} \ No newline at end of file +} diff --git a/src/Module/ModuleManager.php b/src/Module/ModuleManager.php index 98f1aca64..776a7d1ef 100644 --- a/src/Module/ModuleManager.php +++ b/src/Module/ModuleManager.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Module; @@ -29,8 +29,7 @@ */ class ModuleManager { - - const DEFAULT_TEMPLATE = 'DemoWeb'; + public const DEFAULT_TEMPLATE = 'DemoWeb'; /** * @var mixed @@ -144,10 +143,10 @@ public function writeContents() $this->fs->makeDirectory(modules_dir()); } - $copiedTemplates = $this->copyDirectoryWithTemplates($this->templatePath . DS . "src", $this->modulePath); + $copiedTemplates = $this->copyDirectoryWithTemplates($this->templatePath . DS . 'src', $this->modulePath); if ($this->withAssets) { - $copiedAssets = $this->copyAssets($this->templatePath . DS . "assets", $this->assetsPath); + $copiedAssets = $this->copyAssets($this->templatePath . DS . 'assets', $this->assetsPath); } if (!$this->verifyModuleFilesCreated(array_merge($copiedTemplates, $copiedAssets ?? []))) { @@ -206,8 +205,7 @@ private function copyDirectory(string $src, string $dst, bool $processTemplates, } else { if ($processTemplates) { $this->processTemplates($srcPath, $dstPath); - } - else { + } else { $this->fs->copy($srcPath, $dstPath); } $copiedFiles[] = $dstPath; @@ -221,7 +219,8 @@ private function copyDirectory(string $src, string $dst, bool $processTemplates, * @param string $srcPath * @param string $dstPath */ - private function processTemplates(string $srcPath, string &$dstPath){ + private function processTemplates(string $srcPath, string &$dstPath) + { $dstPath = str_replace('.php.tpl', '.php', $dstPath); $content = $this->fs->get($srcPath); $processedContent = $this->replacePlaceholders($content); @@ -235,7 +234,7 @@ private function processTemplates(string $srcPath, string &$dstPath){ private function replacePlaceholders(string $content): string { $placeholders = [ - '{{MODULE_NAMESPACE}}' => module_base_namespace() .'\\' . $this->getModuleName(), + '{{MODULE_NAMESPACE}}' => module_base_namespace() . '\\' . $this->getModuleName(), '{{MODULE_NAME}}' => $this->getModuleName(), ]; @@ -249,7 +248,7 @@ private function replacePlaceholders(string $content): string private function getModuleOptions(string $module): array { return [ - 'prefix' => $this->template == self::DEFAULT_TEMPLATE ? "" : strtolower($module), + 'prefix' => $this->template == self::DEFAULT_TEMPLATE ? '' : strtolower($module), 'enabled' => $this->optionEnabled, ]; } @@ -280,4 +279,4 @@ protected function verifyModuleFilesCreated(array $copiedFiles): bool } return true; } -} \ No newline at end of file +} diff --git a/src/Paginator/Adapters/ArrayPaginator.php b/src/Paginator/Adapters/ArrayPaginator.php index 7fd7660ee..16f661452 100644 --- a/src/Paginator/Adapters/ArrayPaginator.php +++ b/src/Paginator/Adapters/ArrayPaginator.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Paginator\Adapters; @@ -17,14 +17,12 @@ use Quantum\Paginator\Contracts\PaginatorInterface; use Quantum\Paginator\Traits\PaginatorTrait; - /** * Class ArrayPaginator * @package Quantum\Paginator */ class ArrayPaginator implements PaginatorInterface { - use PaginatorTrait; /** @@ -84,4 +82,4 @@ public function lastItem() return end($data); } -} \ No newline at end of file +} diff --git a/src/Paginator/Adapters/ModelPaginator.php b/src/Paginator/Adapters/ModelPaginator.php index 0e1f07912..226b269d5 100644 --- a/src/Paginator/Adapters/ModelPaginator.php +++ b/src/Paginator/Adapters/ModelPaginator.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Paginator\Adapters; @@ -25,7 +25,6 @@ */ class ModelPaginator implements PaginatorInterface { - use PaginatorTrait; /** @@ -62,8 +61,8 @@ public function data(): ModelCollection ->offset($this->perPage * ($this->page - 1)) ->get(); - if($this->modelClass != '@anonymous') { - $result = array_map(fn($item) => wrapToModel($item->getOrmInstance(), $this->modelClass), iterator_to_array($result)); + if ($this->modelClass != '@anonymous') { + $result = array_map(fn ($item) => wrapToModel($item->getOrmInstance(), $this->modelClass), iterator_to_array($result)); } return new ModelCollection($result); @@ -96,4 +95,4 @@ public function lastItem() return $data->last(); } -} \ No newline at end of file +} diff --git a/src/Paginator/Contracts/PaginatorInterface.php b/src/Paginator/Contracts/PaginatorInterface.php index 33c069f06..65727c04d 100644 --- a/src/Paginator/Contracts/PaginatorInterface.php +++ b/src/Paginator/Contracts/PaginatorInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\Paginator\Contracts; @@ -20,7 +20,6 @@ */ interface PaginatorInterface { - /** * Get the paginated data * @return mixed @@ -124,4 +123,4 @@ public function links(bool $withBaseUrl = false): array; * @return string|null */ public function getPagination(bool $withBaseUrl = false, int $pageItemsCount = null): ?string; -} \ No newline at end of file +} diff --git a/src/Paginator/Enums/ExceptionMessages.php b/src/Paginator/Enums/ExceptionMessages.php index ae30c9bce..0496aa8eb 100644 --- a/src/Paginator/Enums/ExceptionMessages.php +++ b/src/Paginator/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Paginator\Enums; @@ -22,5 +22,5 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const MISSING_REQUIRED_PARAMS = 'Missing required parameter `{%1}` missing for adapter {%2}'; -} \ No newline at end of file + public const MISSING_REQUIRED_PARAMS = 'Missing required parameter `{%1}` missing for adapter {%2}'; +} diff --git a/src/Paginator/Enums/Pagination.php b/src/Paginator/Enums/Pagination.php index b848bf7af..ac3d0d733 100644 --- a/src/Paginator/Enums/Pagination.php +++ b/src/Paginator/Enums/Pagination.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Paginator\Enums; @@ -20,39 +20,38 @@ */ class Pagination { - /** * Pagination class name */ - const PAGINATION_CLASS = 'pagination'; + public const PAGINATION_CLASS = 'pagination'; /** * Active class name */ - const PAGINATION_CLASS_ACTIVE = 'active'; + public const PAGINATION_CLASS_ACTIVE = 'active'; /** * Parameter name for per page */ - const PER_PAGE = 'per_page'; + public const PER_PAGE = 'per_page'; /** * Parameter name for page number */ - const PAGE = 'page'; + public const PAGE = 'page'; /** * First page number */ - const FIRST_PAGE_NUMBER = 1; + public const FIRST_PAGE_NUMBER = 1; /** * Minimum page items count */ - const MINIMUM_PAGE_ITEMS_COUNT = 3; + public const MINIMUM_PAGE_ITEMS_COUNT = 3; /** * Edge padding */ - const EDGE_PADDING = 3; -} \ No newline at end of file + public const EDGE_PADDING = 3; +} diff --git a/src/Paginator/Exceptions/PaginatorException.php b/src/Paginator/Exceptions/PaginatorException.php index 616eeb056..2f9ee904e 100644 --- a/src/Paginator/Exceptions/PaginatorException.php +++ b/src/Paginator/Exceptions/PaginatorException.php @@ -25,7 +25,6 @@ */ class PaginatorException extends BaseException { - /** * @param string $type * @param $missingParam @@ -38,4 +37,4 @@ public static function missingRequiredParams(string $type, $missingParam): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Paginator/Factories/PaginatorFactory.php b/src/Paginator/Factories/PaginatorFactory.php index 98ea20c0b..ad7155206 100644 --- a/src/Paginator/Factories/PaginatorFactory.php +++ b/src/Paginator/Factories/PaginatorFactory.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Paginator\Factories; @@ -26,11 +26,10 @@ */ class PaginatorFactory { - /** * Supported adapters */ - const ADAPTERS = [ + public const ADAPTERS = [ Paginator::ARRAY => ArrayPaginator::class, Paginator::MODEL => ModelPaginator::class, ]; @@ -38,7 +37,7 @@ class PaginatorFactory /** * Required parameters for each adapter type. */ - const REQUIRED_PARAMS = [ + public const REQUIRED_PARAMS = [ Paginator::ARRAY => ['items'], Paginator::MODEL => ['model'], ]; @@ -46,7 +45,7 @@ class PaginatorFactory /** * Default parameters applied to all adapters. */ - const DEFAULT_PARAMS = [ + public const DEFAULT_PARAMS = [ 'perPage' => 10, 'page' => 1, ]; @@ -114,4 +113,4 @@ private static function buildConstructorArgs(string $type, array $params): array return $args; } -} \ No newline at end of file +} diff --git a/src/Paginator/Paginator.php b/src/Paginator/Paginator.php index ecfce603e..29747858e 100644 --- a/src/Paginator/Paginator.php +++ b/src/Paginator/Paginator.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Paginator; @@ -40,16 +40,15 @@ */ class Paginator { - /** * Array paginator type */ - const ARRAY = 'array'; + public const ARRAY = 'array'; /** * Model paginator type */ - const MODEL = 'model'; + public const MODEL = 'model'; /** * @var PaginatorInterface @@ -87,4 +86,4 @@ public function __call(string $method, ?array $arguments) return $this->adapter->$method(...$arguments); } -} \ No newline at end of file +} diff --git a/src/Paginator/Traits/PaginatorTrait.php b/src/Paginator/Traits/PaginatorTrait.php index 4d0723509..eae6ffa71 100644 --- a/src/Paginator/Traits/PaginatorTrait.php +++ b/src/Paginator/Traits/PaginatorTrait.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Paginator\Traits; @@ -22,7 +22,6 @@ */ trait PaginatorTrait { - /** * @var string */ @@ -373,4 +372,4 @@ protected function addLastPageLink(int $endPage, int $totalPages, array $links): return $pagination; } -} \ No newline at end of file +} diff --git a/src/Renderer/Adapters/HtmlAdapter.php b/src/Renderer/Adapters/HtmlAdapter.php index ef413a1f7..843f7fa68 100644 --- a/src/Renderer/Adapters/HtmlAdapter.php +++ b/src/Renderer/Adapters/HtmlAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Renderer\Adapters; @@ -28,7 +28,6 @@ */ class HtmlAdapter implements TemplateRendererInterface { - /** * @var FileSystem */ @@ -89,4 +88,4 @@ private function getViewFilePath(string $view): string return $this->fs->exists($moduleViewPath) ? $moduleViewPath : $sharedViewPath; } -} \ No newline at end of file +} diff --git a/src/Renderer/Adapters/TwigAdapter.php b/src/Renderer/Adapters/TwigAdapter.php index 957d28be7..5bf37589a 100644 --- a/src/Renderer/Adapters/TwigAdapter.php +++ b/src/Renderer/Adapters/TwigAdapter.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Renderer\Adapters; @@ -32,7 +32,6 @@ */ class TwigAdapter implements TemplateRendererInterface { - /** * @var FileSystem */ @@ -110,4 +109,4 @@ private function addFunctionsToTwig(Environment $twig) } } } -} \ No newline at end of file +} diff --git a/src/Renderer/Contracts/TemplateRendererInterface.php b/src/Renderer/Contracts/TemplateRendererInterface.php index 240f6ddda..59bd48d6c 100644 --- a/src/Renderer/Contracts/TemplateRendererInterface.php +++ b/src/Renderer/Contracts/TemplateRendererInterface.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.5 + * @since 3.0.0 */ namespace Quantum\Renderer\Contracts; @@ -27,4 +27,4 @@ interface TemplateRendererInterface * @return string */ public function render(string $view, array $params = []): string; -} \ No newline at end of file +} diff --git a/src/Renderer/Exceptions/RendererException.php b/src/Renderer/Exceptions/RendererException.php index 7edf03aa1..49f2cc9f1 100644 --- a/src/Renderer/Exceptions/RendererException.php +++ b/src/Renderer/Exceptions/RendererException.php @@ -11,7 +11,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Renderer\Exceptions; @@ -24,4 +24,4 @@ */ class RendererException extends BaseException { -} \ No newline at end of file +} diff --git a/src/Renderer/Factories/RendererFactory.php b/src/Renderer/Factories/RendererFactory.php index b9b9a1a97..0fd246637 100644 --- a/src/Renderer/Factories/RendererFactory.php +++ b/src/Renderer/Factories/RendererFactory.php @@ -30,11 +30,10 @@ */ class RendererFactory { - /** * Supported adapters */ - const ADAPTERS = [ + public const ADAPTERS = [ Renderer::HTML => HtmlAdapter::class, Renderer::TWIG => TwigAdapter::class, ]; @@ -92,4 +91,4 @@ private static function getAdapterClass(string $adapter): string return self::ADAPTERS[$adapter]; } -} \ No newline at end of file +} diff --git a/src/Renderer/Renderer.php b/src/Renderer/Renderer.php index ad7283ff3..8a9d9f0e4 100644 --- a/src/Renderer/Renderer.php +++ b/src/Renderer/Renderer.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\Renderer; @@ -25,16 +25,15 @@ */ class Renderer { - /** * HTML adapter */ - const HTML = 'html'; + public const HTML = 'html'; /** * Twig adapter */ - const TWIG = 'twig'; + public const TWIG = 'twig'; /** * @var TemplateRendererInterface @@ -71,4 +70,4 @@ public function __call(string $method, ?array $arguments) return $this->adapter->$method(...$arguments); } -} \ No newline at end of file +} diff --git a/src/Router/Enums/ExceptionMessages.php b/src/Router/Enums/ExceptionMessages.php index 9fee0adef..1466741ce 100644 --- a/src/Router/Enums/ExceptionMessages.php +++ b/src/Router/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Router\Enums; @@ -22,27 +22,27 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const CONTROLLER_NOT_FOUND = 'Controller class `{%1}` not found.'; + public const CONTROLLER_NOT_FOUND = 'Controller class `{%1}` not found.'; - const ACTION_NOT_DEFINED = 'Action `{%1}` not defined"'; + public const ACTION_NOT_DEFINED = 'Action `{%1}` not defined"'; - const ROUTE_NOT_FOUND = 'Route not found'; + public const ROUTE_NOT_FOUND = 'Route not found'; - const ROUTE_NOT_CLOSURE = 'Route is not a closure'; + public const ROUTE_NOT_CLOSURE = 'Route is not a closure'; - const REPETITIVE_ROUTE_WITH_SAME_NAME = 'Repetitive Routes with same method `{%1}`'; + public const REPETITIVE_ROUTE_WITH_SAME_NAME = 'Repetitive Routes with same method `{%1}`'; - const REPETITIVE_ROUTE_IN_DIFFERENT_MODULES = 'Repetitive Routes in different modules'; + public const REPETITIVE_ROUTE_IN_DIFFERENT_MODULES = 'Repetitive Routes in different modules'; - const INCORRECT_METHOD = 'Incorrect route method `{%1}`'; + public const INCORRECT_METHOD = 'Incorrect route method `{%1}`'; - const NAME_BEFORE_ROUTE_DEFINITION = 'Names can not be set before route definition'; + public const NAME_BEFORE_ROUTE_DEFINITION = 'Names can not be set before route definition'; - const NAME_ON_ROUTE_GROUP = 'Name can not be set on route groups'; + public const NAME_ON_ROUTE_GROUP = 'Name can not be set on route groups'; - const NAME_NOT_UNIQUE = 'Route names should be unique'; + public const NAME_NOT_UNIQUE = 'Route names should be unique'; - const ROUTE_PARAM_NAME_IN_USE = 'Route param name `{%1}` already in use'; + public const ROUTE_PARAM_NAME_IN_USE = 'Route param name `{%1}` already in use'; - const INVALID_ROUTE_PARAM_NAME = 'Route param names can only contain letters'; -} \ No newline at end of file + public const INVALID_ROUTE_PARAM_NAME = 'Route param names can only contain letters'; +} diff --git a/src/Router/Exceptions/RouteControllerException.php b/src/Router/Exceptions/RouteControllerException.php index c8114fae4..7554de21b 100644 --- a/src/Router/Exceptions/RouteControllerException.php +++ b/src/Router/Exceptions/RouteControllerException.php @@ -25,7 +25,6 @@ */ class RouteControllerException extends BaseException { - /** * @param string|null $name * @return RouteControllerException @@ -49,4 +48,4 @@ public static function actionNotDefined(string $name): self E_ERROR ); } -} \ No newline at end of file +} diff --git a/src/Router/Exceptions/RouteException.php b/src/Router/Exceptions/RouteException.php index 77afeb5b4..2c6171ff0 100644 --- a/src/Router/Exceptions/RouteException.php +++ b/src/Router/Exceptions/RouteException.php @@ -137,4 +137,4 @@ public static function paramNameNotValid(): self E_WARNING ); } -} \ No newline at end of file +} diff --git a/src/Router/Helpers/router.php b/src/Router/Helpers/router.php index ff8e49a0e..c3b93a8dd 100644 --- a/src/Router/Helpers/router.php +++ b/src/Router/Helpers/router.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ use Quantum\Environment\Environment; @@ -132,7 +132,7 @@ function route_uri(): string */ function route_cache_settings(): ?array { - return RouteController::getCurrentRoute()['cache_settings'] ?? null; + return RouteController::getCurrentRoute()['cache_settings'] ?? null; } /** @@ -165,7 +165,7 @@ function find_route_by_name(string $name, string $module): ?array if (isset($route['name']) && strtolower($route['name']) === strtolower($name) && strtolower($route['module']) === strtolower($module)) { - + return $route; } } @@ -200,6 +200,6 @@ function route_group_exists(string $name, string $module): bool function module_base_namespace(): string { return Environment::getInstance()->getAppEnv() === 'testing' - ? "Quantum\\Tests\\_root\\modules" - : "Modules"; -} \ No newline at end of file + ? 'Quantum\\Tests\\_root\\modules' + : 'Modules'; +} diff --git a/src/Router/Route.php b/src/Router/Route.php index d4b92ff2e..aeb005d0a 100644 --- a/src/Router/Route.php +++ b/src/Router/Route.php @@ -27,7 +27,6 @@ */ class Route { - /** * Current module name * @var string @@ -315,4 +314,4 @@ private function assignMiddlewaresToRoute(array &$route, array $middlewares) } } } -} \ No newline at end of file +} diff --git a/src/Router/RouteController.php b/src/Router/RouteController.php index ad7a0f665..cfa7b6c68 100644 --- a/src/Router/RouteController.php +++ b/src/Router/RouteController.php @@ -22,7 +22,6 @@ */ abstract class RouteController { - /** * List of routes * @var array diff --git a/src/Router/RouteDispatcher.php b/src/Router/RouteDispatcher.php index 573119a53..f2469def4 100644 --- a/src/Router/RouteDispatcher.php +++ b/src/Router/RouteDispatcher.php @@ -24,7 +24,6 @@ class RouteDispatcher { - /** * Handles the incoming HTTP request. * @param Request $request diff --git a/src/Router/Router.php b/src/Router/Router.php index b83e5f94b..61764efa2 100644 --- a/src/Router/Router.php +++ b/src/Router/Router.php @@ -31,16 +31,15 @@ */ class Router extends RouteController { - - const VALID_PARAM_NAME_PATTERN = '/^[a-zA-Z]+$/'; + public const VALID_PARAM_NAME_PATTERN = '/^[a-zA-Z]+$/'; /** * Parameter types */ - const PARAM_TYPES = [ + public const PARAM_TYPES = [ ':alpha' => '[a-zA-Z]', ':num' => '[0-9]', - ':any' => '[^\/]' + ':any' => '[^\/]', ]; /** @@ -181,7 +180,7 @@ private function findMatches(string $uri): array foreach (self::$routes as $route) { [$pattern, $params] = $this->handleRoutePattern($route); - if (preg_match("/^" . $this->escape($pattern) . "$/u", $requestUri, $matchedParams)) { + if (preg_match('/^' . $this->escape($pattern) . '$/u', $requestUri, $matchedParams)) { $route['uri'] = $uri; $route['params'] = $this->routeParams($params, $matchedParams); $route['pattern'] = $pattern; @@ -216,7 +215,7 @@ private function handleRoutePattern(array $route): array $routeParams[] = [ 'route_pattern' => $segment, 'pattern' => $segmentParam['pattern'], - 'name' => $segmentParam['name'] + 'name' => $segmentParam['name'], ]; $routePattern = $this->normalizePattern($routePattern, $segmentParam, $index, $lastIndex); @@ -227,7 +226,7 @@ private function handleRoutePattern(array $route): array return [ $routePattern, - $routeParams + $routeParams, ]; } @@ -335,7 +334,7 @@ private function getParamPattern(array $match, string $expr, int $index, int $la return [ 'name' => $name, - 'pattern' => $pattern + 'pattern' => $pattern, ]; } @@ -402,4 +401,4 @@ private function escape(string $str): string { return str_replace('/', '\/', stripslashes($str)); } -} \ No newline at end of file +} diff --git a/src/Service/Exceptions/ServiceException.php b/src/Service/Exceptions/ServiceException.php index c89ac6fe3..ffc5b2cbf 100644 --- a/src/Service/Exceptions/ServiceException.php +++ b/src/Service/Exceptions/ServiceException.php @@ -11,7 +11,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Service\Exceptions; @@ -24,5 +24,4 @@ */ class ServiceException extends BaseException { - -} \ No newline at end of file +} diff --git a/src/Service/Factories/ServiceFactory.php b/src/Service/Factories/ServiceFactory.php index ee8216410..be65ca4cb 100644 --- a/src/Service/Factories/ServiceFactory.php +++ b/src/Service/Factories/ServiceFactory.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Service\Factories; @@ -27,7 +27,6 @@ */ class ServiceFactory { - /** * Creates and initiates the service once * @param string $serviceClass @@ -83,4 +82,4 @@ private static function validate(string $serviceClass): void throw ServiceException::notInstanceOf($serviceClass, QtService::class); } } -} \ No newline at end of file +} diff --git a/src/Service/Helpers/service.php b/src/Service/Helpers/service.php index 26f9ef4ba..ff58b6771 100644 --- a/src/Service/Helpers/service.php +++ b/src/Service/Helpers/service.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ use Quantum\Service\Exceptions\ServiceException; diff --git a/src/Service/QtService.php b/src/Service/QtService.php index 36d64ba1b..578cd7dfc 100644 --- a/src/Service/QtService.php +++ b/src/Service/QtService.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\Service; @@ -23,7 +23,6 @@ */ class QtService { - /** * Handles the missing methods of the service * @param string $method @@ -34,4 +33,4 @@ public function __call(string $method, array $arguments) { throw ServiceException::methodNotSupported($method, QtService::class); } -} \ No newline at end of file +} diff --git a/src/Tracer/ErrorHandler.php b/src/Tracer/ErrorHandler.php index 7eac61799..12d5831e5 100644 --- a/src/Tracer/ErrorHandler.php +++ b/src/Tracer/ErrorHandler.php @@ -39,12 +39,12 @@ class ErrorHandler /** * Number of lines to be returned */ - const NUM_LINES = 10; + public const NUM_LINES = 10; /** * @var array */ - const ERROR_TYPES = [ + public const ERROR_TYPES = [ E_ERROR => 'error', E_WARNING => 'warning', E_PARSE => 'error', @@ -145,7 +145,7 @@ public function handleException(Throwable $throwable): void private function handleCliException(Throwable $throwable): void { $output = new ConsoleOutput(); - $output->writeln("" . $throwable->getMessage() . ""); + $output->writeln('' . $throwable->getMessage() . ''); } /** @@ -177,7 +177,6 @@ private function handleWebException(Throwable $throwable): void Response::send(); } - /** * @param Throwable $e * @param string $errorType @@ -300,4 +299,4 @@ private function getErrorType(Throwable $e): string return LogLevel::ERROR; } -} \ No newline at end of file +} diff --git a/src/View/Enums/ExceptionMessages.php b/src/View/Enums/ExceptionMessages.php index 0dff4372e..2c785ba0c 100644 --- a/src/View/Enums/ExceptionMessages.php +++ b/src/View/Enums/ExceptionMessages.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.9 + * @since 3.0.0 */ namespace Quantum\View\Enums; @@ -22,7 +22,7 @@ */ final class ExceptionMessages extends BaseExceptionMessages { - const LAYOUT_NOT_SET = 'Layout is not set.'; + public const LAYOUT_NOT_SET = 'Layout is not set.'; - const VIEW_NOT_RENDERED_YET = 'View not rendered yet.'; -} \ No newline at end of file + public const VIEW_NOT_RENDERED_YET = 'View not rendered yet.'; +} diff --git a/src/View/Exceptions/ViewException.php b/src/View/Exceptions/ViewException.php index cfde8ff34..a516b78cc 100644 --- a/src/View/Exceptions/ViewException.php +++ b/src/View/Exceptions/ViewException.php @@ -25,7 +25,6 @@ */ class ViewException extends BaseException { - /** * @return ViewException */ diff --git a/src/View/Factories/ViewFactory.php b/src/View/Factories/ViewFactory.php index 5306c6891..8531d0cad 100644 --- a/src/View/Factories/ViewFactory.php +++ b/src/View/Factories/ViewFactory.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\View\Factories; @@ -32,7 +32,6 @@ */ class ViewFactory { - /** * Instance of QtView * @var QtView|null diff --git a/src/View/Helpers/view.php b/src/View/Helpers/view.php index 910e13f6c..dbb1ef00c 100644 --- a/src/View/Helpers/view.php +++ b/src/View/Helpers/view.php @@ -116,4 +116,4 @@ function markdown_to_html(string $content, bool $sanitize = false): string } return $html; -} \ No newline at end of file +} diff --git a/src/View/QtView.php b/src/View/QtView.php index d6c299a38..ada3f60e9 100644 --- a/src/View/QtView.php +++ b/src/View/QtView.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.8 + * @since 3.0.0 */ namespace Quantum\View; @@ -34,7 +34,6 @@ */ class QtView { - /** * @var Renderer */ @@ -90,8 +89,7 @@ public function __construct( AssetManager $assetManager, Debugger $debugger, ViewCache $viewCache - ) - { + ) { $this->renderer = $renderer; $this->assetManager = $assetManager; $this->debugger = $debugger; @@ -107,7 +105,7 @@ public function setLayout(?string $layoutFile, array $assets = []) { $this->layoutFile = $layoutFile; - if($assets !== []) { + if ($assets !== []) { $this->assets = array_merge($this->assets, $assets); } } @@ -333,4 +331,4 @@ private function updateDebugger(string $viewFile) $this->debugger->clearStoreCell(Debugger::ROUTES); $this->debugger->addToStoreCell(Debugger::ROUTES, LogLevel::INFO, $mergedData); } -} \ No newline at end of file +} diff --git a/src/View/RawParam.php b/src/View/RawParam.php index 80e9f4103..2dfbeb27d 100644 --- a/src/View/RawParam.php +++ b/src/View/RawParam.php @@ -9,7 +9,7 @@ * @author Arman Ag. * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) * @link http://quantum.softberg.org/ - * @since 2.9.7 + * @since 3.0.0 */ namespace Quantum\View; diff --git a/tests/Helpers/functions.php b/tests/Helpers/functions.php index d4b542345..fbeb2c637 100644 --- a/tests/Helpers/functions.php +++ b/tests/Helpers/functions.php @@ -15,4 +15,4 @@ function removeEnvFile() if (file_exists(PROJECT_ROOT . DS . '.env.testing')) { unlink(PROJECT_ROOT . DS . '.env.testing'); } -} \ No newline at end of file +} diff --git a/tests/Unit/App/Adapters/ConsoleAppAdapterTest.php b/tests/Unit/App/Adapters/ConsoleAppAdapterTest.php index 1adf89dc2..f0f649edf 100644 --- a/tests/Unit/App/Adapters/ConsoleAppAdapterTest.php +++ b/tests/Unit/App/Adapters/ConsoleAppAdapterTest.php @@ -2,8 +2,6 @@ namespace Quantum\Tests\Unit\App\Adapters; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputInterface; use Quantum\App\Adapters\ConsoleAppAdapter; use Symfony\Component\Console\Application; use PHPUnit\Framework\TestCase; @@ -13,7 +11,6 @@ class ConsoleAppAdapterTest extends TestCase { - private $consoleAppAdapter; public function setUp(): void @@ -59,4 +56,4 @@ public function testConsoleAppAdapterStartFails() $this->consoleAppAdapter->start(); } -} \ No newline at end of file +} diff --git a/tests/Unit/App/Adapters/WebAppAdapterTest.php b/tests/Unit/App/Adapters/WebAppAdapterTest.php index cb18fa8c9..d5667e3e2 100644 --- a/tests/Unit/App/Adapters/WebAppAdapterTest.php +++ b/tests/Unit/App/Adapters/WebAppAdapterTest.php @@ -11,7 +11,6 @@ class WebAppAdapterTest extends TestCase { - private $webAppAdapter; public function setUp(): void @@ -45,4 +44,4 @@ public function testWebAppAdapterStartFails() $this->webAppAdapter->start(); } -} \ No newline at end of file +} diff --git a/tests/Unit/App/AppTest.php b/tests/Unit/App/AppTest.php index 705423220..f1f823072 100644 --- a/tests/Unit/App/AppTest.php +++ b/tests/Unit/App/AppTest.php @@ -17,7 +17,6 @@ */ class AppTest extends TestCase { - public function setUp(): void { parent::setUp(); @@ -63,8 +62,8 @@ public function testAppCallingInvalidMethod() $this->expectException(AppException::class); - $this->expectExceptionMessage('The method `callingInvalidMethod` is not supported for `'. WebAppAdapter::class .'`'); + $this->expectExceptionMessage('The method `callingInvalidMethod` is not supported for `' . WebAppAdapter::class . '`'); $app->callingInvalidMethod(); } -} \ No newline at end of file +} diff --git a/tests/Unit/App/Factories/AppFactoryTest.php b/tests/Unit/App/Factories/AppFactoryTest.php index 42f7e571f..25e4f6d43 100644 --- a/tests/Unit/App/Factories/AppFactoryTest.php +++ b/tests/Unit/App/Factories/AppFactoryTest.php @@ -10,10 +10,8 @@ use PHPUnit\Framework\TestCase; use Quantum\App\App; - class AppFactoryTest extends TestCase { - public function setUp(): void { parent::setUp(); @@ -78,4 +76,4 @@ public function testAppFactoryDestroy() $this->assertNotSame($app1, $app2); } -} \ No newline at end of file +} diff --git a/tests/Unit/App/Helpers/DirHelperTest.php b/tests/Unit/App/Helpers/DirHelperTest.php index 6ab1dc801..6e9bd9ec2 100644 --- a/tests/Unit/App/Helpers/DirHelperTest.php +++ b/tests/Unit/App/Helpers/DirHelperTest.php @@ -6,7 +6,6 @@ class DirHelperTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -59,4 +58,4 @@ public function testHooksDir() $expected = dirname(__DIR__, 3) . DS . '_root' . DS . 'hooks'; $this->assertEquals($expected, hooks_dir()); } -} \ No newline at end of file +} diff --git a/tests/Unit/App/Helpers/MiscHelperTest.php b/tests/Unit/App/Helpers/MiscHelperTest.php index 5e5877c8f..824f54659 100644 --- a/tests/Unit/App/Helpers/MiscHelperTest.php +++ b/tests/Unit/App/Helpers/MiscHelperTest.php @@ -6,7 +6,6 @@ class MiscHelperTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -43,4 +42,4 @@ public function testSlugify() $this->assertEquals('ebay-com-itm-dual-arm-tv-trkparms-aid-3d111001-26brand-3dunbranded-trksid-p2380057', slugify('ebay.com/itm/DUAL-ARM-TV/?_trkparms=aid%3D111001%26brand%3DUnbranded&_trksid=p2380057')); } -} \ No newline at end of file +} diff --git a/tests/Unit/App/Helpers/UuidHelperTest.php b/tests/Unit/App/Helpers/UuidHelperTest.php index 3540cb909..89a764e04 100644 --- a/tests/Unit/App/Helpers/UuidHelperTest.php +++ b/tests/Unit/App/Helpers/UuidHelperTest.php @@ -6,7 +6,6 @@ class UuidHelperTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -47,4 +46,4 @@ public function testUuidOrderedIsChronologicallyIncreasing() 'UUIDv1 should be lexicographically increasing' ); } -} \ No newline at end of file +} diff --git a/tests/Unit/AppTestCase.php b/tests/Unit/AppTestCase.php index 54e1e8dd1..deaa1303b 100644 --- a/tests/Unit/AppTestCase.php +++ b/tests/Unit/AppTestCase.php @@ -15,7 +15,6 @@ abstract class AppTestCase extends TestCase { - protected $fs; public function setUp(): void @@ -69,18 +68,17 @@ protected function testRequest( string $method = 'GET', array $body = [], array $headers = [] - ) - { + ) { $request = new Request(); $request->create($method, $uri, $body, $headers); RouteController::setCurrentRoute([ - "route" => "test", - "method" => $method, - "controller" => 'TestController', - "action" => 'testAction', - "module" => 'Test', + 'route' => 'test', + 'method' => $method, + 'controller' => 'TestController', + 'action' => 'testAction', + 'module' => 'Test', ]); } -} \ No newline at end of file +} diff --git a/tests/Unit/Config/ConfigTest.php b/tests/Unit/Config/ConfigTest.php index b61bcd5a3..911aa284d 100644 --- a/tests/Unit/Config/ConfigTest.php +++ b/tests/Unit/Config/ConfigTest.php @@ -11,11 +11,10 @@ class ConfigTest extends AppTestCase { - public function setUp(): void { parent::setUp(); - + config()->flush(); } @@ -141,4 +140,4 @@ public function testConfigFlush() $this->assertEmpty($config->all()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Config/Helpers/ConfigHelperFunctionsTest.php b/tests/Unit/Config/Helpers/ConfigHelperFunctionsTest.php index 9c402f07f..149c17392 100644 --- a/tests/Unit/Config/Helpers/ConfigHelperFunctionsTest.php +++ b/tests/Unit/Config/Helpers/ConfigHelperFunctionsTest.php @@ -7,7 +7,6 @@ class ConfigHelperFunctionsTest extends AppTestCase { - public function testConfigHelper() { $this->assertInstanceOf(Config::class, config()); @@ -33,4 +32,4 @@ public function testConfigHelperFunctions() $this->assertFalse(config()->has('new-key')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Console/CommandDiscoveryTest.php b/tests/Unit/Console/CommandDiscoveryTest.php index d171b1a10..194e4db6d 100644 --- a/tests/Unit/Console/CommandDiscoveryTest.php +++ b/tests/Unit/Console/CommandDiscoveryTest.php @@ -8,7 +8,6 @@ class CommandDiscoveryTest extends AppTestCase { - public function testDiscoverCoreCommands() { $commandsDirectory = base_dir() @@ -41,4 +40,4 @@ public function testDiscoverCoreCommands() $this->assertNotEmpty($instance->getName()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Console/QtCommandTest.php b/tests/Unit/Console/QtCommandTest.php index b5098a195..713813599 100644 --- a/tests/Unit/Console/QtCommandTest.php +++ b/tests/Unit/Console/QtCommandTest.php @@ -10,7 +10,6 @@ class QtCommandTest extends AppTestCase { - private $command; private $tester; @@ -49,7 +48,7 @@ public function testGetArgumentAndOption() { $this->tester->execute([ 'uuid' => '12345', - '--force' => true + '--force' => true, ]); $this->assertEquals('12345', $this->command->getArgument('uuid')); @@ -71,13 +70,13 @@ public function testOutputMethods(): void $display = $this->tester->getDisplay(); - $this->assertStringContainsString("plain message", $display); + $this->assertStringContainsString('plain message', $display); - $this->assertStringContainsString("info message", $display); + $this->assertStringContainsString('info message', $display); - $this->assertStringContainsString("comment message", $display); + $this->assertStringContainsString('comment message', $display); - $this->assertStringContainsString("error message", $display); + $this->assertStringContainsString('error message', $display); } public function testQuestionOutput(): void @@ -98,4 +97,4 @@ public function testConfirmReturnsTrue(): void $this->assertTrue($this->command->confirm('Confirm action')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Debugger/DebuggerStoreTest.php b/tests/Unit/Debugger/DebuggerStoreTest.php index 82a96e03b..2f498be59 100644 --- a/tests/Unit/Debugger/DebuggerStoreTest.php +++ b/tests/Unit/Debugger/DebuggerStoreTest.php @@ -7,7 +7,6 @@ class DebuggerStoreTest extends AppTestCase { - private $debuggerStore; public function setUp(): void @@ -59,7 +58,6 @@ public function testDebuggerStoreSetAndGet() $this->assertEquals([['level1' => 'data']], $this->debuggerStore->get('key1')); $this->assertCount(1, $this->debuggerStore->get('key1')); - $this->debuggerStore->set('key1', ['level2' => 'more data']); $this->assertEquals([['level1' => 'data'], ['level2' => 'more data']], $this->debuggerStore->get('key1')); @@ -90,4 +88,3 @@ public function testFlush() $this->assertEmpty($debuggerStore->get('key2')); } } - diff --git a/tests/Unit/Debugger/DebuggerTest.php b/tests/Unit/Debugger/DebuggerTest.php index 2ed8d5d8a..b0e258a40 100644 --- a/tests/Unit/Debugger/DebuggerTest.php +++ b/tests/Unit/Debugger/DebuggerTest.php @@ -14,7 +14,6 @@ class DebuggerTest extends AppTestCase { - private $debugger; private $debugBarMock; diff --git a/tests/Unit/Di/DiTest.php b/tests/Unit/Di/DiTest.php index 2808e253f..8ca8a8a3b 100644 --- a/tests/Unit/Di/DiTest.php +++ b/tests/Unit/Di/DiTest.php @@ -24,11 +24,12 @@ public function handleService(DummyServiceInterface $service) namespace Quantum\Service { - interface DummyServiceInterface {} + interface DummyServiceInterface + { + } class DummyService extends QtService implements DummyServiceInterface { - } class CircularDependencyA @@ -65,7 +66,6 @@ public function __construct(CircularDependencyA $a) class DiTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -186,7 +186,7 @@ public function testDiCreateReturnsNewInstance() public function testDiAutowire() { - $params = Di::autowire([new TestDiController, 'index']); + $params = Di::autowire([new TestDiController(), 'index']); $this->assertInstanceOf(Request::class, $params[0]); @@ -239,4 +239,4 @@ public function testDiReset() $this->assertEmpty($containerProperty->getValue()); } } -} \ No newline at end of file +} diff --git a/tests/Unit/Environment/EnvironmentTest.php b/tests/Unit/Environment/EnvironmentTest.php index 2cfac1951..624ac1fe8 100644 --- a/tests/Unit/Environment/EnvironmentTest.php +++ b/tests/Unit/Environment/EnvironmentTest.php @@ -61,4 +61,4 @@ public function testEnvironmentAddAndUpdateRow() $this->fs->remove(App::getBaseDir() . DS . '.env.testing'); } -} \ No newline at end of file +} diff --git a/tests/Unit/Environment/Helpers/ServerHelperTest.php b/tests/Unit/Environment/Helpers/ServerHelperTest.php index 49ae06b4d..a6464346b 100644 --- a/tests/Unit/Environment/Helpers/ServerHelperTest.php +++ b/tests/Unit/Environment/Helpers/ServerHelperTest.php @@ -7,7 +7,6 @@ class ServerHelperTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -62,4 +61,4 @@ public function testGetAllHeaders() $this->assertArrayNotHasKey('SERVER_NAME', $headers); } -} \ No newline at end of file +} diff --git a/tests/Unit/Environment/ServerTest.php b/tests/Unit/Environment/ServerTest.php index e743c1966..b216888e8 100644 --- a/tests/Unit/Environment/ServerTest.php +++ b/tests/Unit/Environment/ServerTest.php @@ -7,7 +7,6 @@ class ServerTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -203,4 +202,4 @@ public function testServerAcceptedLang() $this->assertEquals('es', $server->acceptedLang()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Hook/Helpers/HookHelperTest.php b/tests/Unit/Hook/Helpers/HookHelperTest.php index cbc22abc6..aad05c673 100644 --- a/tests/Unit/Hook/Helpers/HookHelperTest.php +++ b/tests/Unit/Hook/Helpers/HookHelperTest.php @@ -8,7 +8,6 @@ class HookHelperTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -75,4 +74,4 @@ public function testUnregisteredHookAtFire() hook()->fire('SOME_EVENT'); } -} \ No newline at end of file +} diff --git a/tests/Unit/Http/Helpers/HttpHelperTest.php b/tests/Unit/Http/Helpers/HttpHelperTest.php index c9dfac3c0..8a6798d9b 100644 --- a/tests/Unit/Http/Helpers/HttpHelperTest.php +++ b/tests/Unit/Http/Helpers/HttpHelperTest.php @@ -11,7 +11,6 @@ class HttpHelperTest extends AppTestCase { - public $session; private $request; private $response; @@ -49,13 +48,13 @@ public function testBaseUrlWithModulePrefix() Router::setRoutes([ [ - "route" => "signin", - "method" => "GET", - "controller" => "AdminController", - "action" => "signin", - "module" => "admin", - 'prefix' => 'admin' - ] + 'route' => 'signin', + 'method' => 'GET', + 'controller' => 'AdminController', + 'action' => 'signin', + 'module' => 'admin', + 'prefix' => 'admin', + ], ]); $this->request->create('GET', 'https://testdomain.com/signin'); @@ -119,4 +118,4 @@ public function testRedirectWithOldData() $this->session->flush(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Http/RequestTest.php b/tests/Unit/Http/RequestTest.php index f8ae30bb7..b61c0cce4 100644 --- a/tests/Unit/Http/RequestTest.php +++ b/tests/Unit/Http/RequestTest.php @@ -8,7 +8,6 @@ class RequestTest extends AppTestCase { - public function setUp(): void { parent::setUp(); diff --git a/tests/Unit/Http/ResponseTest.php b/tests/Unit/Http/ResponseTest.php index 1110799a6..c5210da97 100644 --- a/tests/Unit/Http/ResponseTest.php +++ b/tests/Unit/Http/ResponseTest.php @@ -9,7 +9,6 @@ class ResponseTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -62,4 +61,4 @@ public function testResponseRedirect() $this->assertEquals(301, $response->getStatusCode()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Http/Traits/Request/HttpRawInputTest.php b/tests/Unit/Http/Traits/Request/HttpRawInputTest.php index 7dc47b28a..d07a0de9d 100644 --- a/tests/Unit/Http/Traits/Request/HttpRawInputTest.php +++ b/tests/Unit/Http/Traits/Request/HttpRawInputTest.php @@ -9,7 +9,6 @@ class HttpRawInputTest extends AppTestCase { - public function setUp(): void { parent::setUp(); diff --git a/tests/Unit/Http/Traits/Request/HttpRequestBodyTest.php b/tests/Unit/Http/Traits/Request/HttpRequestBodyTest.php index e9342d598..eab2227f6 100644 --- a/tests/Unit/Http/Traits/Request/HttpRequestBodyTest.php +++ b/tests/Unit/Http/Traits/Request/HttpRequestBodyTest.php @@ -7,7 +7,6 @@ class HttpRequestBodyTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -75,4 +74,4 @@ public function testRequestAll() $this->assertIsArray($request->all()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Http/Traits/Request/HttpRequestFileTest.php b/tests/Unit/Http/Traits/Request/HttpRequestFileTest.php index 5af73efe5..664ca7f18 100644 --- a/tests/Unit/Http/Traits/Request/HttpRequestFileTest.php +++ b/tests/Unit/Http/Traits/Request/HttpRequestFileTest.php @@ -9,7 +9,6 @@ class HttpRequestFileTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -91,4 +90,4 @@ public function testGetMultipleFiles() $this->assertEquals('bar.png', $image[1]->getNameWithExtension()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Http/Traits/Request/HttpRequestHeaderTest.php b/tests/Unit/Http/Traits/Request/HttpRequestHeaderTest.php index 21cac2f88..4414f0741 100644 --- a/tests/Unit/Http/Traits/Request/HttpRequestHeaderTest.php +++ b/tests/Unit/Http/Traits/Request/HttpRequestHeaderTest.php @@ -8,7 +8,6 @@ class HttpRequestHeaderTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -75,8 +74,8 @@ public function testGetBasicAuthCredentialsFromServer() $server = Server::getInstance(); $credentials = [ - 'username' => "testGlobalUsername", - 'password' => "testGlobalPassword", + 'username' => 'testGlobalUsername', + 'password' => 'testGlobalPassword', ]; $this->assertNull($request->getBasicAuthCredentials()); @@ -149,4 +148,4 @@ public function testGetReferrer() $this->assertEquals($referrer, Request::getReferrer()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Http/Traits/Request/HttpRequestInternalTest.php b/tests/Unit/Http/Traits/Request/HttpRequestInternalTest.php index 4f5e25a6d..398371d30 100644 --- a/tests/Unit/Http/Traits/Request/HttpRequestInternalTest.php +++ b/tests/Unit/Http/Traits/Request/HttpRequestInternalTest.php @@ -10,7 +10,6 @@ class HttpRequestInternalTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -41,7 +40,7 @@ public function testContentTypeIsMultipartWhenFilesProvided() 'tmp_name' => '/tmp/php123', 'error' => 0, 'size' => 100, - ] + ], ]; Request::create('POST', 'http://localhost/upload', [], [], $files); @@ -81,7 +80,7 @@ public function testUploadedFilesAreSet() 'tmp_name' => '/tmp/php456', 'error' => 0, 'size' => 456, - ] + ], ]; $request = new Request(); @@ -94,4 +93,4 @@ public function testUploadedFilesAreSet() $this->assertEquals('doc.txt', $request->getFile('document')->getNameWithExtension()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Http/Traits/Request/HttpRequestQueryTest.php b/tests/Unit/Http/Traits/Request/HttpRequestQueryTest.php index bb9218d4d..903e1d108 100644 --- a/tests/Unit/Http/Traits/Request/HttpRequestQueryTest.php +++ b/tests/Unit/Http/Traits/Request/HttpRequestQueryTest.php @@ -7,7 +7,6 @@ class HttpRequestQueryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -55,4 +54,4 @@ public function testSetGetQueryParam() $this->assertEquals('test@test.com', $request->getQueryParam('email')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Http/Traits/Request/HttpRequestUrlTest.php b/tests/Unit/Http/Traits/Request/HttpRequestUrlTest.php index 225165f8c..0363ba3c0 100644 --- a/tests/Unit/Http/Traits/Request/HttpRequestUrlTest.php +++ b/tests/Unit/Http/Traits/Request/HttpRequestUrlTest.php @@ -7,7 +7,6 @@ class HttpRequestUrlTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -70,7 +69,6 @@ public function testSetGetUri() $this->assertEquals('post/edit/12', $request->getUri()); } - public function testGetSegments() { $request = new Request(); @@ -85,4 +83,4 @@ public function testGetSegments() $this->assertNull($request->getSegment(10)); } -} \ No newline at end of file +} diff --git a/tests/Unit/Http/Traits/Response/HttpResponseBodyTest.php b/tests/Unit/Http/Traits/Response/HttpResponseBodyTest.php index 71863a934..e28ede41e 100644 --- a/tests/Unit/Http/Traits/Response/HttpResponseBodyTest.php +++ b/tests/Unit/Http/Traits/Response/HttpResponseBodyTest.php @@ -7,7 +7,6 @@ class HttpResponseBodyTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -61,7 +60,7 @@ public function testResponseJsonContent() $response->json([ 'gender' => 'male', - 'role' => 'user' + 'role' => 'user', ]); $this->assertEquals('{"firstname":"John","lastname":"Doe","age":25,"gender":"male","role":"user"}', $response->getContent()); @@ -113,7 +112,7 @@ public function testResponseXmlContent() $response->xml([ 'gender' => 'male', - 'role' => 'user' + 'role' => 'user', ]); $xml = "\n" . @@ -135,8 +134,8 @@ public function testResponseXmlWithNestedArray() $response->xml([ 'article' => [ 'title' => 'Todays news', - 'description' => 'News content' - ] + 'description' => 'News content', + ], ]); $xml = "\n" . @@ -157,8 +156,8 @@ public function testResponseXmlWithArguments() $response->xml([ 'article@{"type":"post"}' => [ 'title' => 'Todays news', - 'description@{"content":"html"}' => 'News content' - ] + 'description@{"content":"html"}' => 'News content', + ], ]); $xml = "\n" . @@ -179,8 +178,8 @@ public function testResponseXmlWithCustomRoot() $response->xml([ 'article@{"type":"post"}' => [ 'title' => 'Todays news', - 'description@{"content":"html"}' => 'News content' - ] + 'description@{"content":"html"}' => 'News content', + ], ], '', 200); $xml = "\n" . @@ -204,4 +203,4 @@ public function testResponseHtmlContent() $this->assertEquals(200, $response->getStatusCode()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Http/Traits/Response/HttpResponseHeaderTest.php b/tests/Unit/Http/Traits/Response/HttpResponseHeaderTest.php index abb187adc..b1d5b0e39 100644 --- a/tests/Unit/Http/Traits/Response/HttpResponseHeaderTest.php +++ b/tests/Unit/Http/Traits/Response/HttpResponseHeaderTest.php @@ -7,7 +7,6 @@ class HttpResponseHeaderTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -36,4 +35,4 @@ public function testResponseHeaderSetHasGetAllDelete() $this->assertNull($response->getHeader('X-Frame-Options')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Http/Traits/Response/HttpResponseStatusTest.php b/tests/Unit/Http/Traits/Response/HttpResponseStatusTest.php index 686ed8a38..7e920897e 100644 --- a/tests/Unit/Http/Traits/Response/HttpResponseStatusTest.php +++ b/tests/Unit/Http/Traits/Response/HttpResponseStatusTest.php @@ -7,7 +7,6 @@ class HttpResponseStatusTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -40,4 +39,4 @@ public function testHttpStatusGetText() $response->getText(888); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Archive/Adapters/PharAdapterTest.php b/tests/Unit/Libraries/Archive/Adapters/PharAdapterTest.php index d7f1a0305..3376ef440 100644 --- a/tests/Unit/Libraries/Archive/Adapters/PharAdapterTest.php +++ b/tests/Unit/Libraries/Archive/Adapters/PharAdapterTest.php @@ -7,7 +7,6 @@ class PharAdapterTest extends AppTestCase { - private $pharArchive; private $archiveName; @@ -44,7 +43,8 @@ public function testAddFileToPhar() $this->assertTrue( $this->pharArchive->addFile( base_dir() . DS . 'shared' . DS . 'config' . DS . 'app.php', - 'app.conf') + 'app.conf' + ) ); $this->assertTrue($this->pharArchive->offsetExists('app.conf')); @@ -65,7 +65,7 @@ public function testAddMultipleFilesToPhar() { $this->assertTrue($this->pharArchive->addMultipleFiles([ 'app.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'app.php', - 'session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php' + 'session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php', ])); $this->assertTrue($this->pharArchive->offsetExists('app.conf')); @@ -77,7 +77,7 @@ public function testPharCount() { $this->assertTrue($this->pharArchive->addMultipleFiles([ 'app.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'app.php', - 'session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php' + 'session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php', ])); $this->assertEquals(2, $this->pharArchive->count()); @@ -98,12 +98,11 @@ public function testExtractToFromPhar() $this->fs->remove(base_dir() . DS . 'sample.txt'); } - public function testDeleteFileFromPhar() { $this->pharArchive->addMultipleFiles([ 'app.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'app.php', - 'session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php' + 'session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php', ]); $this->assertEquals(2, $this->pharArchive->count()); @@ -123,7 +122,7 @@ public function testDeleteMultipleFilesUsingNameFromPhar() { $this->pharArchive->addMultipleFiles([ 'app.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'app.php', - 'directoryOne/session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php' + 'directoryOne/session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php', ]); $this->assertEquals(2, $this->pharArchive->count()); @@ -142,4 +141,4 @@ public function testDeleteMultipleFilesUsingNameFromPhar() $this->assertFalse($this->pharArchive->offsetExists('app.conf')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Archive/Adapters/ZipAdapterTest.php b/tests/Unit/Libraries/Archive/Adapters/ZipAdapterTest.php index 94e305720..2a6503c63 100644 --- a/tests/Unit/Libraries/Archive/Adapters/ZipAdapterTest.php +++ b/tests/Unit/Libraries/Archive/Adapters/ZipAdapterTest.php @@ -7,7 +7,6 @@ class ZipAdapterTest extends AppTestCase { - private $zipArchive; private $archiveName; @@ -45,7 +44,8 @@ public function testAddFileToZip() $this->assertTrue( $this->zipArchive->addFile( base_dir() . DS . 'shared' . DS . 'config' . DS . 'app.php', - 'app.conf') + 'app.conf' + ) ); $this->assertTrue($this->zipArchive->offsetExists('app.conf')); @@ -62,7 +62,7 @@ public function testAddMultipleFilesToZip() { $this->assertTrue($this->zipArchive->addMultipleFiles([ 'app.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'app.php', - 'session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php' + 'session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php', ])); $this->assertTrue($this->zipArchive->offsetExists('app.conf')); @@ -74,7 +74,7 @@ public function testZipCount() { $this->assertTrue($this->zipArchive->addMultipleFiles([ 'app.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'app.php', - 'session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php' + 'session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php', ])); $this->assertEquals(2, $this->zipArchive->count()); @@ -99,7 +99,7 @@ public function testDeleteFileFromZip() { $this->zipArchive->addMultipleFiles([ 'app.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'app.php', - 'session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php' + 'session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php', ]); $this->assertEquals(2, $this->zipArchive->count()); @@ -119,7 +119,7 @@ public function testDeleteMultipleFilesFromZip() { $this->zipArchive->addMultipleFiles([ 'app.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'app.php', - 'directoryOne/session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php' + 'directoryOne/session.conf' => base_dir() . DS . 'shared' . DS . 'config' . DS . 'session.php', ]); $this->assertEquals(2, $this->zipArchive->count()); @@ -138,4 +138,4 @@ public function testDeleteMultipleFilesFromZip() $this->assertFalse($this->zipArchive->offsetExists('app.conf')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Archive/ArchiveTest.php b/tests/Unit/Libraries/Archive/ArchiveTest.php index 7440faa90..b9aa52eb6 100644 --- a/tests/Unit/Libraries/Archive/ArchiveTest.php +++ b/tests/Unit/Libraries/Archive/ArchiveTest.php @@ -11,7 +11,6 @@ class ArchiveTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -57,4 +56,4 @@ public function testArchiveCallingInvalidMethod() $archive->callingInvalidMethod(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Archive/Factories/ArchiveFactoryTest.php b/tests/Unit/Libraries/Archive/Factories/ArchiveFactoryTest.php index 90ccb7417..7fd74c747 100644 --- a/tests/Unit/Libraries/Archive/Factories/ArchiveFactoryTest.php +++ b/tests/Unit/Libraries/Archive/Factories/ArchiveFactoryTest.php @@ -12,7 +12,6 @@ class ArchiveFactoryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -59,4 +58,4 @@ public function testArchiveFactoryReturnsSameInstance() $this->assertSame($archive1, $archive2); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Asset/AssetManagerTest.php b/tests/Unit/Libraries/Asset/AssetManagerTest.php index 45697661a..4663ee9d2 100644 --- a/tests/Unit/Libraries/Asset/AssetManagerTest.php +++ b/tests/Unit/Libraries/Asset/AssetManagerTest.php @@ -8,7 +8,6 @@ class AssetManagerTest extends AppTestCase { - private $assetManager; public function setUp(): void @@ -24,17 +23,17 @@ public function testRegisterPublishDump() { $this->assetManager->register([ new Asset(Asset::CSS, 'css/style.css'), - new Asset(Asset::CSS, 'css/responsive.css') + new Asset(Asset::CSS, 'css/responsive.css'), ]); $this->assetManager->register([ new Asset(Asset::JS, 'js/bootstrap.js', '', 1), - new Asset(Asset::JS, 'js/bootstrap-datepicker.min.js', '', 2) + new Asset(Asset::JS, 'js/bootstrap-datepicker.min.js', '', 2), ]); $this->assetManager->register([ new Asset(Asset::CSS, 'css/reset.css', '', 0), - new Asset(Asset::CSS, 'css/media.css', '', 2) + new Asset(Asset::CSS, 'css/media.css', '', 2), ]); $this->assetManager->register([ @@ -63,7 +62,6 @@ public function testRegisterPublishDump() '' . PHP_EOL; '' . PHP_EOL; - $this->assetManager->dump(AssetManager::STORES['js']); $this->assertStringContainsString($expectedOutput, ob_get_contents()); @@ -77,22 +75,26 @@ public function testAssetGetTag() $this->assertEquals( '' . PHP_EOL, - $this->assetManager->get('jQuery')->tag()); + $this->assetManager->get('jQuery')->tag() + ); } public function testAssetUrl() { $this->assertEquals( 'http://mydomain.com/assets/icons/person.png', - $this->assetManager->url('icons/person.png')); + $this->assetManager->url('icons/person.png') + ); $this->assertEquals( 'http://mydomain.com/assets/fonts/arial.ttf', - $this->assetManager->url('fonts/arial.ttf')); + $this->assetManager->url('fonts/arial.ttf') + ); $this->assertEquals( 'https://code.jquery.com/jquery-3.2.1.min.js', - $this->assetManager->url('https://code.jquery.com/jquery-3.2.1.min.js')); + $this->assetManager->url('https://code.jquery.com/jquery-3.2.1.min.js') + ); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Asset/AssetTest.php b/tests/Unit/Libraries/Asset/AssetTest.php index 7ac90ce3b..1c3a89b4d 100644 --- a/tests/Unit/Libraries/Asset/AssetTest.php +++ b/tests/Unit/Libraries/Asset/AssetTest.php @@ -7,7 +7,6 @@ class AssetTest extends AppTestCase { - private $asset; public function setUp(): void @@ -51,14 +50,16 @@ public function testAssetUrl() { $this->assertEquals( 'http://mydomain.com/assets/scripts/jquery.js', - $this->asset->url()); + $this->asset->url() + ); } public function testAssetTag() { $this->assertEquals( '' . PHP_EOL, - $this->asset->tag()); + $this->asset->tag() + ); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Asset/Helpers/AssetHelperFunctionsTest.php b/tests/Unit/Libraries/Asset/Helpers/AssetHelperFunctionsTest.php index a9587d63c..a2e2134dc 100644 --- a/tests/Unit/Libraries/Asset/Helpers/AssetHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Asset/Helpers/AssetHelperFunctionsTest.php @@ -8,7 +8,6 @@ class AssetHelperFunctionsTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -36,13 +35,13 @@ public function testPublishedAssets() asset()->register([ new Asset(Asset::CSS, 'css/style.css'), - new Asset(Asset::CSS, 'css/responsive.css') + new Asset(Asset::CSS, 'css/responsive.css'), ]); asset()->register([ new Asset(Asset::JS, 'js/bootstrap.js'), new Asset(Asset::JS, 'js/bootstrap-datepicker.min.js'), - new Asset(Asset::JS, 'js/jQuery.js', 'jQuery', 0) + new Asset(Asset::JS, 'js/jQuery.js', 'jQuery', 0), ]); $expectedOutput = '' . PHP_EOL . @@ -60,4 +59,4 @@ public function testPublishedAssets() ob_get_clean(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Auth/Adapters/JwtAuthAdapterTest.php b/tests/Unit/Libraries/Auth/Adapters/JwtAuthAdapterTest.php index 05c6cc6d5..b61a2cf28 100644 --- a/tests/Unit/Libraries/Auth/Adapters/JwtAuthAdapterTest.php +++ b/tests/Unit/Libraries/Auth/Adapters/JwtAuthAdapterTest.php @@ -12,7 +12,6 @@ class JwtAuthAdapterTest extends AuthTestCase { - private $jwtAuth; public function setUp(): void @@ -28,11 +27,10 @@ public function setUp(): void 'aud' => 'audience', 'iat' => time(), 'nbf' => time() + 1, - 'exp' => time() + 60 + 'exp' => time() + 60, ]); - $this->jwtAuth = new JwtAuthAdapter($this->authService, $this->mailer, new Hasher, $jwt); - + $this->jwtAuth = new JwtAuthAdapter($this->authService, $this->mailer, new Hasher(), $jwt); $admin = $this->jwtAuth->signup($this->adminUser); @@ -218,4 +216,4 @@ public function testApiRefreshUser() $this->assertEquals('Human', $refreshedUser->lastname); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Auth/Adapters/SessionAuthAdapterTest.php b/tests/Unit/Libraries/Auth/Adapters/SessionAuthAdapterTest.php index a2d33a75b..c3ecaffa9 100644 --- a/tests/Unit/Libraries/Auth/Adapters/SessionAuthAdapterTest.php +++ b/tests/Unit/Libraries/Auth/Adapters/SessionAuthAdapterTest.php @@ -11,7 +11,6 @@ class SessionAuthAdapterTest extends AuthTestCase { - private $sessionAuth; public function setUp(): void @@ -20,7 +19,7 @@ public function setUp(): void config()->set('auth.two_fa', false); - $this->sessionAuth = new SessionAuthAdapter($this->authService, $this->mailer, new Hasher); + $this->sessionAuth = new SessionAuthAdapter($this->authService, $this->mailer, new Hasher()); $admin = $this->sessionAuth->signup($this->adminUser); @@ -192,4 +191,4 @@ public function testWebRefreshUser() $this->assertEquals('Human', $refreshedUser->lastname); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Auth/AuthTest.php b/tests/Unit/Libraries/Auth/AuthTest.php index 9a07226e1..c2f329ce1 100644 --- a/tests/Unit/Libraries/Auth/AuthTest.php +++ b/tests/Unit/Libraries/Auth/AuthTest.php @@ -12,7 +12,6 @@ class AuthTest extends AuthTestCase { - private $jwt; public function setUp(): void @@ -27,24 +26,24 @@ public function setUp(): void 'aud' => 'audience', 'iat' => time(), 'nbf' => time() + 1, - 'exp' => time() + 60 + 'exp' => time() + 60, ]); } public function testAuthGetAdapter() { - $auth = new Auth(new SessionAuthAdapter($this->authService, $this->mailer, new Hasher)); + $auth = new Auth(new SessionAuthAdapter($this->authService, $this->mailer, new Hasher())); $this->assertInstanceOf(AuthenticatableInterface::class, $auth->getAdapter()); - $auth = new Auth(new JwtAuthAdapter($this->authService, $this->mailer, new Hasher, $this->jwt)); + $auth = new Auth(new JwtAuthAdapter($this->authService, $this->mailer, new Hasher(), $this->jwt)); $this->assertInstanceOf(AuthenticatableInterface::class, $auth->getAdapter()); } public function testAuthCallingValidMethod() { - $auth = new Auth(new JwtAuthAdapter($this->authService, $this->mailer, new Hasher, $this->jwt)); + $auth = new Auth(new JwtAuthAdapter($this->authService, $this->mailer, new Hasher(), $this->jwt)); $user = $auth->getAdapter()->signup($this->adminUser); @@ -59,7 +58,7 @@ public function testAuthCallingValidMethod() public function testAuthCallingInvalidMethod() { - $auth = new Auth(new JwtAuthAdapter($this->authService, $this->mailer, new Hasher, $this->jwt)); + $auth = new Auth(new JwtAuthAdapter($this->authService, $this->mailer, new Hasher(), $this->jwt)); $this->expectException(AuthException::class); @@ -67,4 +66,4 @@ public function testAuthCallingInvalidMethod() $auth->callingInvalidMethod(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Auth/AuthTestCase.php b/tests/Unit/Libraries/Auth/AuthTestCase.php index 425d6250a..9c6f3523e 100644 --- a/tests/Unit/Libraries/Auth/AuthTestCase.php +++ b/tests/Unit/Libraries/Auth/AuthTestCase.php @@ -63,7 +63,7 @@ abstract class AuthTestCase extends AppTestCase 'refresh_token' => '', 'otp' => '', 'otp_expiry_in' => '', - 'otp_token' => '' + 'otp_token' => '', ]; protected $guestUser = [ 'email' => 'guest@qt.com', @@ -163,4 +163,4 @@ public function setUp(): void $this->mailer->shouldReceive('send')->andReturn(true); } } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Auth/Factories/AuthFactoryTest.php b/tests/Unit/Libraries/Auth/Factories/AuthFactoryTest.php index 9368a78a2..f636ec3ea 100644 --- a/tests/Unit/Libraries/Auth/Factories/AuthFactoryTest.php +++ b/tests/Unit/Libraries/Auth/Factories/AuthFactoryTest.php @@ -11,7 +11,6 @@ class AuthFactoryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -65,4 +64,4 @@ public function testAuthFactoryReturnsSameInstance() $this->assertSame($auth1, $auth2); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Auth/Helpers/AuthHelperFunctionsTest.php b/tests/Unit/Libraries/Auth/Helpers/AuthHelperFunctionsTest.php index 23b6097b8..a27dc504c 100644 --- a/tests/Unit/Libraries/Auth/Helpers/AuthHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Auth/Helpers/AuthHelperFunctionsTest.php @@ -9,7 +9,6 @@ class AuthHelperFunctionsTest extends AppTestCase { - public function testAuthHelperGetDefaultAuth() { $this->assertInstanceOf(Auth::class, auth()); @@ -30,4 +29,4 @@ public function testAuthHelperGetJwtAuth() $this->assertInstanceOf(JwtAuthAdapter::class, auth(Auth::JWT)->getAdapter()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Auth/UserTest.php b/tests/Unit/Libraries/Auth/UserTest.php index 0aa8631d1..07a9b53d2 100644 --- a/tests/Unit/Libraries/Auth/UserTest.php +++ b/tests/Unit/Libraries/Auth/UserTest.php @@ -7,7 +7,6 @@ class UserTest extends TestCase { - private $user; private $fields = [ @@ -16,7 +15,7 @@ class UserTest extends TestCase 'lastname' => ['name' => 'lastname', 'visible' => true], 'role' => ['name' => 'role', 'visible' => true], 'username' => ['name' => 'email', 'visible' => true], - 'password' => ['name' => 'password', 'visible' => false] + 'password' => ['name' => 'password', 'visible' => false], ]; public function setUp(): void @@ -88,4 +87,4 @@ public function testSetGetFieldValue() $this->assertEquals('Johnny', $this->user->getFieldValue('firstname')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Cache/Adapters/DatabaseAdapterTest.php b/tests/Unit/Libraries/Cache/Adapters/DatabaseAdapterTest.php index 8b18f6885..5e606d4a2 100644 --- a/tests/Unit/Libraries/Cache/Adapters/DatabaseAdapterTest.php +++ b/tests/Unit/Libraries/Cache/Adapters/DatabaseAdapterTest.php @@ -9,7 +9,6 @@ class DatabaseAdapterTest extends AppTestCase { - private $databaseCache; public function setUp(): void @@ -27,7 +26,7 @@ public function setUp(): void $params = [ 'prefix' => 'test', 'table' => 'cache', - 'ttl' => 60 + 'ttl' => 60, ]; $this->databaseCache = new DatabaseAdapter($params); @@ -152,7 +151,7 @@ public function testDatabaseAdapterExpired() $params = [ 'prefix' => 'test', 'table' => 'cache', - 'ttl' => -1 + 'ttl' => -1, ]; $databaseCache = new DatabaseAdapter($params); @@ -162,4 +161,4 @@ public function testDatabaseAdapterExpired() $this->assertNull($databaseCache->get('test')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Cache/Adapters/FileAdapterTest.php b/tests/Unit/Libraries/Cache/Adapters/FileAdapterTest.php index e08dee895..d9f05da43 100644 --- a/tests/Unit/Libraries/Cache/Adapters/FileAdapterTest.php +++ b/tests/Unit/Libraries/Cache/Adapters/FileAdapterTest.php @@ -7,7 +7,6 @@ class FileAdapterTest extends AppTestCase { - private $fileCache; public function setUp(): void @@ -17,7 +16,7 @@ public function setUp(): void $params = [ 'prefix' => 'test', 'path' => base_dir() . DS . 'cache' . DS . 'data', - 'ttl' => 60 + 'ttl' => 60, ]; $this->fileCache = new FileAdapter($params); @@ -129,7 +128,7 @@ public function testFileAdapterExpired() $params = [ 'prefix' => 'test', 'path' => base_dir() . DS . 'cache' . DS . 'data', - 'ttl' => -1 + 'ttl' => -1, ]; $fileCache = new FileAdapter($params); diff --git a/tests/Unit/Libraries/Cache/Adapters/MemcachedAdapterTest.php b/tests/Unit/Libraries/Cache/Adapters/MemcachedAdapterTest.php index 528e7186a..1e6a06dc5 100644 --- a/tests/Unit/Libraries/Cache/Adapters/MemcachedAdapterTest.php +++ b/tests/Unit/Libraries/Cache/Adapters/MemcachedAdapterTest.php @@ -7,7 +7,6 @@ class MemcachedAdapterTest extends AppTestCase { - private $memCached; public function setUp(): void @@ -18,7 +17,7 @@ public function setUp(): void 'prefix' => 'test', 'host' => '127.0.0.1', 'port' => 11211, - 'ttl' => 60 + 'ttl' => 60, ]; $this->memCached = new MemcachedAdapter($params); @@ -142,7 +141,7 @@ public function testMemcachedAdapterExpired() 'prefix' => 'test', 'host' => '127.0.0.1', 'port' => 11211, - 'ttl' => 1 + 'ttl' => 1, ]; $memCached = new MemcachedAdapter($params); diff --git a/tests/Unit/Libraries/Cache/Adapters/RedisAdapterTest.php b/tests/Unit/Libraries/Cache/Adapters/RedisAdapterTest.php index 1de23e02f..8b4a92031 100644 --- a/tests/Unit/Libraries/Cache/Adapters/RedisAdapterTest.php +++ b/tests/Unit/Libraries/Cache/Adapters/RedisAdapterTest.php @@ -7,7 +7,6 @@ class RedisAdapterTest extends AppTestCase { - private $redis; public function setUp(): void @@ -18,7 +17,7 @@ public function setUp(): void 'prefix' => 'test', 'host' => '127.0.0.1', 'port' => 6379, - 'ttl' => 60 + 'ttl' => 60, ]; $this->redis = new RedisAdapter($params); @@ -142,7 +141,7 @@ public function testRedisAdapterExpired() 'prefix' => 'test', 'host' => '127.0.0.1', 'port' => 6379, - 'ttl' => 1 + 'ttl' => 1, ]; $redis = new RedisAdapter($params); diff --git a/tests/Unit/Libraries/Cache/CacheTest.php b/tests/Unit/Libraries/Cache/CacheTest.php index 46906cb7e..81ed954e2 100644 --- a/tests/Unit/Libraries/Cache/CacheTest.php +++ b/tests/Unit/Libraries/Cache/CacheTest.php @@ -10,7 +10,6 @@ class CacheTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -21,7 +20,7 @@ public function testCacheGetAdapter() $params = [ 'prefix' => 'test', 'path' => base_dir() . DS . 'cache' . DS . 'data', - 'ttl' => 60 + 'ttl' => 60, ]; $cache = new Cache(new FileAdapter($params)); @@ -36,7 +35,7 @@ public function testCacheCallingValidMethod() $params = [ 'prefix' => 'test', 'path' => base_dir() . DS . 'cache' . DS . 'data', - 'ttl' => 60 + 'ttl' => 60, ]; $cache = new Cache(new FileAdapter($params)); @@ -51,7 +50,7 @@ public function testCacheCallingInvalidMethod() $params = [ 'prefix' => 'test', 'path' => base_dir() . DS . 'cache' . DS . 'data', - 'ttl' => 60 + 'ttl' => 60, ]; $cache = new Cache(new FileAdapter($params)); @@ -62,4 +61,4 @@ public function testCacheCallingInvalidMethod() $cache->callingInvalidMethod(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Cache/Factories/CacheFactoryTest.php b/tests/Unit/Libraries/Cache/Factories/CacheFactoryTest.php index 9fb379b7d..086d97b7f 100644 --- a/tests/Unit/Libraries/Cache/Factories/CacheFactoryTest.php +++ b/tests/Unit/Libraries/Cache/Factories/CacheFactoryTest.php @@ -13,7 +13,6 @@ class CacheFactoryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -79,4 +78,4 @@ public function testCacheFactoryReturnsSameInstance() $this->assertSame($cache1, $cache2); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Cache/Helpers/CacheHelperFunctionsTest.php b/tests/Unit/Libraries/Cache/Helpers/CacheHelperFunctionsTest.php index 5e01c453a..71a42c219 100644 --- a/tests/Unit/Libraries/Cache/Helpers/CacheHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Cache/Helpers/CacheHelperFunctionsTest.php @@ -11,7 +11,6 @@ class CacheHelperFunctionsTest extends AppTestCase { - public function testCacheHelperGetDefaultCache() { $this->assertInstanceOf(Cache::class, cache()); @@ -46,4 +45,4 @@ public function testCacheHelperGetRedisCache() $this->assertInstanceOf(RedisAdapter::class, cache(Cache::REDIS)->getAdapter()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Captcha/Adapters/HcaptchaAdapterTest.php b/tests/Unit/Libraries/Captcha/Adapters/HcaptchaAdapterTest.php index 1498787ab..ebe77abf3 100644 --- a/tests/Unit/Libraries/Captcha/Adapters/HcaptchaAdapterTest.php +++ b/tests/Unit/Libraries/Captcha/Adapters/HcaptchaAdapterTest.php @@ -24,7 +24,6 @@ public function setUp(): void config()->set('captcha.hcaptcha.secret_key', $this->secretKey); config()->set('captcha.hcaptcha.site_key', $this->siteKey); - $this->httpClientMock = Mockery::mock(HttpClient::class); $this->adapter = new HcaptchaAdapter(config()->get('captcha.hcaptcha'), $this->httpClientMock); @@ -68,27 +67,35 @@ public function testHcaptchaVisibleAddToForm() $this->assertEquals( '
', - $this->adapter->addToForm('signUpForm')); + $this->adapter->addToForm('signUpForm') + ); } public function testHcaptchaInvisibleAddToForm() { $this->adapter->setType(CaptchaInterface::CAPTCHA_INVISIBLE); - $this->assertEquals( - '', - $this->adapter->addToForm('signUpForm')); + '; + + $expected = str_replace("\r\n", "\n", $expected); + $actual = str_replace("\r\n", "\n", $actual); + + $this->assertSame($expected, $actual); } public function testHcaptchaVerifySuccess() @@ -111,10 +118,9 @@ public function testHcaptchaVerifySuccess() $this->httpClientMock ->shouldReceive('getResponseBody') ->andReturn((object)[ - 'success' => true + 'success' => true, ]); - $result = $this->adapter->verify('valid_code'); $this->assertTrue($result); @@ -135,12 +141,11 @@ public function testHcaptchaVerifyFailure() ->shouldReceive('start') ->andReturnSelf(); - $this->httpClientMock ->shouldReceive('getResponseBody') ->andReturn((object)[ 'success' => false, - 'error-codes' => ['invalid-input-response'] + 'error-codes' => ['invalid-input-response'], ]); $result = $this->adapter->verify('invalid_code'); @@ -149,4 +154,4 @@ public function testHcaptchaVerifyFailure() $this->assertEquals('invalid-input-response', $this->adapter->getErrorMessage()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Captcha/Adapters/RecaptchaAdapterTest.php b/tests/Unit/Libraries/Captcha/Adapters/RecaptchaAdapterTest.php index c281dcfd5..a7255f5ef 100644 --- a/tests/Unit/Libraries/Captcha/Adapters/RecaptchaAdapterTest.php +++ b/tests/Unit/Libraries/Captcha/Adapters/RecaptchaAdapterTest.php @@ -25,7 +25,6 @@ public function setUp(): void config()->set('captcha.recaptcha.secret_key', $this->secretKey); config()->set('captcha.recaptcha.site_key', $this->siteKey); - $this->httpClientMock = Mockery::mock(HttpClient::class); $this->adapter = new RecaptchaAdapter(config()->get('captcha.recaptcha'), $this->httpClientMock); @@ -69,27 +68,35 @@ public function testRecaptchaVisibleAddToForm() $this->assertEquals( '
', - $this->adapter->addToForm('signUpForm')); + $this->adapter->addToForm('signUpForm') + ); } public function testRecaptchaInvisibleAddToForm() { $this->adapter->setType(CaptchaInterface::CAPTCHA_INVISIBLE); - $this->assertEquals( - '', - $this->adapter->addToForm('signUpForm')); + '; + + $expected = str_replace("\r\n", "\n", $expected); + $actual = str_replace("\r\n", "\n", $actual); + + $this->assertSame($expected, $actual); } public function testRecaptchaVerifySuccess() @@ -112,10 +119,9 @@ public function testRecaptchaVerifySuccess() $this->httpClientMock ->shouldReceive('getResponseBody') ->andReturn((object)[ - 'success' => true + 'success' => true, ]); - $result = $this->adapter->verify('valid_code'); $this->assertTrue($result); @@ -136,12 +142,11 @@ public function testRecaptchaVerifyFailure() ->shouldReceive('start') ->andReturnSelf(); - $this->httpClientMock ->shouldReceive('getResponseBody') ->andReturn((object)[ 'success' => false, - 'error-codes' => ['invalid-input-response'] + 'error-codes' => ['invalid-input-response'], ]); $result = $this->adapter->verify('invalid_code'); @@ -150,4 +155,4 @@ public function testRecaptchaVerifyFailure() $this->assertEquals('invalid-input-response', $this->adapter->getErrorMessage()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Captcha/CaptchaTest.php b/tests/Unit/Libraries/Captcha/CaptchaTest.php index e89e0819b..a59c6bf19 100644 --- a/tests/Unit/Libraries/Captcha/CaptchaTest.php +++ b/tests/Unit/Libraries/Captcha/CaptchaTest.php @@ -11,7 +11,6 @@ class CaptchaTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -22,7 +21,7 @@ public function testCaptchaGetAdapter() $params = [ 'type' => 'visible', 'secret_key' => '0xE1a02fB374Bf2', - 'site_key' => '07737dfc-abfa-66ac44365d0c' + 'site_key' => '07737dfc-abfa-66ac44365d0c', ]; $captcha = new Captcha(new RecaptchaAdapter($params, new HttpClient())); @@ -37,7 +36,7 @@ public function testCaptchaCallingValidMethod() $params = [ 'type' => 'visible', 'secret_key' => '0xE1a02fB374Bf2', - 'site_key' => '07737dfc-abfa-66ac44365d0c' + 'site_key' => '07737dfc-abfa-66ac44365d0c', ]; $captcha = new Captcha(new RecaptchaAdapter($params, new HttpClient())); @@ -50,7 +49,7 @@ public function testCacheCallingInvalidMethod() $params = [ 'type' => 'visible', 'secret_key' => '0xE1a02fB374Bf2', - 'site_key' => '07737dfc-abfa-66ac44365d0c' + 'site_key' => '07737dfc-abfa-66ac44365d0c', ]; $captcha = new Captcha(new RecaptchaAdapter($params, new HttpClient())); @@ -61,4 +60,4 @@ public function testCacheCallingInvalidMethod() $captcha->callingInvalidMethod(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Captcha/Factories/CaptchaFactoryTest.php b/tests/Unit/Libraries/Captcha/Factories/CaptchaFactoryTest.php index 4a9df0fb1..1d6cde88d 100644 --- a/tests/Unit/Libraries/Captcha/Factories/CaptchaFactoryTest.php +++ b/tests/Unit/Libraries/Captcha/Factories/CaptchaFactoryTest.php @@ -11,7 +11,6 @@ class CaptchaFactoryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -63,4 +62,4 @@ public function testAuthFactoryReturnsSameInstance() $this->assertSame($captcha1, $captcha2); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Captcha/Helpers/CaptchaHelperFunctionsTest.php b/tests/Unit/Libraries/Captcha/Helpers/CaptchaHelperFunctionsTest.php index 54734d37c..387f31ef7 100644 --- a/tests/Unit/Libraries/Captcha/Helpers/CaptchaHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Captcha/Helpers/CaptchaHelperFunctionsTest.php @@ -9,7 +9,6 @@ class CaptchaHelperFunctionsTest extends AppTestCase { - public function testCaptchaHelperGetDefaultCaptchaAdapter() { $this->assertInstanceOf(Captcha::class, captcha()); @@ -30,4 +29,4 @@ public function testCaptchaHelperGetHcaptchaAdapter() $this->assertInstanceOf(HcaptchaAdapter::class, captcha(Captcha::HCAPTCHA)->getAdapter()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Cookie/CookieTest.php b/tests/Unit/Libraries/Cookie/CookieTest.php index 613a84d58..9a5e9ca62 100644 --- a/tests/Unit/Libraries/Cookie/CookieTest.php +++ b/tests/Unit/Libraries/Cookie/CookieTest.php @@ -7,7 +7,6 @@ class CookieTest extends AppTestCase { - private $cookie; private $storage = []; diff --git a/tests/Unit/Libraries/Cookie/Helpers/CookieHelperFunctionsTest.php b/tests/Unit/Libraries/Cookie/Helpers/CookieHelperFunctionsTest.php index 59013bb7a..af2703539 100644 --- a/tests/Unit/Libraries/Cookie/Helpers/CookieHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Cookie/Helpers/CookieHelperFunctionsTest.php @@ -26,4 +26,4 @@ public function testCookieMethodsViaHelper() $this->assertFalse(cookie()->has('test')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Csrf/CsrfTest.php b/tests/Unit/Libraries/Csrf/CsrfTest.php index ab77ebd36..7d2adfc9e 100644 --- a/tests/Unit/Libraries/Csrf/CsrfTest.php +++ b/tests/Unit/Libraries/Csrf/CsrfTest.php @@ -10,7 +10,6 @@ class CsrfTest extends AppTestCase { - private $csrf; private $request; private $key = '#321dMd3QS15%'; @@ -44,7 +43,7 @@ public function testCheckTokenSuccess() $this->request->create('POST', '/submit', [ 'firstname' => 'Josn', 'lastname' => 'Doe', - 'csrf-token' => $token + 'csrf-token' => $token, ]); $this->assertTrue($this->csrf->checkToken($this->request)); @@ -70,7 +69,7 @@ public function testCheckTokenMismatch() $this->request->create('POST', '/submit', [ 'firstname' => 'Josn', 'lastname' => 'Doe', - 'csrf-token' => 'wrong-csrf-token' + 'csrf-token' => 'wrong-csrf-token', ]); $this->expectException(CsrfException::class); @@ -80,4 +79,4 @@ public function testCheckTokenMismatch() $this->assertTrue($this->csrf->checkToken($this->request)); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Csrf/Helpers/CsrfHelperFunctionsTest.php b/tests/Unit/Libraries/Csrf/Helpers/CsrfHelperFunctionsTest.php index 772dca3fb..6e1b5acf0 100644 --- a/tests/Unit/Libraries/Csrf/Helpers/CsrfHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Csrf/Helpers/CsrfHelperFunctionsTest.php @@ -21,4 +21,4 @@ public function testCsrfToken() $this->assertTrue(csrf()->checkToken($request)); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/Adapters/DatabaseSeeder.php b/tests/Unit/Libraries/Database/Adapters/DatabaseSeeder.php index 1c5d547fb..8f0fdd216 100644 --- a/tests/Unit/Libraries/Database/Adapters/DatabaseSeeder.php +++ b/tests/Unit/Libraries/Database/Adapters/DatabaseSeeder.php @@ -118,4 +118,4 @@ private function seedNotes(): void $this->noteModel->save(); } } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/Adapters/Idiorm/IdiormDbalTest.php b/tests/Unit/Libraries/Database/Adapters/Idiorm/IdiormDbalTest.php index 80db42555..8e6538a99 100644 --- a/tests/Unit/Libraries/Database/Adapters/Idiorm/IdiormDbalTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Idiorm/IdiormDbalTest.php @@ -20,4 +20,3 @@ public function testIdiormGetTable() $this->assertEquals('users', $userModel->getTable()); } } - diff --git a/tests/Unit/Libraries/Database/Adapters/Idiorm/IdiormDbalTestCase.php b/tests/Unit/Libraries/Database/Adapters/Idiorm/IdiormDbalTestCase.php index 855ebce1e..799c2efba 100644 --- a/tests/Unit/Libraries/Database/Adapters/Idiorm/IdiormDbalTestCase.php +++ b/tests/Unit/Libraries/Database/Adapters/Idiorm/IdiormDbalTestCase.php @@ -9,7 +9,6 @@ abstract class IdiormDbalTestCase extends AppTestCase { - private $tables = [ 'users', 'user_professions', @@ -17,7 +16,7 @@ abstract class IdiormDbalTestCase extends AppTestCase 'user_events', 'user_meetings', 'tickets', - 'notes' + 'notes', ]; public function setUp(): void @@ -66,16 +65,16 @@ private function deleteTables() private function createUserTable() { - IdiormDbal::execute("CREATE TABLE IF NOT EXISTS users ( + IdiormDbal::execute('CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY, email VARCHAR(255), password VARCHAR(255) - )"); + )'); } private function createProfileTable() { - IdiormDbal::execute("CREATE TABLE IF NOT EXISTS profiles ( + IdiormDbal::execute('CREATE TABLE IF NOT EXISTS profiles ( id INTEGER PRIMARY KEY, user_id INTEGER(11), firstname VARCHAR(255), @@ -83,65 +82,65 @@ private function createProfileTable() age INTEGER(11), country VARCHAR(255), created_at DATETIME - )"); + )'); } private function createEventsTable() { - IdiormDbal::execute("CREATE TABLE IF NOT EXISTS events ( + IdiormDbal::execute('CREATE TABLE IF NOT EXISTS events ( id INTEGER PRIMARY KEY, title VARCHAR(255), country VARCHAR(255), started_at DATETIME - )"); + )'); } private function createUserEventTable() { - IdiormDbal::execute("CREATE TABLE IF NOT EXISTS user_events ( + IdiormDbal::execute('CREATE TABLE IF NOT EXISTS user_events ( id INTEGER PRIMARY KEY, user_id INTEGER(11), event_id INTEGER(11), confirmed VARCHAR(3), created_at DATETIME - )"); + )'); } private function createUserProfessionTable() { - IdiormDbal::execute("CREATE TABLE IF NOT EXISTS user_professions ( + IdiormDbal::execute('CREATE TABLE IF NOT EXISTS user_professions ( id INTEGER PRIMARY KEY, user_id INTEGER(11), title VARCHAR(255) - )"); + )'); } private function createUserMeetingsTable() { - IdiormDbal::execute("CREATE TABLE IF NOT EXISTS user_meetings ( + IdiormDbal::execute('CREATE TABLE IF NOT EXISTS user_meetings ( id INTEGER PRIMARY KEY, user_id INTEGER (11), title VARCHAR (255), start_date DATETIME - )"); + )'); } private function createTicketsTable() { - IdiormDbal::execute("CREATE TABLE IF NOT EXISTS tickets ( + IdiormDbal::execute('CREATE TABLE IF NOT EXISTS tickets ( id INTEGER PRIMARY KEY, meeting_id INTEGER (11), type VARCHAR (255), number VARCHAR (255) - )"); + )'); } private function createNotesTable() { - IdiormDbal::execute("CREATE TABLE IF NOT EXISTS notes ( + IdiormDbal::execute('CREATE TABLE IF NOT EXISTS notes ( id INTEGER PRIMARY KEY, ticket_id INTEGER (11), note text - )"); + )'); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/CriteriaIdiormTest.php b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/CriteriaIdiormTest.php index 9ea41d890..710c5e4f4 100644 --- a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/CriteriaIdiormTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/CriteriaIdiormTest.php @@ -7,7 +7,6 @@ class CriteriaIdiormTest extends IdiormDbalTestCase { - public function testIdiormCriteriaEquals() { $userProfileModel = new IdiormDbal('profiles'); @@ -147,7 +146,7 @@ public function testIdiormCriteriaColumnsEqual() ->criteria('profiles.country', '#=#', 'events.country') ->get(); - $expectedQuery = "SELECT * FROM `profiles` JOIN `user_events` ON `user_events`.`user_id` = `profiles`.`user_id` JOIN `events` ON `user_events`.`event_id` = `events`.`id` WHERE profiles.country = events.country"; + $expectedQuery = 'SELECT * FROM `profiles` JOIN `user_events` ON `user_events`.`user_id` = `profiles`.`user_id` JOIN `events` ON `user_events`.`event_id` = `events`.`id` WHERE profiles.country = events.country'; $this->assertEquals($expectedQuery, IdiormDbal::lastQuery()); } @@ -174,7 +173,7 @@ public function testIdiormMultipleOrCriterias() $eventsModel->criterias([ ['title', '=', 'Music'], ['title', '=', 'Dance'], - ['title', '=', 'Art'] + ['title', '=', 'Art'], ])->groupBy('title')->get(); $expectedQuery = "SELECT * FROM `events` WHERE (`title` = 'Music' OR `title` = 'Dance' OR `title` = 'Art') GROUP BY `title`"; @@ -188,7 +187,7 @@ public function testIdiormAndOrCriterias() $eventsModel->criterias([ ['title', '=', 'Music'], - ['title', '=', 'Design'] + ['title', '=', 'Design'], ], ['country', '=', 'Ireland'])->get(); $expectedQuery = "SELECT * FROM `events` WHERE (`title` = 'Music' OR `title` = 'Design') AND `country` = 'Ireland'"; @@ -241,4 +240,4 @@ public function testIdiormIsNotNull() $this->assertNotNull($event->prop('started_at')); } } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/JoinIdiormTest.php b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/JoinIdiormTest.php index 782a0c9dc..4cbbb6de0 100644 --- a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/JoinIdiormTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/JoinIdiormTest.php @@ -17,7 +17,6 @@ use Quantum\Model\ModelCollection; use Quantum\Model\QtModel; - class BrokenProfileMissingTypeModel extends QtModel { public $table = 'profiles'; @@ -28,7 +27,7 @@ public function relations(): array TestUserModel::class => [ // 'type' intentionally missing 'foreign_key' => 'user_id', - 'local_key' => 'id', + 'local_key' => 'id', ], ]; } @@ -44,7 +43,7 @@ public function relations(): array TestUserModel::class => [ 'type' => 'SIDEWAYS', 'foreign_key' => 'user_id', - 'local_key' => 'id', + 'local_key' => 'id', ], ]; } @@ -52,7 +51,6 @@ public function relations(): array class JoinIdiormTest extends IdiormDbalTestCase { - public function testIdiormJoinAndInnerJoin() { $userModel = new IdiormDbal('users'); @@ -142,9 +140,9 @@ public function testIdiormJoinToHasOne() $this->assertArrayHasKey('country', $user); - $expectedQuery = "SELECT * + $expectedQuery = 'SELECT * FROM `users` - JOIN `profiles` ON `profiles`.`user_id` = `users`.`id`"; + JOIN `profiles` ON `profiles`.`user_id` = `users`.`id`'; $expectedQuery = preg_replace('/[\s\t]+/', ' ', preg_replace('/' . PHP_EOL . '+/', '', $expectedQuery)); @@ -174,9 +172,9 @@ public function testIdiormJoinToBelongsTo() $this->assertArrayHasKey('country', $user); - $expectedQuery = "SELECT * + $expectedQuery = 'SELECT * FROM `profiles` - JOIN `users` ON `users`.`id` = `profiles`.`user_id`"; + JOIN `users` ON `users`.`id` = `profiles`.`user_id`'; $expectedQuery = preg_replace('/[\s\t]+/', ' ', preg_replace('/' . PHP_EOL . '+/', '', $expectedQuery)); @@ -210,10 +208,10 @@ public function testIdiormJoinToFromSameTable() $this->assertInstanceOf(ModelCollection::class, $users); - $expectedQuery = "SELECT * + $expectedQuery = 'SELECT * FROM `users` JOIN `user_professions` ON `user_professions`.`user_id` = `users`.`id` - JOIN `user_meetings` ON `user_meetings`.`user_id` = `users`.`id`"; + JOIN `user_meetings` ON `user_meetings`.`user_id` = `users`.`id`'; $expectedQuery = preg_replace('/[\s\t]+/', ' ', preg_replace('/' . PHP_EOL . '+/', '', $expectedQuery)); @@ -256,12 +254,12 @@ public function testIdiormJoinToWithTableSwitch() $this->assertArrayHasKey('note', $user); - $expectedQuery = "SELECT * + $expectedQuery = 'SELECT * FROM `users` JOIN `user_meetings` ON `user_meetings`.`user_id` = `users`.`id` JOIN `tickets` ON `tickets`.`meeting_id` = `user_meetings`.`id` JOIN `notes` ON `notes`.`ticket_id` = `tickets`.`id` - GROUP BY `users`.`id`"; + GROUP BY `users`.`id`'; $expectedQuery = preg_replace('/[\s\t]+/', ' ', preg_replace('/' . PHP_EOL . '+/', '', $expectedQuery)); @@ -301,10 +299,10 @@ public function testIdiormJoiningViaPivotModel() $this->assertArrayHasKey('started_at', $userRecord); - $expectedQuery = "SELECT * + $expectedQuery = 'SELECT * FROM `users` JOIN `user_events` ON `user_events`.`user_id` = `users`.`id` - JOIN `events` ON `events`.`id` = `user_events`.`event_id`"; + JOIN `events` ON `events`.`id` = `user_events`.`event_id`'; $expectedQuery = preg_replace('/[\s\t]+/', ' ', preg_replace('/' . PHP_EOL . '+/', '', $expectedQuery)); @@ -370,7 +368,7 @@ public function testIdiormSelectFieldsAtJoin() $this->assertEquals('Writer', $users->first()->prop('profession')); - $expectedQuery = "SELECT + $expectedQuery = 'SELECT `firstname`, `lastname`, `age`, @@ -379,7 +377,7 @@ public function testIdiormSelectFieldsAtJoin() FROM `users` JOIN `profiles` ON `profiles`.`user_id` = `users`.`id` JOIN `user_professions` ON `user_professions`.`user_id` = `users`.`id` - ORDER BY `age` DESC"; + ORDER BY `age` DESC'; $expectedQuery = preg_replace('/[\s\t]+/', ' ', preg_replace('/' . PHP_EOL . '+/', '', $expectedQuery)); @@ -402,7 +400,7 @@ public function testIdiormThrowsExceptionForWrongRelation() public function testIdiormJoinThrowsExceptionWhenRelationKeysMissing() { $this->expectException(ModelException::class); - $this->expectExceptionMessage('Relation type is missing for model `' . BrokenProfileMissingTypeModel::class .'`'); + $this->expectExceptionMessage('Relation type is missing for model `' . BrokenProfileMissingTypeModel::class . '`'); ModelFactory::get(BrokenProfileMissingTypeModel::class) ->joinTo(ModelFactory::get(TestUserModel::class)) @@ -418,4 +416,4 @@ public function testIdiormJoinThrowsExceptionForUnsupportedRelationType() ->joinTo(ModelFactory::get(TestUserModel::class)) ->get(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/ModelIdiormTest.php b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/ModelIdiormTest.php index 3dc0b2570..a36e163ce 100644 --- a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/ModelIdiormTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/ModelIdiormTest.php @@ -7,7 +7,6 @@ class ModelIdiormTest extends IdiormDbalTestCase { - public function testIdiormCreateNewRecord() { $eventsModel = new IdiormDbal('events'); diff --git a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/QueryIdiormTest.php b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/QueryIdiormTest.php index 4f5e0b846..058fac991 100644 --- a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/QueryIdiormTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/QueryIdiormTest.php @@ -11,7 +11,6 @@ */ class QueryIdiormTest extends IdiormDbalTestCase { - public function testIdiormExecute() { $eventModel = new IdiormDbal('events'); @@ -29,10 +28,11 @@ public function testIdiormExecute() public function testIdiormQuery() { - $events = IdiormDbal::query('SELECT * FROM events WHERE started_at BETWEEN :date_from AND :date_to ORDER BY started_at DESC', + $events = IdiormDbal::query( + 'SELECT * FROM events WHERE started_at BETWEEN :date_from AND :date_to ORDER BY started_at DESC', [ 'date_from' => '2035-02-14 10:15:12', - 'date_to' => '2045-02-14 10:15:12' + 'date_to' => '2045-02-14 10:15:12', ] ); @@ -63,7 +63,7 @@ public function testIdiormLastStatement() $eventModel->criteria('country', '=', 'Ireland')->get(); - $this->assertEquals("SELECT * FROM `events` WHERE `country` = ?", $eventModel::lastStatement()->queryString); + $this->assertEquals('SELECT * FROM `events` WHERE `country` = ?', $eventModel::lastStatement()->queryString); } public function testIdiormQueryLog() diff --git a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/ReducerIdiormTest.php b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/ReducerIdiormTest.php index 309b9e1d8..c360db05c 100644 --- a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/ReducerIdiormTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/ReducerIdiormTest.php @@ -7,7 +7,6 @@ class ReducerIdiormTest extends IdiormDbalTestCase { - public function testIdiormSelect() { $userProfileModel = new IdiormDbal('profiles'); diff --git a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/ResultIdiormTest.php b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/ResultIdiormTest.php index 3893810ef..8d32b73bc 100644 --- a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/ResultIdiormTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/ResultIdiormTest.php @@ -7,7 +7,6 @@ class ResultIdiormTest extends IdiormDbalTestCase { - public function testIdiormGet() { $userProfileModel = new IdiormDbal('profiles'); diff --git a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/TransactionIdiormTest.php b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/TransactionIdiormTest.php index 03b18d6ba..9670bad0c 100644 --- a/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/TransactionIdiormTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Idiorm/Statements/TransactionIdiormTest.php @@ -11,7 +11,6 @@ */ class TransactionIdiormTest extends IdiormDbalTestCase { - public function testBeginTransactionAndRollback() { IdiormDbal::beginTransaction(); @@ -21,7 +20,7 @@ public function testBeginTransactionAndRollback() 'firstname' => 'Alice', 'lastname' => 'Smith', 'age' => 30, - 'country' => 'Canada' + 'country' => 'Canada', ]); IdiormDbal::rollback(); @@ -40,7 +39,7 @@ public function testBeginTransactionAndCommit() 'firstname' => 'Bob', 'lastname' => 'Marley', 'age' => 42, - 'country' => 'Jamaica' + 'country' => 'Jamaica', ]); IdiormDbal::commit(); diff --git a/tests/Unit/Libraries/Database/Adapters/Sleekdb/SleekDbalTest.php b/tests/Unit/Libraries/Database/Adapters/Sleekdb/SleekDbalTest.php index 34c2d1ab8..41eb56011 100644 --- a/tests/Unit/Libraries/Database/Adapters/Sleekdb/SleekDbalTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Sleekdb/SleekDbalTest.php @@ -6,7 +6,6 @@ class SleekDbalTest extends SleekDbalTestCase { - public function testSleekConstructor() { $userModel = new SleekDbal('users'); @@ -20,4 +19,4 @@ public function testSleekGetTable() $this->assertEquals('users', $userModel->getTable()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/Adapters/Sleekdb/SleekDbalTestCase.php b/tests/Unit/Libraries/Database/Adapters/Sleekdb/SleekDbalTestCase.php index a0976d78b..28f47a524 100644 --- a/tests/Unit/Libraries/Database/Adapters/Sleekdb/SleekDbalTestCase.php +++ b/tests/Unit/Libraries/Database/Adapters/Sleekdb/SleekDbalTestCase.php @@ -10,7 +10,6 @@ abstract class SleekDbalTestCase extends AppTestCase { - private $tables = [ 'users', 'profiles', @@ -19,7 +18,7 @@ abstract class SleekDbalTestCase extends AppTestCase 'user_events', 'user_meetings', 'tickets', - 'notes' + 'notes', ]; public function setUp(): void @@ -55,4 +54,4 @@ public function deleteTables(): void $model->deleteTable(); } } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/CriteriaSleekTest.php b/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/CriteriaSleekTest.php index 92b4948a0..17672b63a 100644 --- a/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/CriteriaSleekTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/CriteriaSleekTest.php @@ -7,7 +7,6 @@ class CriteriaSleekTest extends SleekDbalTestCase { - public $userProfileModel; public function testSleekCriteriaEquals() { @@ -134,7 +133,7 @@ public function testSleekMultipleAndCriterias() $events = $eventsModel->criterias( ['title', '=', 'Music'], - ['started_at', '>=', new \DateTime("2020-12-01")] + ['started_at', '>=', new \DateTime('2020-12-01')] )->get(); $this->assertIsArray($events); @@ -152,7 +151,7 @@ public function testSleekMultipleOrCriterias() $events = $eventsModel->criterias([ ['title', '=', 'Music'], ['title', '=', 'Dance'], - ['title', '=', 'Art'] + ['title', '=', 'Art'], ])->get(); $this->assertIsArray($events); @@ -166,7 +165,7 @@ public function testSleekAndOrCriterias() $events = $eventsModel->criterias([ ['title', '=', 'Dance'], - ['title', '=', 'Art'] + ['title', '=', 'Art'], ], ['country', '=', 'Ireland'])->get(); $this->assertIsArray($events); @@ -214,4 +213,4 @@ public function testSleekIsNotNull() $this->assertNotNull($event->prop('started_at')); } } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/JoinSleekTest.php b/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/JoinSleekTest.php index 3d1ff938e..ca831079b 100644 --- a/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/JoinSleekTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/JoinSleekTest.php @@ -26,7 +26,7 @@ public function relations(): array TestUserModel::class => [ // 'type' intentionally missing 'foreign_key' => 'user_id', - 'local_key' => 'id', + 'local_key' => 'id', ], ]; } @@ -42,7 +42,7 @@ public function relations(): array TestUserModel::class => [ 'type' => 'SIDEWAYS', 'foreign_key' => 'user_id', - 'local_key' => 'id', + 'local_key' => 'id', ], ]; } @@ -50,7 +50,6 @@ public function relations(): array class JoinSleekTest extends SleekDbalTestCase { - public function testSleekJoinToHasOne() { $userModel = ModelFactory::get(TestUserModel::class); @@ -277,7 +276,7 @@ public function testSleekJoinThrowsExceptionForMissingForeignKey() public function testSleekJoinThrowsExceptionWhenRelationKeysMissing() { $this->expectException(ModelException::class); - $this->expectExceptionMessage('Relation type is missing for model `' . BrokenProfileMissingTypeModel::class .'`'); + $this->expectExceptionMessage('Relation type is missing for model `' . BrokenProfileMissingTypeModel::class . '`'); ModelFactory::get(BrokenProfileMissingTypeModel::class) ->joinTo(ModelFactory::get(TestUserModel::class)) @@ -293,4 +292,4 @@ public function testSleekJoinThrowsExceptionForUnsupportedRelationType() ->joinTo(ModelFactory::get(TestUserModel::class)) ->get(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/ModelSleekTest.php b/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/ModelSleekTest.php index 89755db4b..e29031e62 100644 --- a/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/ModelSleekTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/ModelSleekTest.php @@ -7,7 +7,6 @@ class ModelSleekTest extends SleekDbalTestCase { - public function testSleekCreateNewRecord() { $eventsModel = new SleekDbal('events'); @@ -90,4 +89,4 @@ public function testSleekDeleteMany() $this->assertEmpty($events); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/ReducerSleekTest.php b/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/ReducerSleekTest.php index e987a7d5a..514b4c252 100644 --- a/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/ReducerSleekTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/ReducerSleekTest.php @@ -7,7 +7,6 @@ class ReducerSleekTest extends SleekDbalTestCase { - public function testSleekSelect() { $userProfileModel = new SleekDbal('profiles'); @@ -72,4 +71,4 @@ public function testSleekLimitAndOffset() $this->assertEquals(2, $events[0]->id); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/ResultSleekTest.php b/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/ResultSleekTest.php index 9674d6402..48bd1e9de 100644 --- a/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/ResultSleekTest.php +++ b/tests/Unit/Libraries/Database/Adapters/Sleekdb/Statements/ResultSleekTest.php @@ -7,7 +7,6 @@ class ResultSleekTest extends SleekDbalTestCase { - private $userProfileModel; public function setUp(): void @@ -86,4 +85,4 @@ public function testSleekAsArray() $this->assertIsArray($user->asArray()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/Adapters/TestData.php b/tests/Unit/Libraries/Database/Adapters/TestData.php index ad57d5b76..9875a9c14 100644 --- a/tests/Unit/Libraries/Database/Adapters/TestData.php +++ b/tests/Unit/Libraries/Database/Adapters/TestData.php @@ -88,4 +88,4 @@ public static function notes(): array ['ticket_id' => 6, 'note' => 'note seven'], ]; } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Database/DatabaseTest.php b/tests/Unit/Libraries/Database/DatabaseTest.php index dc9daf493..555ef4b7d 100644 --- a/tests/Unit/Libraries/Database/DatabaseTest.php +++ b/tests/Unit/Libraries/Database/DatabaseTest.php @@ -9,7 +9,6 @@ class DatabaseTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -24,19 +23,19 @@ public function setUp(): void $this->setPrivateProperty(Database::class, 'instance', null); - Database::execute("CREATE TABLE IF NOT EXISTS profiles ( + Database::execute('CREATE TABLE IF NOT EXISTS profiles ( id INTEGER PRIMARY KEY, firstname VARCHAR(255), lastname VARCHAR(255), age INTEGER(11), country VARCHAR(255), created_at DATETIME - )"); + )'); } public function tearDown(): void { - Database::execute("DROP TABLE IF EXISTS profiles"); + Database::execute('DROP TABLE IF EXISTS profiles'); } public function testDatabaseInstance() @@ -68,9 +67,11 @@ public function testDatabaseRawQueries() $this->assertEmpty($result); - Database::execute('INSERT INTO profiles (firstname, lastname, age, country) + Database::execute( + 'INSERT INTO profiles (firstname, lastname, age, country) VALUES (:firstname, :lastname, :age, :country)', - ['firstname' => 'John', 'lastname' => 'Doe', 'age' => '56', 'country' => 'Spain']); + ['firstname' => 'John', 'lastname' => 'Doe', 'age' => '56', 'country' => 'Spain'] + ); $result = Database::query('SELECT * FROM profiles WHERE id=:id', ['id' => 1]); @@ -94,7 +95,7 @@ public function testDatabaseTransactionMethods() 'firstname' => 'Alice', 'lastname' => 'Smith', 'age' => 30, - 'country' => 'Canada' + 'country' => 'Canada', ]); Database::rollback(); @@ -110,7 +111,7 @@ public function testDatabaseTransactionMethods() 'firstname' => 'Bob', 'lastname' => 'Marley', 'age' => 42, - 'country' => 'Jamaica' + 'country' => 'Jamaica', ]); Database::commit(); @@ -130,7 +131,7 @@ public function testDatabaseTransactionClosureSuccess() 'firstname' => 'Charlie', 'lastname' => 'Brown', 'age' => 28, - 'country' => 'USA' + 'country' => 'USA', ]); return 'committed'; @@ -154,7 +155,7 @@ public function testDatabaseTransactionClosureFailure() 'firstname' => 'Eve', 'lastname' => 'Hacker', 'age' => 999, - 'country' => 'Matrix' + 'country' => 'Matrix', ]); throw new \Exception('Something went wrong!'); diff --git a/tests/Unit/Libraries/Database/Factories/TableFactoryTest.php b/tests/Unit/Libraries/Database/Factories/TableFactoryTest.php index 8d1813bdc..ebab6cb41 100644 --- a/tests/Unit/Libraries/Database/Factories/TableFactoryTest.php +++ b/tests/Unit/Libraries/Database/Factories/TableFactoryTest.php @@ -12,7 +12,6 @@ class TableFactoryTest extends AppTestCase { - private $tableFactory; private $table; @@ -36,21 +35,21 @@ public function setUp(): void 'ALTER' => 2, 'DROP' => 3, 'RENAME' => 4, - ] + ], ]); $this->table = Mockery::mock('overload:Quantum\Libraries\Database\Schemas\Table'); - $this->table->shouldReceive('setAction')->andReturnUsing(fn($action) => $this->table); + $this->table->shouldReceive('setAction')->andReturnUsing(fn ($action) => $this->table); - $this->table->shouldReceive('getAction')->andReturnUsing(fn() => $this->table->action); + $this->table->shouldReceive('getAction')->andReturnUsing(fn () => $this->table->action); $this->table->shouldReceive('save')->andReturn(0); } public function tearDown(): void { - Database::execute("DROP TABLE IF EXISTS profiles"); + Database::execute('DROP TABLE IF EXISTS profiles'); } public function testCreateTable() @@ -62,14 +61,14 @@ public function testCreateTable() public function testAttemptToCreateTableWhichAlreadyExists() { - Database::execute("CREATE TABLE profiles ( + Database::execute('CREATE TABLE profiles ( id INTEGER PRIMARY KEY, firstname VARCHAR(255), lastname VARCHAR(255), age INTEGER(11), country VARCHAR(255), created_at DATETIME - )"); + )'); $this->expectException(DatabaseException::class); @@ -80,14 +79,14 @@ public function testAttemptToCreateTableWhichAlreadyExists() public function testGetTable() { - Database::execute("CREATE TABLE IF NOT EXISTS profiles ( + Database::execute('CREATE TABLE IF NOT EXISTS profiles ( id INTEGER PRIMARY KEY, firstname VARCHAR(255), lastname VARCHAR(255), age INTEGER(11), country VARCHAR(255), created_at DATETIME - )"); + )'); $table = $this->tableFactory->get('profiles'); @@ -105,14 +104,14 @@ public function testAttemptToGetNonExistingTable() public function testRenameTable() { - Database::execute("CREATE TABLE IF NOT EXISTS profiles ( + Database::execute('CREATE TABLE IF NOT EXISTS profiles ( id INTEGER PRIMARY KEY, firstname VARCHAR(255), lastname VARCHAR(255), age INTEGER(11), country VARCHAR(255), created_at DATETIME - )"); + )'); $this->assertTrue($this->tableFactory->rename('profiles', 'system_users')); } @@ -128,14 +127,14 @@ public function testAttemptToRenameNonExistingTable() public function testDropTable() { - Database::execute("CREATE TABLE IF NOT EXISTS profiles ( + Database::execute('CREATE TABLE IF NOT EXISTS profiles ( id INTEGER PRIMARY KEY, firstname VARCHAR(255), lastname VARCHAR(255), age INTEGER(11), country VARCHAR(255), created_at DATETIME - )"); + )'); $this->assertTrue($this->tableFactory->drop('profiles')); } diff --git a/tests/Unit/Libraries/Database/Schema/ColumnTest.php b/tests/Unit/Libraries/Database/Schema/ColumnTest.php index 55360be80..d18ce2c88 100644 --- a/tests/Unit/Libraries/Database/Schema/ColumnTest.php +++ b/tests/Unit/Libraries/Database/Schema/ColumnTest.php @@ -8,7 +8,6 @@ class ColumnTest extends TestCase { - public function testColumnConstructor() { $this->assertInstanceOf(Column::class, new Column('test')); diff --git a/tests/Unit/Libraries/Database/Schema/TableTest.php b/tests/Unit/Libraries/Database/Schema/TableTest.php index 17a0aa66c..0116da556 100644 --- a/tests/Unit/Libraries/Database/Schema/TableTest.php +++ b/tests/Unit/Libraries/Database/Schema/TableTest.php @@ -15,7 +15,6 @@ */ class TableTest extends TestCase { - public function setUp(): void { $db = Mockery::mock('overload:Quantum\Libraries\Database\Database'); diff --git a/tests/Unit/Libraries/Encryption/Adapters/AsymmetricEncryptionAdapterTest.php b/tests/Unit/Libraries/Encryption/Adapters/AsymmetricEncryptionAdapterTest.php index e9e84b587..84db8ff8c 100644 --- a/tests/Unit/Libraries/Encryption/Adapters/AsymmetricEncryptionAdapterTest.php +++ b/tests/Unit/Libraries/Encryption/Adapters/AsymmetricEncryptionAdapterTest.php @@ -10,7 +10,6 @@ class AsymmetricEncryptionAdapterTest extends AppTestCase { - protected $adapter; protected $plainText = 'The early bird gets the worm, but the second mouse gets the cheese.'; @@ -51,7 +50,7 @@ public function testAsymmetricEncryptionAdapterWithoutPublicKey() $this->expectException(CryptorException::class); $this->expectExceptionMessage(ExceptionMessages::PUBLIC_KEY_MISSING); - $adapterInstance->encrypt("Some text"); + $adapterInstance->encrypt('Some text'); } public function testAsymmetricEncryptionAdapterDecryptWithoutPrivateKey() @@ -66,6 +65,6 @@ public function testAsymmetricEncryptionAdapterDecryptWithoutPrivateKey() $this->expectException(CryptorException::class); $this->expectExceptionMessage(ExceptionMessages::PRIVATE_KEY_MISSING); - $adapterInstance->decrypt("Some encrypted text"); + $adapterInstance->decrypt('Some encrypted text'); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Encryption/Adapters/SymmetricEncryptionAdapterTest.php b/tests/Unit/Libraries/Encryption/Adapters/SymmetricEncryptionAdapterTest.php index 4fe1f9f93..49d271edc 100644 --- a/tests/Unit/Libraries/Encryption/Adapters/SymmetricEncryptionAdapterTest.php +++ b/tests/Unit/Libraries/Encryption/Adapters/SymmetricEncryptionAdapterTest.php @@ -8,7 +8,6 @@ class SymmetricEncryptionAdapterTest extends AppTestCase { - protected $adapter; protected $plainText = 'The early bird gets the worm, but the second mouse gets the cheese.'; @@ -41,6 +40,6 @@ public function testSymmetricEncryptionDecryptThrowsExceptionOnInvalidData() { $this->expectException(CryptorException::class); - $this->adapter->decrypt("invalidEncryptedData"); + $this->adapter->decrypt('invalidEncryptedData'); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Encryption/CryptorTest.php b/tests/Unit/Libraries/Encryption/CryptorTest.php index f4008721e..1a927d2c4 100644 --- a/tests/Unit/Libraries/Encryption/CryptorTest.php +++ b/tests/Unit/Libraries/Encryption/CryptorTest.php @@ -11,7 +11,6 @@ class CryptorTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -60,8 +59,8 @@ public function testCryptorCallingInvalidMethod() $this->expectException(CryptorException::class); - $this->expectExceptionMessage('The method `callingInvalidMethod` is not supported for `'. SymmetricEncryptionAdapter::class .'`'); + $this->expectExceptionMessage('The method `callingInvalidMethod` is not supported for `' . SymmetricEncryptionAdapter::class . '`'); $cryptor->callingInvalidMethod(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Encryption/Factories/CryptorFactoryTest.php b/tests/Unit/Libraries/Encryption/Factories/CryptorFactoryTest.php index 78576b9f3..68328dbd7 100644 --- a/tests/Unit/Libraries/Encryption/Factories/CryptorFactoryTest.php +++ b/tests/Unit/Libraries/Encryption/Factories/CryptorFactoryTest.php @@ -12,7 +12,6 @@ class CryptorFactoryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -59,4 +58,4 @@ public function testCryptorFactoryReturnsSameInstance() $this->assertSame($cryptor1, $cryptor2); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Encryption/Helpers/CryptorHelperFunctionsTest.php b/tests/Unit/Libraries/Encryption/Helpers/CryptorHelperFunctionsTest.php index ab016a8ae..434dc2a2f 100644 --- a/tests/Unit/Libraries/Encryption/Helpers/CryptorHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Encryption/Helpers/CryptorHelperFunctionsTest.php @@ -8,7 +8,6 @@ class CryptorHelperFunctionsTest extends AppTestCase { - public function testCryptoEncodeAndDecodeWithSymmetricEncryption() { $stringValue = 'simple string'; @@ -23,7 +22,6 @@ public function testCryptoEncodeAndDecodeWithSymmetricEncryption() $this->assertIsString($decryptedString); $this->assertEquals($stringValue, $decryptedString); - $data = ['key' => 'value']; $encryptedData = crypto_encode($data); @@ -60,7 +58,7 @@ public function testCryptoEncodeAndDecodeWithAsymmetricEncryption() $this->assertIsString($encryptedString); $this->assertNotEmpty($encryptedString); - $decryptedString = crypto_decode($encryptedString,Cryptor::ASYMMETRIC); + $decryptedString = crypto_decode($encryptedString, Cryptor::ASYMMETRIC); $this->assertIsString($decryptedString); $this->assertEquals($stringValue, $decryptedString); @@ -90,4 +88,4 @@ public function testCryptoEncodeAndDecodeWithAsymmetricEncryption() $this->assertInstanceOf(stdClass::class, $decryptedObject); $this->assertEquals($objectValue, $decryptedObject); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Hasher/HasherTest.php b/tests/Unit/Libraries/Hasher/HasherTest.php index 01e0defad..bb602f750 100644 --- a/tests/Unit/Libraries/Hasher/HasherTest.php +++ b/tests/Unit/Libraries/Hasher/HasherTest.php @@ -7,7 +7,6 @@ class HasherTest extends AppTestCase { - private $hasher; private $password = 'plaintext'; private $otherPassword = 'other'; @@ -71,4 +70,4 @@ public function testInfo() $this->assertArrayHasKey('algoName', $this->hasher->info($hashed)); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/HttpClient/HttpClientTest.php b/tests/Unit/Libraries/HttpClient/HttpClientTest.php index cfe5ba23e..4a1909d68 100644 --- a/tests/Unit/Libraries/HttpClient/HttpClientTest.php +++ b/tests/Unit/Libraries/HttpClient/HttpClientTest.php @@ -8,7 +8,6 @@ class HttpClientTest extends AppTestCase { - private $httpClient; private $restServer = 'https://api.thedogapi.com/v1'; @@ -129,7 +128,7 @@ public function testHttpClientGetRequestHeaders() 'x-api-key' => $this->restServerApiKey, 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language' => 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3', - 'User-Agent' => 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)' + 'User-Agent' => 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)', ]) ->start(); @@ -229,8 +228,8 @@ public function testHttpClientSendPostRequestAndGetResponseBody() ->setHeader('Content-Type', 'application/json') ->setMethod('POST') ->setData([ - "image_id" => $imageId, - "value"=> 1, + 'image_id' => $imageId, + 'value' => 1, ]) ->start(); @@ -304,7 +303,6 @@ public function testHttpClientUrl() $this->assertIsString($this->httpClient->url()); - $this->assertEquals('https://api.thedogapi.com/v1/breeds', $this->httpClient->url()); } } diff --git a/tests/Unit/Libraries/JWToken/JWTokenTest.php b/tests/Unit/Libraries/JWToken/JWTokenTest.php index 2429fa90b..ec86cf167 100644 --- a/tests/Unit/Libraries/JWToken/JWTokenTest.php +++ b/tests/Unit/Libraries/JWToken/JWTokenTest.php @@ -7,9 +7,8 @@ class JWTokenTest extends AppTestCase { - private $jwtToken; - + private $key = 'appkey'; private $userData = [ @@ -28,7 +27,7 @@ public function setUp(): void 'aud' => 'audience', 'iat' => time(), 'nbf' => time() + 1, - 'exp' => time() + 300 + 'exp' => time() + 300, ]; $this->jwtToken = new JwtToken($this->key); @@ -83,7 +82,6 @@ public function testSetFetchData() $this->assertEquals($this->userData, $this->jwtToken->fetchData()); - } public function testSetFetchClaim() @@ -118,7 +116,7 @@ public function testSetClaims() 'jti' => uniqid(), 'iat' => time(), 'nbf' => time() + 1, - 'exp' => time() + 500 + 'exp' => time() + 500, ]; $jwtToken->setLeeway(1)->setClaims($claims); @@ -135,4 +133,4 @@ public function testSetClaims() $this->assertEquals($claims, (array)$jwtToken->fetchPayload()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Lang/Factories/LangFactoryTest.php b/tests/Unit/Libraries/Lang/Factories/LangFactoryTest.php index afb888e31..77dbb3904 100644 --- a/tests/Unit/Libraries/Lang/Factories/LangFactoryTest.php +++ b/tests/Unit/Libraries/Lang/Factories/LangFactoryTest.php @@ -9,7 +9,6 @@ class LangFactoryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -79,7 +78,7 @@ public function testLangFactoryFallsBackToDefaultIfProvidedLangIsNotSupported() 'enabled' => true, 'default' => 'en', 'supported' => ['en', 'es'], - 'url_segment' => 1 + 'url_segment' => 1, ]); $this->testRequest('http://127.0.0.1/fr/api/rest'); @@ -111,7 +110,7 @@ public function testLangFactoryThrowsErrorIfNoDefaultLangFound() 'enabled' => true, 'default' => null, 'supported' => ['en', 'es'], - 'url_segment' => 1 + 'url_segment' => 1, ]); $this->testRequest('http://127.0.0.1/fr/api/rest'); @@ -122,4 +121,4 @@ public function testLangFactoryThrowsErrorIfNoDefaultLangFound() LangFactory::get(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Lang/Helpers/LangHelperFunctionsTest.php b/tests/Unit/Libraries/Lang/Helpers/LangHelperFunctionsTest.php index 00709e21b..e9d685318 100644 --- a/tests/Unit/Libraries/Lang/Helpers/LangHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Lang/Helpers/LangHelperFunctionsTest.php @@ -7,7 +7,6 @@ class LangHelperFunctionsTest extends AppTestCase { - private $lang; public function setUp(): void @@ -52,4 +51,4 @@ public function testLangHelperTFail() { $this->assertEquals('custom.non_existing_key', t('custom.non_existing_key')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Lang/LangTest.php b/tests/Unit/Libraries/Lang/LangTest.php index a6f416a06..f7f83eb8b 100644 --- a/tests/Unit/Libraries/Lang/LangTest.php +++ b/tests/Unit/Libraries/Lang/LangTest.php @@ -9,7 +9,6 @@ class LangTest extends AppTestCase { - private $lang; public function setUp(): void @@ -20,11 +19,11 @@ public function setUp(): void $this->lang = new Lang('en', true, $translator); RouteController::setCurrentRoute([ - "route" => "api-signin", - "method" => "POST", - "controller" => "SomeController", - "action" => "signin", - "module" => "Test", + 'route' => 'api-signin', + 'method' => 'POST', + 'controller' => 'SomeController', + 'action' => 'signin', + 'module' => 'Test', ]); } @@ -46,7 +45,6 @@ public function testLangIsEnabled(): void $this->assertFalse($langDisabled->isEnabled()); } - public function testLangLoadAndGetTranslation(): void { $this->lang->flush(); @@ -70,4 +68,4 @@ public function testLangFlushResetsTranslations(): void $this->assertEquals('test', $this->lang->getTranslation('test')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Lang/TranslatorTest.php b/tests/Unit/Libraries/Lang/TranslatorTest.php index db971baa9..0fe766f6c 100644 --- a/tests/Unit/Libraries/Lang/TranslatorTest.php +++ b/tests/Unit/Libraries/Lang/TranslatorTest.php @@ -7,7 +7,6 @@ class TranslatorTest extends AppTestCase { - public function testTranslatorConstruct(): void { $translator = new Translator('en'); diff --git a/tests/Unit/Libraries/Logger/Adapters/DailyAdapterTest.php b/tests/Unit/Libraries/Logger/Adapters/DailyAdapterTest.php index 6a7dd57b4..08ef86ae5 100644 --- a/tests/Unit/Libraries/Logger/Adapters/DailyAdapterTest.php +++ b/tests/Unit/Libraries/Logger/Adapters/DailyAdapterTest.php @@ -8,7 +8,6 @@ class DailyAdapterTest extends AppTestCase { - private $adapter; public function setUp(): void @@ -51,4 +50,4 @@ public function testDailyAdapterReportWritesToFile() $this->fs->remove($logFile); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Logger/Adapters/MessageAdapterTest.php b/tests/Unit/Libraries/Logger/Adapters/MessageAdapterTest.php index 1a22a943a..b86d101fc 100644 --- a/tests/Unit/Libraries/Logger/Adapters/MessageAdapterTest.php +++ b/tests/Unit/Libraries/Logger/Adapters/MessageAdapterTest.php @@ -38,4 +38,4 @@ public function testReportAddsMessageToDebuggerStore() $this->assertEquals($message, $storedMessages[0][$level]); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Logger/Adapters/SingleAdapterTest.php b/tests/Unit/Libraries/Logger/Adapters/SingleAdapterTest.php index 4007604ed..f0feb801c 100644 --- a/tests/Unit/Libraries/Logger/Adapters/SingleAdapterTest.php +++ b/tests/Unit/Libraries/Logger/Adapters/SingleAdapterTest.php @@ -50,4 +50,4 @@ public function testSingleAdapterReportWritesToFile() $this->fs->remove($logFile); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Logger/Factories/LoggerFactoryTest.php b/tests/Unit/Libraries/Logger/Factories/LoggerFactoryTest.php index 26b18cdb8..90ed3f2fb 100644 --- a/tests/Unit/Libraries/Logger/Factories/LoggerFactoryTest.php +++ b/tests/Unit/Libraries/Logger/Factories/LoggerFactoryTest.php @@ -13,7 +13,6 @@ class LoggerFactoryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -93,4 +92,4 @@ public function testLoggerFactoryReturnsSameInstance() $this->assertSame($logger1, $logger2); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Logger/Helpers/LoggerHelperFunctionsTest.php b/tests/Unit/Libraries/Logger/Helpers/LoggerHelperFunctionsTest.php index ef5c244ec..df5a40ef6 100644 --- a/tests/Unit/Libraries/Logger/Helpers/LoggerHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Logger/Helpers/LoggerHelperFunctionsTest.php @@ -13,7 +13,6 @@ class LoggerHelperFunctionsTest extends AppTestCase { - private $debugger; public function setUp(): void @@ -141,4 +140,4 @@ public function testDebugHelper() $this->assertEquals('Debugging!!', $storedMessages[0]['debug']); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Logger/LoggerConfigTest.php b/tests/Unit/Libraries/Logger/LoggerConfigTest.php index 5e506c72b..c4c1004c4 100644 --- a/tests/Unit/Libraries/Logger/LoggerConfigTest.php +++ b/tests/Unit/Libraries/Logger/LoggerConfigTest.php @@ -2,7 +2,6 @@ namespace Quantum\Tests\Unit\Libraries\Logger; -use Quantum\Libraries\Logger\Factories\LoggerFactory; use Quantum\Libraries\Logger\LoggerConfig; use Quantum\Tests\Unit\AppTestCase; @@ -53,4 +52,4 @@ public function testGetLogLevelWithInvalidErrorType() { $this->assertEquals(400, LoggerConfig::getLogLevel('non_existing_error')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Logger/LoggerTest.php b/tests/Unit/Libraries/Logger/LoggerTest.php index 53b80cf77..e320ea3d1 100644 --- a/tests/Unit/Libraries/Logger/LoggerTest.php +++ b/tests/Unit/Libraries/Logger/LoggerTest.php @@ -11,7 +11,6 @@ class LoggerTest extends AppTestCase { - private $logger; private $adapter; private $debugger; @@ -64,4 +63,4 @@ public function testLoggerLogAddsMessageToDebuggerStore() $this->assertArrayHasKey($levelError, $storedMessages[1]); $this->assertEquals($messageError, $storedMessages[1][$levelError]); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Mailer/Adapters/MailerAdapterTraitTest.php b/tests/Unit/Libraries/Mailer/Adapters/MailerAdapterTraitTest.php index 76025fb27..b28a2abfa 100644 --- a/tests/Unit/Libraries/Mailer/Adapters/MailerAdapterTraitTest.php +++ b/tests/Unit/Libraries/Mailer/Adapters/MailerAdapterTraitTest.php @@ -9,7 +9,6 @@ class MailerAdapterTraitTest extends AppTestCase { - private $adapter; public function setUp(): void @@ -93,4 +92,4 @@ public function testMailerTraitGetMessageId() $this->assertIsString($adapter->getMessageId()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Mailer/Adapters/MailgunAdapterTest.php b/tests/Unit/Libraries/Mailer/Adapters/MailgunAdapterTest.php index 34408a53a..c50f5f59e 100644 --- a/tests/Unit/Libraries/Mailer/Adapters/MailgunAdapterTest.php +++ b/tests/Unit/Libraries/Mailer/Adapters/MailgunAdapterTest.php @@ -39,4 +39,4 @@ public function testMailgunAdapterSend() $this->assertTrue($this->adapter->send()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Mailer/Adapters/MandrillAdapterTest.php b/tests/Unit/Libraries/Mailer/Adapters/MandrillAdapterTest.php index b4e695eec..f60f3a81f 100644 --- a/tests/Unit/Libraries/Mailer/Adapters/MandrillAdapterTest.php +++ b/tests/Unit/Libraries/Mailer/Adapters/MandrillAdapterTest.php @@ -34,4 +34,4 @@ public function testMandrillAdapterSend() $this->assertTrue($this->adapter->send()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Mailer/Adapters/SendgridAdapterTest.php b/tests/Unit/Libraries/Mailer/Adapters/SendgridAdapterTest.php index 934f8ccbe..b90e94855 100644 --- a/tests/Unit/Libraries/Mailer/Adapters/SendgridAdapterTest.php +++ b/tests/Unit/Libraries/Mailer/Adapters/SendgridAdapterTest.php @@ -34,4 +34,4 @@ public function testSendgridAdapterSend() $this->assertTrue($this->adapter->send()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Mailer/Adapters/SendinblueAdapterTest.php b/tests/Unit/Libraries/Mailer/Adapters/SendinblueAdapterTest.php index d4f2532bd..0316a7fe7 100644 --- a/tests/Unit/Libraries/Mailer/Adapters/SendinblueAdapterTest.php +++ b/tests/Unit/Libraries/Mailer/Adapters/SendinblueAdapterTest.php @@ -34,4 +34,4 @@ public function testSendinblueAdapterSend() $this->assertTrue($this->adapter->send()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Mailer/Adapters/SmtpAdapterTest.php b/tests/Unit/Libraries/Mailer/Adapters/SmtpAdapterTest.php index 85f9c7e69..9076e3d64 100644 --- a/tests/Unit/Libraries/Mailer/Adapters/SmtpAdapterTest.php +++ b/tests/Unit/Libraries/Mailer/Adapters/SmtpAdapterTest.php @@ -112,4 +112,4 @@ public function testSmtpAdapterSend() $this->assertTrue($this->adapter->send()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Mailer/Factories/MailerFactoryTest.php b/tests/Unit/Libraries/Mailer/Factories/MailerFactoryTest.php index 92a3c7069..516d82874 100644 --- a/tests/Unit/Libraries/Mailer/Factories/MailerFactoryTest.php +++ b/tests/Unit/Libraries/Mailer/Factories/MailerFactoryTest.php @@ -15,7 +15,6 @@ class MailerFactoryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -92,4 +91,4 @@ public function testMailerFactoryReturnsSameInstance() $this->assertSame($mailer1, $mailer2); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Mailer/Helpers/MailerHelperFunctionsTest.php b/tests/Unit/Libraries/Mailer/Helpers/MailerHelperFunctionsTest.php index 4d5f96a25..38ef9ebde 100644 --- a/tests/Unit/Libraries/Mailer/Helpers/MailerHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Mailer/Helpers/MailerHelperFunctionsTest.php @@ -65,4 +65,4 @@ public function testMailerHelperGetSendinblueAdapter() $this->assertInstanceOf(SendinblueAdapter::class, $mailer->getAdapter()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Mailer/MailTrapTest.php b/tests/Unit/Libraries/Mailer/MailTrapTest.php index 00477fe99..468a8f840 100644 --- a/tests/Unit/Libraries/Mailer/MailTrapTest.php +++ b/tests/Unit/Libraries/Mailer/MailTrapTest.php @@ -7,7 +7,6 @@ class MailTrapTest extends AppTestCase { - private $mailTrap; private $filename; @@ -241,4 +240,4 @@ public function testMailTrapGetParsedAttachments() $this->assertStringContainsString('content of the document', base64_decode($firstAttachment['content'])); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Mailer/MailerTest.php b/tests/Unit/Libraries/Mailer/MailerTest.php index a5d56d2ac..434c2727f 100644 --- a/tests/Unit/Libraries/Mailer/MailerTest.php +++ b/tests/Unit/Libraries/Mailer/MailerTest.php @@ -11,7 +11,6 @@ class MailerTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -45,8 +44,8 @@ public function testMailerCallingInvalidMethod() $this->expectException(MailerException::class); - $this->expectExceptionMessage('The method `callingInvalidMethod` is not supported for `'. SmtpAdapter::class .'`'); + $this->expectExceptionMessage('The method `callingInvalidMethod` is not supported for `' . SmtpAdapter::class . '`'); $mailer->callingInvalidMethod(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Mailer/MailerTestCase.php b/tests/Unit/Libraries/Mailer/MailerTestCase.php index 5f74d3033..7916a54d7 100644 --- a/tests/Unit/Libraries/Mailer/MailerTestCase.php +++ b/tests/Unit/Libraries/Mailer/MailerTestCase.php @@ -22,10 +22,10 @@ public function tearDown(): void $emailFile = base_dir() . DS . 'shared' . DS . 'emails' . DS . $this->adapter->getMessageId() . '.eml'; - if($this->fs->exists($emailFile)) { + if ($this->fs->exists($emailFile)) { $this->fs->remove($emailFile); } Di::reset(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/ResourceCache/ViewCacheTest.php b/tests/Unit/Libraries/ResourceCache/ViewCacheTest.php index ea91b3f06..8ae8eec8a 100644 --- a/tests/Unit/Libraries/ResourceCache/ViewCacheTest.php +++ b/tests/Unit/Libraries/ResourceCache/ViewCacheTest.php @@ -152,4 +152,4 @@ public function testEnableDisableViewCache() $this->assertFalse($this->viewCache->isEnabled()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Session/Adapters/Database/DatabaseSessionAdapterTest.php b/tests/Unit/Libraries/Session/Adapters/Database/DatabaseSessionAdapterTest.php index 3cd13d6ae..e066cc343 100644 --- a/tests/Unit/Libraries/Session/Adapters/Database/DatabaseSessionAdapterTest.php +++ b/tests/Unit/Libraries/Session/Adapters/Database/DatabaseSessionAdapterTest.php @@ -10,7 +10,6 @@ class DatabaseSessionAdapterTest extends AppTestCase { - use TestCaseHelper; private $session; @@ -109,4 +108,4 @@ public function testDatabaseSessionRegenerateSessionId() $this->assertNotEquals(session_id(), $sessionId); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Session/Adapters/Native/NativeSessionAdapterTest.php b/tests/Unit/Libraries/Session/Adapters/Native/NativeSessionAdapterTest.php index 86676c7bb..e24c9feda 100644 --- a/tests/Unit/Libraries/Session/Adapters/Native/NativeSessionAdapterTest.php +++ b/tests/Unit/Libraries/Session/Adapters/Native/NativeSessionAdapterTest.php @@ -7,7 +7,6 @@ class NativeSessionAdapterTest extends AppTestCase { - private $session; public function setUp(): void @@ -97,4 +96,4 @@ public function testNativeSessionRegenerateSessionId() $this->assertNotEquals(session_id(), $sessionId); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Session/Factories/SessionFactoryTest.php b/tests/Unit/Libraries/Session/Factories/SessionFactoryTest.php index 43278c463..9f69a8043 100644 --- a/tests/Unit/Libraries/Session/Factories/SessionFactoryTest.php +++ b/tests/Unit/Libraries/Session/Factories/SessionFactoryTest.php @@ -15,7 +15,6 @@ class SessionFactoryTest extends AppTestCase { - use TestCaseHelper; public function setUp(): void @@ -119,4 +118,4 @@ public function testMailerFactoryReturnsSameInstance() $this->assertSame($session1, $session2); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Session/Helpers/SessionHelperFunctionsTest.php b/tests/Unit/Libraries/Session/Helpers/SessionHelperFunctionsTest.php index 47b369aab..64dca450c 100644 --- a/tests/Unit/Libraries/Session/Helpers/SessionHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Session/Helpers/SessionHelperFunctionsTest.php @@ -52,4 +52,4 @@ public function testSessionMethodsViaHelper() $this->assertFalse(session()->has('test')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Session/SessionTest.php b/tests/Unit/Libraries/Session/SessionTest.php index 7103b3a11..6f0a708a2 100644 --- a/tests/Unit/Libraries/Session/SessionTest.php +++ b/tests/Unit/Libraries/Session/SessionTest.php @@ -12,7 +12,6 @@ class SessionTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -56,4 +55,4 @@ public function testSessionCallingInvalidMethod() $mailer->callingInvalidMethod(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Session/TestCaseHelper.php b/tests/Unit/Libraries/Session/TestCaseHelper.php index 282115ede..d10973d06 100644 --- a/tests/Unit/Libraries/Session/TestCaseHelper.php +++ b/tests/Unit/Libraries/Session/TestCaseHelper.php @@ -9,12 +9,13 @@ trait TestCaseHelper private function _createSessionsTable() { IdiormDbal::execute( - "CREATE TABLE IF NOT EXISTS sessions ( + 'CREATE TABLE IF NOT EXISTS sessions ( id INTEGER PRIMARY KEY, session_id VARCHAR(255) UNIQUE, data VARCHAR(255), ttl INTEGER(11) - )"); + )' + ); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Storage/Adapters/Dropbox/DropboxAppTest.php b/tests/Unit/Libraries/Storage/Adapters/Dropbox/DropboxAppTest.php index a586d97a6..e00727eee 100644 --- a/tests/Unit/Libraries/Storage/Adapters/Dropbox/DropboxAppTest.php +++ b/tests/Unit/Libraries/Storage/Adapters/Dropbox/DropboxAppTest.php @@ -8,7 +8,6 @@ class DropboxAppTest extends AppTestCase { - use DropboxTokenServiceTestCase; use HttpClientTestCase; @@ -41,42 +40,42 @@ class DropboxAppTest extends AppTestCase * @var array */ private $tokensGrantResponse = [ - "access_token" => "sl.BYEQ1_VadTz6nBU36WPBBVwokc3zWVMXGjcOKxV4Tadms8ZlEPM85aHVFa_k1sfjilCWOnl79RUncPZzJ3GhrqhLGIBFFRCH0rKMa_ZtcqkerJn-f5lu10Ki5PSw4fxYM80V4PL_", - "token_type" => "bearer", - "expires_in" => 14400, - "refresh_token" => "-3S067m3M5kAAAAAAAAAAcQF8zVqFUuhK-PFkFqiOfFTgiazWj5NyU-1EGWIh0ZS", - "scope" => "account_info.read files.content.read files.content.write files.metadata.read files.metadata.write sharing.read sharing.write", - "uid" => "64129261", - "account_id" => "dbid:AAC9tDKbzTQlyNms0ZcB_iH3wLv7yNn-iyE" + 'access_token' => 'sl.BYEQ1_VadTz6nBU36WPBBVwokc3zWVMXGjcOKxV4Tadms8ZlEPM85aHVFa_k1sfjilCWOnl79RUncPZzJ3GhrqhLGIBFFRCH0rKMa_ZtcqkerJn-f5lu10Ki5PSw4fxYM80V4PL_', + 'token_type' => 'bearer', + 'expires_in' => 14400, + 'refresh_token' => '-3S067m3M5kAAAAAAAAAAcQF8zVqFUuhK-PFkFqiOfFTgiazWj5NyU-1EGWIh0ZS', + 'scope' => 'account_info.read files.content.read files.content.write files.metadata.read files.metadata.write sharing.read sharing.write', + 'uid' => '64129261', + 'account_id' => 'dbid:AAC9tDKbzTQlyNms0ZcB_iH3wLv7yNn-iyE', ]; /** * @var array */ private $profileDataResponse = [ - "account_id" => "dbid:AAH4f99T0taONIb-OurWxbNQ6ywGRopQngc", - "disabled" => false, - "email" => "franz@dropbox.com", - "email_verified" => true, - "is_teammate" => false, - "name" => [ - "abbreviated_name" => "FF", - "display_name" => "Franz Ferdinand (Personal)", - "familiar_name" => "Franz", - "given_name" => "Franz", - "surname" => "Ferdinand" + 'account_id' => 'dbid:AAH4f99T0taONIb-OurWxbNQ6ywGRopQngc', + 'disabled' => false, + 'email' => 'franz@dropbox.com', + 'email_verified' => true, + 'is_teammate' => false, + 'name' => [ + 'abbreviated_name' => 'FF', + 'display_name' => 'Franz Ferdinand (Personal)', + 'familiar_name' => 'Franz', + 'given_name' => 'Franz', + 'surname' => 'Ferdinand', ], - "profile_photo_url" => "https://dl-web.dropbox.com/account_photo/get/69330102&size=128x128" + 'profile_photo_url' => 'https://dl-web.dropbox.com/account_photo/get/69330102&size=128x128', ]; /** * @var array */ private $errorResponse = [ - "error" => [ - ".tag" => "no_account" + 'error' => [ + '.tag' => 'no_account', ], - "error_summary" => "no_account/..." + 'error_summary' => 'no_account/...', ]; /** @@ -156,7 +155,7 @@ public function testDropboxSendRequest() public function testDropboxRequestWithAccessTokenExpired() { - $this->currentErrors = ["code" => 401]; + $this->currentErrors = ['code' => 401]; $this->currentResponse = (object)$this->errorResponse; diff --git a/tests/Unit/Libraries/Storage/Adapters/Dropbox/DropboxFileSystemAdapterTest.php b/tests/Unit/Libraries/Storage/Adapters/Dropbox/DropboxFileSystemAdapterTest.php index 56c63fe7b..1d7698f09 100644 --- a/tests/Unit/Libraries/Storage/Adapters/Dropbox/DropboxFileSystemAdapterTest.php +++ b/tests/Unit/Libraries/Storage/Adapters/Dropbox/DropboxFileSystemAdapterTest.php @@ -9,7 +9,6 @@ class DropboxFileSystemAdapterTest extends AppTestCase { - /** * @var DropboxFileSystemAdapter */ @@ -60,7 +59,7 @@ public function setUp(): void $dropboxAppMock ->shouldReceive('path') - ->andReturnUsing(fn($path) => ['path' => '/' . trim($path, '/')]); + ->andReturnUsing(fn ($path) => ['path' => '/' . trim($path, '/')]); $this->fs = new DropboxFileSystemAdapter($dropboxAppMock); } @@ -189,38 +188,38 @@ public function testDropboxListDirectory() { self::$response['entries'] = [ [ - ".tag" => "folder", - "name" => "empty", - "path_lower" => "/test/empty", - "path_display" => "/test/empty", - "id" => "id:SziOaBdnr3oAAAAAAAAAWQ", + '.tag' => 'folder', + 'name' => 'empty', + 'path_lower' => '/test/empty', + 'path_display' => '/test/empty', + 'id' => 'id:SziOaBdnr3oAAAAAAAAAWQ', ], [ - ".tag" => "file", - "name" => "logo.png", - "path_lower" => "/test/logo.png", - "path_display" => "/test/logo.png", - "id" => "id:SziOaBdnr3oAAAAAAAAAVQ", - "client_modified" => "2023-02-24T15:34:43Z", - "server_modified" => "2023-02-24T15:34:44Z", - "rev" => "5f573de5b0b13c07503b1", - "size" => 3455, - "is_downloadable" => true, - "content_hash" => "4be946abd21ac3fbe9e363192dbb7efe18a2071f5e287fef0f9580bf67141c55", + '.tag' => 'file', + 'name' => 'logo.png', + 'path_lower' => '/test/logo.png', + 'path_display' => '/test/logo.png', + 'id' => 'id:SziOaBdnr3oAAAAAAAAAVQ', + 'client_modified' => '2023-02-24T15:34:43Z', + 'server_modified' => '2023-02-24T15:34:44Z', + 'rev' => '5f573de5b0b13c07503b1', + 'size' => 3455, + 'is_downloadable' => true, + 'content_hash' => '4be946abd21ac3fbe9e363192dbb7efe18a2071f5e287fef0f9580bf67141c55', ], [ - ".tag" => "file", - "name" => "Image 19.jpg", - "path_lower" => "/test/image 19.jpg", - "path_display" => "/test/Image 19.jpg", - "id" => "id:SziOaBdnr3oAAAAAAAAAVw", - "client_modified" => "2023-03-01T17:12:58Z", - "server_modified" => "2023-03-01T17:12:58Z", - "rev" => "5f5d9d2e5217cc07503b1", - "size" => 2083432, - "is_downloadable" => true, - "content_hash" => "52e9a39cad88c0a5518e40d02c5e66f13634d102211923f3cbf919fe52c652b7", - ] + '.tag' => 'file', + 'name' => 'Image 19.jpg', + 'path_lower' => '/test/image 19.jpg', + 'path_display' => '/test/Image 19.jpg', + 'id' => 'id:SziOaBdnr3oAAAAAAAAAVw', + 'client_modified' => '2023-03-01T17:12:58Z', + 'server_modified' => '2023-03-01T17:12:58Z', + 'rev' => '5f5d9d2e5217cc07503b1', + 'size' => 2083432, + 'is_downloadable' => true, + 'content_hash' => '52e9a39cad88c0a5518e40d02c5e66f13634d102211923f3cbf919fe52c652b7', + ], ]; $entries = $this->fs->listDirectory('test'); @@ -234,4 +233,4 @@ public function testDropboxListDirectory() $this->assertNull($this->fs->listDirectory('test')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Storage/Adapters/Dropbox/DropboxTokenServiceTestCase.php b/tests/Unit/Libraries/Storage/Adapters/Dropbox/DropboxTokenServiceTestCase.php index 544542b39..6352dfd98 100644 --- a/tests/Unit/Libraries/Storage/Adapters/Dropbox/DropboxTokenServiceTestCase.php +++ b/tests/Unit/Libraries/Storage/Adapters/Dropbox/DropboxTokenServiceTestCase.php @@ -31,4 +31,4 @@ protected function mockTokenService() return $tokenServiceMock; } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveAppTest.php b/tests/Unit/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveAppTest.php index dea0d9bc3..d96220075 100644 --- a/tests/Unit/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveAppTest.php +++ b/tests/Unit/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveAppTest.php @@ -8,7 +8,6 @@ class GoogleDriveAppTest extends AppTestCase { - use GoogleDriveTokenServiceTestCase; use HttpClientTestCase; @@ -20,7 +19,7 @@ class GoogleDriveAppTest extends AppTestCase /** * @var string */ - private $appKey = 'x0hwm8wy63rrynm'; + private $appKey = 'x0hwm8wy63rrynm'; /** * @var string @@ -41,18 +40,18 @@ class GoogleDriveAppTest extends AppTestCase * @var array */ private $tokensGrantResponse = [ - "access_token" => "sl.BYEQ1_VadTz6nBU36WPBBVwokc3zWVMXGjcOKxV4Tadms8ZlEPM85aHVFa_k1sfjilCWOnl79RUncPZzJ3GhrqhLGIBFFRCH0rKMa_ZtcqkerJn-f5lu10Ki5PSw4fxYM80V4PL_", - "refresh_token" => "-3S067m3M5kAAAAAAAAAAcQF8zVqFUuhK-PFkFqiOfFTgiazWj5NyU-1EGWIh0ZS" + 'access_token' => 'sl.BYEQ1_VadTz6nBU36WPBBVwokc3zWVMXGjcOKxV4Tadms8ZlEPM85aHVFa_k1sfjilCWOnl79RUncPZzJ3GhrqhLGIBFFRCH0rKMa_ZtcqkerJn-f5lu10Ki5PSw4fxYM80V4PL_', + 'refresh_token' => '-3S067m3M5kAAAAAAAAAAcQF8zVqFUuhK-PFkFqiOfFTgiazWj5NyU-1EGWIh0ZS', ]; /** * @var array */ private $fileMetadataResponse = [ - "id" => "file1", - "kind" => GoogleDriveApp::DRIVE_FILE_KIND, - "name" => "myFile", - "mimeType" => "text/plain" + 'id' => 'file1', + 'kind' => GoogleDriveApp::DRIVE_FILE_KIND, + 'name' => 'myFile', + 'mimeType' => 'text/plain', ]; /** @@ -133,7 +132,7 @@ public function testGoogleDriveGetFileInfo() public function testGoogleDriveRequestWithAccessTokenExpired() { - $this->currentErrors = ["code" => 401]; + $this->currentErrors = ['code' => 401]; $this->currentResponse = (object)$this->errorResponse; diff --git a/tests/Unit/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveFileSystemAdapterTest.php b/tests/Unit/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveFileSystemAdapterTest.php index 6840007bc..b35adfd93 100644 --- a/tests/Unit/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveFileSystemAdapterTest.php +++ b/tests/Unit/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveFileSystemAdapterTest.php @@ -9,7 +9,6 @@ class GoogleDriveFileSystemAdapterTest extends AppTestCase { - /** * @var GoogleDriveFileSystemAdapter */ @@ -47,7 +46,7 @@ public function setUp(): void $googleDrive = Mockery::mock(GoogleDriveApp::class)->makePartial(); $googleDrive->shouldReceive('rpcRequest')->andReturnUsing(function ($endpoint, $params) { - if(str_contains($endpoint, '?alt=media')){ + if (str_contains($endpoint, '?alt=media')) { return self::$response[array_key_last(self::$response)]; } @@ -184,27 +183,27 @@ public function testGoogleDriveListDirectory() { self::$response['files'] = [ [ - "kind" => GoogleDriveApp::DRIVE_FILE_KIND, - "mimeType" => 'application/vnd.google-apps.folder', - "name" => "empty", - "id" => "SziOaBdnr3oAAAAAAAAAWQ", + 'kind' => GoogleDriveApp::DRIVE_FILE_KIND, + 'mimeType' => 'application/vnd.google-apps.folder', + 'name' => 'empty', + 'id' => 'SziOaBdnr3oAAAAAAAAAWQ', ], [ - "kind" => GoogleDriveApp::DRIVE_FILE_KIND, - "mimeType" => 'image/png', - "name" => "logo.png", - "id" => "SziOaBdnr3oAAAAAAAAAVQ", - "modifiedTime" => "2023-02-24T15:34:44Z", - "size" => 3455, + 'kind' => GoogleDriveApp::DRIVE_FILE_KIND, + 'mimeType' => 'image/png', + 'name' => 'logo.png', + 'id' => 'SziOaBdnr3oAAAAAAAAAVQ', + 'modifiedTime' => '2023-02-24T15:34:44Z', + 'size' => 3455, ], [ - "kind" => GoogleDriveApp::DRIVE_FILE_KIND, - "mimeType" => 'image/jpeg', - "name" => "Image 19.jpg", - "id" => "SziOaBdnr3oAAAAAAAAAVw", - "modifiedTime" => "2023-03-01T17:12:58Z", - "size" => 2083432, - ] + 'kind' => GoogleDriveApp::DRIVE_FILE_KIND, + 'mimeType' => 'image/jpeg', + 'name' => 'Image 19.jpg', + 'id' => 'SziOaBdnr3oAAAAAAAAAVw', + 'modifiedTime' => '2023-03-01T17:12:58Z', + 'size' => 2083432, + ], ]; $entries = $this->fs->listDirectory('test'); @@ -218,4 +217,4 @@ public function testGoogleDriveListDirectory() $this->assertNull($this->fs->listDirectory('test')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveTokenServiceTestCase.php b/tests/Unit/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveTokenServiceTestCase.php index 5010cd705..988bd309e 100644 --- a/tests/Unit/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveTokenServiceTestCase.php +++ b/tests/Unit/Libraries/Storage/Adapters/GoogleDrive/GoogleDriveTokenServiceTestCase.php @@ -25,4 +25,4 @@ protected function mockTokenService() return $tokenServiceMock; } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Storage/Adapters/Local/LocalFileSystemAdapterTest.php b/tests/Unit/Libraries/Storage/Adapters/Local/LocalFileSystemAdapterTest.php index eb2c72446..ed9281057 100644 --- a/tests/Unit/Libraries/Storage/Adapters/Local/LocalFileSystemAdapterTest.php +++ b/tests/Unit/Libraries/Storage/Adapters/Local/LocalFileSystemAdapterTest.php @@ -7,7 +7,6 @@ class LocalFileSystemAdapterTest extends AppTestCase { - /** * @var LocalFileSystemAdapter */ @@ -343,4 +342,4 @@ public function testLocalIncludeOnceBehavior() $this->fs->remove($file); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Storage/Factories/FileSystemFactoryTest.php b/tests/Unit/Libraries/Storage/Factories/FileSystemFactoryTest.php index 3872f0710..b65ef48ac 100644 --- a/tests/Unit/Libraries/Storage/Factories/FileSystemFactoryTest.php +++ b/tests/Unit/Libraries/Storage/Factories/FileSystemFactoryTest.php @@ -9,11 +9,9 @@ use Quantum\Libraries\Storage\Factories\FileSystemFactory; use Quantum\Libraries\Storage\FileSystem; use Quantum\Tests\Unit\AppTestCase; -use Mockery; class FileSystemFactoryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -70,4 +68,4 @@ public function testFileSystemFactoryReturnsSameInstance() $this->assertSame($fs1, $fs2); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Storage/FileSystemTest.php b/tests/Unit/Libraries/Storage/FileSystemTest.php index c7634bdd6..b391109ad 100644 --- a/tests/Unit/Libraries/Storage/FileSystemTest.php +++ b/tests/Unit/Libraries/Storage/FileSystemTest.php @@ -15,7 +15,6 @@ class FileSystemTest extends AppTestCase { - public $googleDriveAppMock; private $dropboxAppMock; @@ -36,14 +35,12 @@ public function testFileSystemGetAdapter() $this->assertInstanceOf(FilesystemAdapterInterface::class, $localFs->getAdapter()); - $dropboxFs = new FileSystem(new DropboxFileSystemAdapter($this->dropboxAppMock)); $this->assertInstanceOf(DropboxFileSystemAdapter::class, $dropboxFs->getAdapter()); $this->assertInstanceOf(FilesystemAdapterInterface::class, $dropboxFs->getAdapter()); - $googleDriveFs = new FileSystem(new GoogleDriveFileSystemAdapter($this->googleDriveAppMock)); $this->assertInstanceOf(GoogleDriveFileSystemAdapter::class, $googleDriveFs->getAdapter()); @@ -68,4 +65,4 @@ public function testMailerCallingInvalidMethod() $mailer->callingInvalidMethod(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Storage/Helpers/FileSystemHelperFunctionsTest.php b/tests/Unit/Libraries/Storage/Helpers/FileSystemHelperFunctionsTest.php index 43d92b86a..aa8e3cb30 100644 --- a/tests/Unit/Libraries/Storage/Helpers/FileSystemHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Storage/Helpers/FileSystemHelperFunctionsTest.php @@ -10,7 +10,6 @@ class FileSystemHelperFunctionsTest extends AppTestCase { - public function testFileSystemHelperGetDefaultFileSystem() { $this->assertInstanceOf(FileSystem::class, fs()); @@ -38,4 +37,4 @@ public function testFileSystemHelperGetGoogleDriveFileSystem() $this->assertInstanceOf(GoogleDriveFileSystemAdapter::class, fs(FileSystem::GDRIVE)->getAdapter()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Storage/HttpClientTestCase.php b/tests/Unit/Libraries/Storage/HttpClientTestCase.php index 8352d7538..3abd098b2 100644 --- a/tests/Unit/Libraries/Storage/HttpClientTestCase.php +++ b/tests/Unit/Libraries/Storage/HttpClientTestCase.php @@ -7,7 +7,6 @@ trait HttpClientTestCase { - protected $url; protected $response; @@ -43,12 +42,12 @@ protected function mockHttpClient() return $httpClientMock; }); - $httpClientMock->shouldReceive('getErrors')->andReturnUsing(fn() => (array)$this->response[$this->url]['errors']); + $httpClientMock->shouldReceive('getErrors')->andReturnUsing(fn () => (array)$this->response[$this->url]['errors']); - $httpClientMock->shouldReceive('getResponseBody')->andReturnUsing(fn() => $this->response[$this->url]['body']); + $httpClientMock->shouldReceive('getResponseBody')->andReturnUsing(fn () => $this->response[$this->url]['body']); - $httpClientMock->shouldReceive('url')->andReturnUsing(fn() => $this->url); + $httpClientMock->shouldReceive('url')->andReturnUsing(fn () => $this->url); return $httpClientMock; } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Storage/UploadedFileTest.php b/tests/Unit/Libraries/Storage/UploadedFileTest.php index 014fa8aea..65a0d5f35 100644 --- a/tests/Unit/Libraries/Storage/UploadedFileTest.php +++ b/tests/Unit/Libraries/Storage/UploadedFileTest.php @@ -12,7 +12,6 @@ class UploadedDouble extends UploadedFile { - public function isUploaded(): bool { return file_exists($this->getPathname()); @@ -27,7 +26,6 @@ protected function moveUploadedFile(string $filePath): bool class UploadedFileTest extends AppTestCase { - private $fileMeta; public function setUp(): void @@ -252,4 +250,4 @@ public function testUploadedFileGetErrorCodeAndMessage() $this->assertEquals('The uploaded file exceeds the upload_max_filesize directive in php.ini', $uploadedFile->getErrorMessage()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Transformer/Helpers/TransformerHelperFunctionsTest.php b/tests/Unit/Libraries/Transformer/Helpers/TransformerHelperFunctionsTest.php index dd34c1dea..f564df179 100644 --- a/tests/Unit/Libraries/Transformer/Helpers/TransformerHelperFunctionsTest.php +++ b/tests/Unit/Libraries/Transformer/Helpers/TransformerHelperFunctionsTest.php @@ -7,7 +7,6 @@ class TransformerHelperFunctionsTest extends AppTestCase { - public $posts = [ [ 'id' => 1, @@ -19,8 +18,8 @@ class TransformerHelperFunctionsTest extends AppTestCase 'firstname' => 'Bob', 'lastname' => 'Jonson', 'email' => 'bob@jonson.com', - 'created_at' => '2021-01-12 11:05:00' - ] + 'created_at' => '2021-01-12 11:05:00', + ], ], [ 'id' => 2, @@ -32,8 +31,8 @@ class TransformerHelperFunctionsTest extends AppTestCase 'firstname' => 'Ken', 'lastname' => 'Watson', 'email' => 'ken@watson.com', - 'created_at' => '2021-02-11 12:15:00' - ] + 'created_at' => '2021-02-11 12:15:00', + ], ], ]; public $expected = [ @@ -42,15 +41,15 @@ class TransformerHelperFunctionsTest extends AppTestCase 'title' => 'Post one title', 'content' => 'Post one content', 'updated' => '2022-06-29 19:57:00', - 'author' => 'Bob Jonson' + 'author' => 'Bob Jonson', ], [ 'id' => 2, 'title' => 'Post two title', 'content' => 'Post two content', 'updated' => '2022-07-21 15:33:00', - 'author' => 'Ken Watson' - ] + 'author' => 'Ken Watson', + ], ]; public function testTransformerHelper() { @@ -58,4 +57,4 @@ public function testTransformerHelper() $this->assertEquals($this->expected, $transformed); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Transformer/PostTransformer.php b/tests/Unit/Libraries/Transformer/PostTransformer.php index a34de22cb..7ea2c3cf0 100644 --- a/tests/Unit/Libraries/Transformer/PostTransformer.php +++ b/tests/Unit/Libraries/Transformer/PostTransformer.php @@ -6,7 +6,6 @@ class PostTransformer implements TransformerInterface { - public function transform($item) { return [ @@ -14,7 +13,7 @@ public function transform($item) 'title' => $item['title'], 'content' => $item['content'], 'updated' => $item['updated_at'], - 'author' => $item['user']['firstname'] . ' ' . $item['user']['lastname'] + 'author' => $item['user']['firstname'] . ' ' . $item['user']['lastname'], ]; } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Transformer/TransformerTest.php b/tests/Unit/Libraries/Transformer/TransformerTest.php index 373d4716b..540313097 100644 --- a/tests/Unit/Libraries/Transformer/TransformerTest.php +++ b/tests/Unit/Libraries/Transformer/TransformerTest.php @@ -1,6 +1,5 @@ 'Bob', 'lastname' => 'Jonson', 'email' => 'bob@jonson.com', - 'created_at' => '2021-01-12 11:05:00' - ] + 'created_at' => '2021-01-12 11:05:00', + ], ], [ 'id' => 2, @@ -32,8 +31,8 @@ class TransformerTest extends TestCase 'firstname' => 'Ken', 'lastname' => 'Watson', 'email' => 'ken@watson.com', - 'created_at' => '2021-02-11 12:15:00' - ] + 'created_at' => '2021-02-11 12:15:00', + ], ], ]; public $expected = [ @@ -42,15 +41,15 @@ class TransformerTest extends TestCase 'title' => 'Post one title', 'content' => 'Post one content', 'updated' => '2022-06-29 19:57:00', - 'author' => 'Bob Jonson' + 'author' => 'Bob Jonson', ], [ 'id' => 2, 'title' => 'Post two title', 'content' => 'Post two content', 'updated' => '2022-07-21 15:33:00', - 'author' => 'Ken Watson' - ] + 'author' => 'Ken Watson', + ], ]; public function testDataTransforming() @@ -59,4 +58,4 @@ public function testDataTransforming() $this->assertEquals($this->expected, $transformed); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Validation/Traits/FileRuleTest.php b/tests/Unit/Libraries/Validation/Traits/FileRuleTest.php index 40b9a9c3e..bb157124a 100644 --- a/tests/Unit/Libraries/Validation/Traits/FileRuleTest.php +++ b/tests/Unit/Libraries/Validation/Traits/FileRuleTest.php @@ -9,7 +9,6 @@ class FileRuleTest extends AppTestCase { - public $validator; private $request; @@ -55,13 +54,13 @@ public function testRuleFileSize() $this->request->create('POST', '/upload', [], [], $file); $this->validator->setRule('image', [ - Rule::fileSize(1000) + Rule::fileSize(1000), ]); $this->assertTrue($this->validator->isValid($this->request->all())); $this->validator->setRule('image', [ - Rule::fileSize(9000, 500) + Rule::fileSize(9000, 500), ]); $this->assertFalse($this->validator->isValid($this->request->all())); @@ -88,19 +87,19 @@ public function testRuleFileMimeType() $this->request->create('POST', '/upload', [], [], $file); $this->validator->setRule('image', [ - Rule::fileMimeType('image/png') + Rule::fileMimeType('image/png'), ]); $this->assertTrue($this->validator->isValid($this->request->all())); $this->validator->setRule('image', [ - Rule::fileMimeType('image/jpg', 'image/jpeg', 'image/png') + Rule::fileMimeType('image/jpg', 'image/jpeg', 'image/png'), ]); $this->assertTrue($this->validator->isValid($this->request->all())); $this->validator->setRule('image', [ - Rule::fileMimeType('image/gif', 'image/jpg') + Rule::fileMimeType('image/gif', 'image/jpg'), ]); $this->assertFalse($this->validator->isValid($this->request->all())); @@ -127,19 +126,19 @@ public function testRuleFileExtension() $this->request->create('POST', '/upload', [], [], $file); $this->validator->setRule('image', [ - Rule::fileExtension('jpg') + Rule::fileExtension('jpg'), ]); $this->assertTrue($this->validator->isValid($this->request->all())); $this->validator->setRule('image', [ - Rule::fileExtension('png', 'jpg', 'gif') + Rule::fileExtension('png', 'jpg', 'gif'), ]); $this->assertTrue($this->validator->isValid($this->request->all())); $this->validator->setRule('image', [ - Rule::fileExtension('exe', 'bmp') + Rule::fileExtension('exe', 'bmp'), ]); $this->assertFalse($this->validator->isValid($this->request->all())); @@ -166,13 +165,13 @@ public function testRuleImageDimensions() $this->request->create('POST', '/upload', [], [], $file); $this->validator->setRule('image', [ - Rule::imageDimensions(28, 18) + Rule::imageDimensions(28, 18), ]); $this->assertTrue($this->validator->isValid($this->request->all())); $this->validator->setRule('image', [ - Rule::imageDimensions(300, 500) + Rule::imageDimensions(300, 500), ]); $this->assertFalse($this->validator->isValid($this->request->all())); @@ -183,4 +182,4 @@ public function testRuleImageDimensions() $this->assertEquals('validation.imageDimensions', $errors['image'][0]); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Validation/Traits/GeneralRuleTest.php b/tests/Unit/Libraries/Validation/Traits/GeneralRuleTest.php index ab5d159b8..6c3083233 100644 --- a/tests/Unit/Libraries/Validation/Traits/GeneralRuleTest.php +++ b/tests/Unit/Libraries/Validation/Traits/GeneralRuleTest.php @@ -12,7 +12,6 @@ class GeneralRuleTest extends AppTestCase { - public $validator; public function setUp(): void { @@ -31,13 +30,13 @@ public function setUp(): void public function tearDown(): void { - Database::execute("DROP TABLE IF EXISTS users"); + Database::execute('DROP TABLE IF EXISTS users'); } public function testRuleRequired() { $this->validator->setRule('text', [ - Rule::required() + Rule::required(), ]); $this->assertTrue($this->validator->isValid(['text' => 'something'])); @@ -56,7 +55,7 @@ public function testRuleRequired() public function testRuleEmail() { $this->validator->setRule('text', [ - Rule::email() + Rule::email(), ]); $this->assertTrue($this->validator->isValid(['text' => 'something@mail.com'])); @@ -73,7 +72,7 @@ public function testRuleEmail() public function testRuleCreditCard() { $this->validator->setRule('text', [ - Rule::creditCard() + Rule::creditCard(), ]); $this->assertTrue($this->validator->isValid(['text' => '4111111111111111'])); @@ -90,7 +89,7 @@ public function testRuleCreditCard() public function testRuleIban() { $this->validator->setRule('text', [ - Rule::iban() + Rule::iban(), ]); $this->assertTrue($this->validator->isValid(['text' => 'DE75512108001245126199'])); @@ -109,7 +108,7 @@ public function testRuleIban() public function testRuleName() { $this->validator->setRule('text', [ - Rule::name() + Rule::name(), ]); $this->assertTrue($this->validator->isValid(['text' => 'John'])); @@ -130,7 +129,7 @@ public function testRuleName() public function testRuleStreetAddress() { $this->validator->setRule('text', [ - Rule::streetAddress() + Rule::streetAddress(), ]); $this->assertTrue($this->validator->isValid(['text' => 'Barbara ave. 12'])); @@ -151,7 +150,7 @@ public function testRuleStreetAddress() public function testRulePhoneNumber() { $this->validator->setRule('text', [ - Rule::phoneNumber() + Rule::phoneNumber(), ]); $this->assertTrue($this->validator->isValid(['text' => '1-555-555-5555'])); @@ -180,7 +179,7 @@ public function testRulePhoneNumber() public function testRuleDate() { $this->validator->setRule('text', [ - Rule::date() + Rule::date(), ]); $this->assertTrue($this->validator->isValid(['text' => '2020-05-09'])); @@ -188,13 +187,13 @@ public function testRuleDate() $this->assertTrue($this->validator->isValid(['text' => '2020-05-09 01:58:00'])); $this->validator->setRule('text', [ - Rule::date('m/d/Y') + Rule::date('m/d/Y'), ]); $this->assertTrue($this->validator->isValid(['text' => '05/09/2020'])); $this->validator->setRule('text', [ - Rule::date('m/d/Y H:i:s') + Rule::date('m/d/Y H:i:s'), ]); $this->assertTrue($this->validator->isValid(['text' => '05/09/2020 01:59:00'])); @@ -211,13 +210,13 @@ public function testRuleDate() public function testRuleStarts() { $this->validator->setRule('text', [ - Rule::starts('b') + Rule::starts('b'), ]); $this->assertTrue($this->validator->isValid(['text' => 'bike'])); $this->validator->setRule('text', [ - Rule::starts('br') + Rule::starts('br'), ]); $this->assertTrue($this->validator->isValid(['text' => 'break'])); @@ -234,13 +233,13 @@ public function testRuleStarts() public function testRuleRegex() { $this->validator->setRule('text', [ - Rule::regex('/^[1-9]+$/') + Rule::regex('/^[1-9]+$/'), ]); $this->assertTrue($this->validator->isValid(['text' => 123])); $this->validator->setRule('text', [ - Rule::regex('/^[a-zA-Z]+$/') + Rule::regex('/^[a-zA-Z]+$/'), ]); $this->assertTrue($this->validator->isValid(['text' => 'Hello'])); @@ -259,7 +258,7 @@ public function testRuleRegex() public function testRuleJsonString() { $this->validator->setRule('text', [ - Rule::jsonString() + Rule::jsonString(), ]); $this->assertTrue($this->validator->isValid(['text' => '{"widget": {"debug": "on", "version": "1.0"}}'])); @@ -276,7 +275,7 @@ public function testRuleJsonString() public function testRuleSame() { $this->validator->setRule('password', [ - Rule::same('confirm_password') + Rule::same('confirm_password'), ]); $this->assertTrue($this->validator->isValid(['password' => 'qwerty', 'confirm_password' => 'qwerty'])); @@ -292,15 +291,15 @@ public function testRuleSame() public function testRuleUnique() { - $this->createUsersTable(); + $this->createUsersTable(); $this->validator->setRule('username', [ - Rule::unique(TestUserModel::class, 'username') + Rule::unique(TestUserModel::class, 'username'), ]); $this->assertTrue($this->validator->isValid(['username' => 'john@doe'])); - $this->insertTestUser(); + $this->insertTestUser(); $this->assertFalse($this->validator->isValid(['username' => 'john@doe'])); @@ -316,7 +315,7 @@ public function testRuleExists() $this->createUsersTable(); $this->validator->setRule('username', [ - Rule::exists(TestUserModel::class, 'username') + Rule::exists(TestUserModel::class, 'username'), ]); $this->assertFalse($this->validator->isValid(['username' => 'john@doe'])); @@ -335,14 +334,14 @@ public function testRuleExists() protected function createUsersTable(): void { - Database::execute(" + Database::execute(' CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(255), password VARCHAR(255), created_at DATETIME ) - "); + '); } protected function insertTestUser(string $username = 'john@doe', string $password = '123456'): void @@ -353,4 +352,4 @@ protected function insertTestUser(string $username = 'john@doe', string $passwor $model->password = $password; $model->save(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Validation/Traits/LengthRuleTest.php b/tests/Unit/Libraries/Validation/Traits/LengthRuleTest.php index b717b2ec0..82d3bcd79 100644 --- a/tests/Unit/Libraries/Validation/Traits/LengthRuleTest.php +++ b/tests/Unit/Libraries/Validation/Traits/LengthRuleTest.php @@ -8,7 +8,6 @@ class LengthRuleTest extends AppTestCase { - public $validator; private $request; @@ -16,7 +15,6 @@ public function setUp(): void { parent::setUp(); - $this->validator = new Validator(); } @@ -24,7 +22,7 @@ public function setUp(): void public function testRuleMinLen() { $this->validator->setRule('text', [ - Rule::minLen(3) + Rule::minLen(3), ]); $this->assertTrue($this->validator->isValid(['text' => 'something'])); @@ -41,7 +39,7 @@ public function testRuleMinLen() public function testRuleMaxLen() { $this->validator->setRule('text', [ - Rule::maxLen(5) + Rule::maxLen(5), ]); $this->assertTrue($this->validator->isValid(['text' => 'some'])); @@ -58,7 +56,7 @@ public function testRuleMaxLen() public function testRuleExactLen() { $this->validator->setRule('text', [ - Rule::exactLen(4) + Rule::exactLen(4), ]); $this->assertTrue($this->validator->isValid(['text' => 'some'])); @@ -73,4 +71,4 @@ public function testRuleExactLen() $this->assertEquals('validation.exactLen', $errors['text'][0]); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Validation/Traits/ListRuleTest.php b/tests/Unit/Libraries/Validation/Traits/ListRuleTest.php index 8e08ec336..9a6767eb0 100644 --- a/tests/Unit/Libraries/Validation/Traits/ListRuleTest.php +++ b/tests/Unit/Libraries/Validation/Traits/ListRuleTest.php @@ -8,7 +8,6 @@ class ListRuleTest extends AppTestCase { - public $validator; private $request; @@ -16,7 +15,6 @@ public function setUp(): void { parent::setUp(); - $this->validator = new Validator(); } @@ -24,7 +22,7 @@ public function setUp(): void public function testRuleContains() { $this->validator->setRule('text', [ - Rule::contains('Fisherman goes out') + Rule::contains('Fisherman goes out'), ]); $this->assertTrue($this->validator->isValid(['text' => 'Fisherman'])); @@ -45,7 +43,7 @@ public function testRuleContains() public function testRuleContainsList() { $this->validator->setRule('text', [ - Rule::containsList('male', 'female') + Rule::containsList('male', 'female'), ]); $this->assertTrue($this->validator->isValid(['text' => 'male'])); @@ -64,7 +62,7 @@ public function testRuleContainsList() public function testRuleDoesntContainsList() { $this->validator->setRule('text', [ - Rule::doesntContainsList('male', 'famale') + Rule::doesntContainsList('male', 'famale'), ]); $this->assertTrue($this->validator->isValid(['text' => 'elephant'])); @@ -79,4 +77,4 @@ public function testRuleDoesntContainsList() $this->assertEquals('validation.doesntContainsList', $errors['text'][0]); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Validation/Traits/ResourceRuleTest.php b/tests/Unit/Libraries/Validation/Traits/ResourceRuleTest.php index 384744afb..b35dddd33 100644 --- a/tests/Unit/Libraries/Validation/Traits/ResourceRuleTest.php +++ b/tests/Unit/Libraries/Validation/Traits/ResourceRuleTest.php @@ -8,7 +8,6 @@ class ResourceRuleTest extends AppTestCase { - public $validator; private $request; @@ -23,7 +22,7 @@ public function setUp(): void public function testRuleUrl() { $this->validator->setRule('text', [ - Rule::url() + Rule::url(), ]); $this->assertTrue($this->validator->isValid(['text' => 'http://something.com'])); @@ -44,7 +43,7 @@ public function testRuleUrl() public function testRuleUrlExists() { $this->validator->setRule('text', [ - Rule::urlExists() + Rule::urlExists(), ]); $this->assertTrue($this->validator->isValid(['text' => 'http://google.com'])); @@ -95,7 +94,7 @@ public function testRuleIpV4() public function testRuleIpV6() { $this->validator->setRule('text', [ - Rule::ipv6() + Rule::ipv6(), ]); $this->assertTrue($this->validator->isValid(['text' => '2001:0000:3238:DFE1:0063:0000:0000:FEFB'])); @@ -108,4 +107,4 @@ public function testRuleIpV6() $this->assertEquals('validation.ipv6', $errors['text'][0]); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Validation/Traits/TypeRuleTest.php b/tests/Unit/Libraries/Validation/Traits/TypeRuleTest.php index bb4575fe1..1dd974c6f 100644 --- a/tests/Unit/Libraries/Validation/Traits/TypeRuleTest.php +++ b/tests/Unit/Libraries/Validation/Traits/TypeRuleTest.php @@ -8,7 +8,6 @@ class TypeRuleTest extends AppTestCase { - public $validator; public function setUp(): void { @@ -20,7 +19,7 @@ public function setUp(): void public function testRuleAlpha() { $this->validator->setRule('text', [ - Rule::alpha() + Rule::alpha(), ]); $this->assertTrue($this->validator->isValid(['text' => 'some'])); @@ -39,7 +38,7 @@ public function testRuleAlpha() public function testRuleAlphaNumeric() { $this->validator->setRule('text', [ - Rule::alphaNumeric() + Rule::alphaNumeric(), ]); $this->assertTrue($this->validator->isValid(['text' => 'some'])); @@ -60,7 +59,7 @@ public function testRuleAlphaNumeric() public function testRuleAlphaDash() { $this->validator->setRule('text', [ - Rule::alphaDash() + Rule::alphaDash(), ]); $this->assertTrue($this->validator->isValid(['text' => 'some'])); @@ -79,7 +78,7 @@ public function testRuleAlphaDash() public function testRuleAlphaSpace() { $this->validator->setRule('text', [ - Rule::alphaSpace() + Rule::alphaSpace(), ]); $this->assertTrue($this->validator->isValid(['text' => 'some'])); @@ -100,7 +99,7 @@ public function testRuleAlphaSpace() public function testRuleNumeric() { $this->validator->setRule('text', [ - Rule::numeric() + Rule::numeric(), ]); $this->assertTrue($this->validator->isValid(['text' => 555])); @@ -119,7 +118,7 @@ public function testRuleNumeric() public function testRuleInteger() { $this->validator->setRule('text', [ - Rule::integer() + Rule::integer(), ]); $this->assertTrue($this->validator->isValid(['text' => 555])); @@ -138,7 +137,7 @@ public function testRuleInteger() public function testRuleFloat() { $this->validator->setRule('text', [ - Rule::float() + Rule::float(), ]); $this->assertTrue($this->validator->isValid(['text' => 11.12])); @@ -159,7 +158,7 @@ public function testRuleFloat() public function testRuleBoolean() { $this->validator->setRule('text', [ - Rule::boolean() + Rule::boolean(), ]); $this->assertTrue($this->validator->isValid(['text' => true])); @@ -186,7 +185,7 @@ public function testRuleBoolean() public function testRuleMinNumeric() { $this->validator->setRule('text', [ - Rule::minNumeric(20) + Rule::minNumeric(20), ]); $this->assertTrue($this->validator->isValid(['text' => 25])); @@ -203,7 +202,7 @@ public function testRuleMinNumeric() public function testRuleMaxNumeric() { $this->validator->setRule('text', [ - Rule::maxNumeric(20) + Rule::maxNumeric(20), ]); $this->assertTrue($this->validator->isValid(['text' => 15])); @@ -216,4 +215,4 @@ public function testRuleMaxNumeric() $this->assertEquals('validation.maxNumeric', $errors['text'][0]); } -} \ No newline at end of file +} diff --git a/tests/Unit/Libraries/Validation/ValidatorTest.php b/tests/Unit/Libraries/Validation/ValidatorTest.php index 827e92d6d..7e914c5c9 100644 --- a/tests/Unit/Libraries/Validation/ValidatorTest.php +++ b/tests/Unit/Libraries/Validation/ValidatorTest.php @@ -8,7 +8,6 @@ class ValidatorTest extends AppTestCase { - private $validator; public function setUp(): void @@ -52,7 +51,7 @@ public function testMultipleRules() $this->validator->setRule('text', [ Rule::minLen(7), Rule::maxLen(20), - Rule::email() + Rule::email(), ]); $this->assertTrue($this->validator->isValid(['text' => 'someone@gmail.com'])); @@ -81,11 +80,11 @@ public function testMultipleFields() $this->validator->setRules([ 'name' => [ Rule::required(), - Rule::maxLen(30) + Rule::maxLen(30), ], 'email' => [ Rule::required(), - Rule::email() + Rule::email(), ], 'age' => [ Rule::required(), @@ -96,7 +95,7 @@ public function testMultipleFields() $data = [ 'name' => 'John', 'email' => 'john@gmail.com', - 'age' => 36 + 'age' => 36, ]; $this->assertTrue($this->validator->isValid($data)); @@ -104,7 +103,7 @@ public function testMultipleFields() $data = [ 'name' => 'Junior', 'email' => 'johny@gc.com', - 'age' => 12 + 'age' => 12, ]; $this->assertFalse($this->validator->isValid($data)); @@ -114,7 +113,7 @@ public function testMultipleFields() $data = [ 'name' => '', 'email' => 'john@gmail.com', - 'age' => 0 + 'age' => 0, ]; $this->assertTrue($this->validator->isValid($data)); @@ -123,7 +122,7 @@ public function testMultipleFields() 'phone' => [ Rule::required(), Rule::minLen(8), - ] + ], ]); $data = [ @@ -139,11 +138,11 @@ public function testDifferentMultipleFields() { $this->validator->setRules([ 'name' => [ - Rule::maxLen(30) + Rule::maxLen(30), ], 'email' => [ Rule::required(), - Rule::email() + Rule::email(), ], 'age' => [ Rule::required(), @@ -169,12 +168,12 @@ public function testDifferentMultipleFields() public function testCustomValidator() { - $this->validator->addRule('checkName', fn($value, $param = null) => $value == $param); + $this->validator->addRule('checkName', fn ($value, $param = null) => $value == $param); $this->validator->setRules([ 'name' => [ Rule::checkName('Wayne'), - ] + ], ]); $this->assertTrue($this->validator->isValid(['name' => 'Wayne'])); diff --git a/tests/Unit/Loader/LoaderTest.php b/tests/Unit/Loader/LoaderTest.php index a87bbb474..58d399db0 100644 --- a/tests/Unit/Loader/LoaderTest.php +++ b/tests/Unit/Loader/LoaderTest.php @@ -8,7 +8,6 @@ class LoaderTest extends AppTestCase { - private $loader; public function setUp(): void @@ -40,4 +39,4 @@ public function testLoaderSetupAndLoad() $this->assertIsArray($content); } -} \ No newline at end of file +} diff --git a/tests/Unit/Loader/SetupTest.php b/tests/Unit/Loader/SetupTest.php index b478ca5d5..6158fc205 100644 --- a/tests/Unit/Loader/SetupTest.php +++ b/tests/Unit/Loader/SetupTest.php @@ -7,7 +7,6 @@ class SetupTest extends AppTestCase { - private $setup; public function setUp(): void diff --git a/tests/Unit/Model/Factories/ModelFactoryTest.php b/tests/Unit/Model/Factories/ModelFactoryTest.php index 56b2c5c4e..659b9af04 100644 --- a/tests/Unit/Model/Factories/ModelFactoryTest.php +++ b/tests/Unit/Model/Factories/ModelFactoryTest.php @@ -15,7 +15,6 @@ */ class ModelFactoryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); diff --git a/tests/Unit/Model/Helpers/ModelHelperFunctionsTest.php b/tests/Unit/Model/Helpers/ModelHelperFunctionsTest.php index 1e571871e..95e5a704a 100644 --- a/tests/Unit/Model/Helpers/ModelHelperFunctionsTest.php +++ b/tests/Unit/Model/Helpers/ModelHelperFunctionsTest.php @@ -64,4 +64,4 @@ public function testWrapToModelThrowsIfNotQtModel() wrapToModel($dbal, \stdClass::class); } -} \ No newline at end of file +} diff --git a/tests/Unit/Model/ModelCollectionTest.php b/tests/Unit/Model/ModelCollectionTest.php index a55b889da..0e5c26b67 100644 --- a/tests/Unit/Model/ModelCollectionTest.php +++ b/tests/Unit/Model/ModelCollectionTest.php @@ -117,4 +117,4 @@ public function testModelCollectionGetIterator() $this->assertSame($this->model1, $models[0]); $this->assertSame($this->model2, $models[1]); } -} \ No newline at end of file +} diff --git a/tests/Unit/Model/ModelSoftDeletesIdiOrm.php b/tests/Unit/Model/ModelSoftDeletesIdiOrm.php index 3c6a65753..3c1a29084 100644 --- a/tests/Unit/Model/ModelSoftDeletesIdiOrm.php +++ b/tests/Unit/Model/ModelSoftDeletesIdiOrm.php @@ -11,7 +11,6 @@ class ModelSoftDeletesIdiOrm extends AppTestCase { - private $model; public function setUp(): void @@ -29,7 +28,7 @@ public function setUp(): void public function tearDown(): void { - IdiormDbal::execute("DROP TABLE products "); + IdiormDbal::execute('DROP TABLE products '); } public function testDeleteSetsDeletedAt() @@ -165,14 +164,14 @@ public function testFirstExcludesDeleted() private function _createProductsTableWithData() { - IdiormDbal::execute("CREATE TABLE IF NOT EXISTS products ( + IdiormDbal::execute('CREATE TABLE IF NOT EXISTS products ( id INTEGER PRIMARY KEY AUTOINCREMENT, title VARCHAR(255), description TEXT, price REAL, created_at DATETIME, deleted_at DATETIME DEFAULT NULL - )"); + )'); IdiormDbal::execute("INSERT INTO products @@ -186,4 +185,4 @@ private function _createProductsTableWithData() ('Product F', 'Premium product F', 59.99, '2025-05-06 15:00:00', NULL) "); } -} \ No newline at end of file +} diff --git a/tests/Unit/Model/ModelSoftDeletesSleek.php b/tests/Unit/Model/ModelSoftDeletesSleek.php index 453659d21..5cf950298 100644 --- a/tests/Unit/Model/ModelSoftDeletesSleek.php +++ b/tests/Unit/Model/ModelSoftDeletesSleek.php @@ -12,7 +12,6 @@ class ModelSoftDeletesSleek extends AppTestCase { - private $model; public function setUp(): void @@ -221,4 +220,4 @@ private function _createProductsTableWithData() $product->prop('deleted_at', null); $product->save(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Model/QtModelTest.php b/tests/Unit/Model/QtModelTest.php index 6f243bd7a..b5364b3d8 100644 --- a/tests/Unit/Model/QtModelTest.php +++ b/tests/Unit/Model/QtModelTest.php @@ -1,6 +1,5 @@ model->fillObjectProps([ 'firstname' => 'Jane', 'lastname' => 'Due', - 'age' => 35 + 'age' => 35, ]); $this->assertEquals('Jane', $this->model->firstname); @@ -214,13 +212,13 @@ public function testQtModelCallingModelWithCriterias() public function testQtModelGetModelProperties() { $expected = [ - "id" => "1", - "user_id" => "1", - "firstname" => "John", - "lastname" => "Doe", - "age" => "45", - "country" => "Ireland", - "created_at" => "2025-12-17 19:27:46" + 'id' => '1', + 'user_id' => '1', + 'firstname' => 'John', + 'lastname' => 'Doe', + 'age' => '45', + 'country' => 'Ireland', + 'created_at' => '2025-12-17 19:27:46', ]; $profileModel = ModelFactory::get(TestProfileModel::class); @@ -234,7 +232,7 @@ public function testQtModelGetModelProperties() private function _createProfileTableWithData() { - IdiormDbal::execute("CREATE TABLE IF NOT EXISTS profiles ( + IdiormDbal::execute('CREATE TABLE IF NOT EXISTS profiles ( id INTEGER PRIMARY KEY, user_id INTEGER(11), firstname VARCHAR(255), @@ -242,7 +240,7 @@ private function _createProfileTableWithData() age INTEGER(11), country VARCHAR(255), created_at DATETIME - )"); + )'); IdiormDbal::execute(" INSERT INTO profiles diff --git a/tests/Unit/Module/ModuleLoaderTest.php b/tests/Unit/Module/ModuleLoaderTest.php index 3c562ea2b..2290166f8 100644 --- a/tests/Unit/Module/ModuleLoaderTest.php +++ b/tests/Unit/Module/ModuleLoaderTest.php @@ -62,4 +62,4 @@ public function testGetModuleConfigs() $this->assertArrayHasKey('Test', $configs); $this->assertArrayNotHasKey('Mame', $configs); } -} \ No newline at end of file +} diff --git a/tests/Unit/Module/ModuleManagerTest.php b/tests/Unit/Module/ModuleManagerTest.php index 57f90800d..a3cef9d6b 100644 --- a/tests/Unit/Module/ModuleManagerTest.php +++ b/tests/Unit/Module/ModuleManagerTest.php @@ -21,20 +21,22 @@ public function setUp(): void $this->modulesConfigPath = App::getBaseDir() . DS . 'shared' . DS . 'config' . DS . 'modules.php'; } - public function testCreateModule(){ - $moduleManager = new ModuleManager("Api", "DefaultApi", "yes", false); + public function testCreateModule() + { + $moduleManager = new ModuleManager('Api', 'DefaultApi', 'yes', false); $moduleManager->writeContents(); $moduleManager->addModuleConfig(); - $modules = $this->fs->require($this->modulesConfigPath);; + $modules = $this->fs->require($this->modulesConfigPath); + ; - $this->assertEquals("Api", $moduleManager->getModuleName()); + $this->assertEquals('Api', $moduleManager->getModuleName()); - $this->assertArrayHasKey("Api", $modules); + $this->assertArrayHasKey('Api', $modules); - $this->assertEquals("api", $modules["Api"]["prefix"]); + $this->assertEquals('api', $modules['Api']['prefix']); $mainController = new \Quantum\Tests\_root\modules\Api\Controllers\MainController(); @@ -46,23 +48,25 @@ public function testCreateModule(){ $result = json_decode($response->getContent()); - $this->assertEquals("success", $result->status); + $this->assertEquals('success', $result->status); - $this->assertEquals("Api module.", $result->message); + $this->assertEquals('Api module.', $result->message); } - public function testAddModuleConfigWithoutModule(){ - $moduleManager = new ModuleManager("Api", "DefaultApi", "yes", false); + public function testAddModuleConfigWithoutModule() + { + $moduleManager = new ModuleManager('Api', 'DefaultApi', 'yes', false); $this->expectException(Exception::class); - $this->expectExceptionMessage("Module directory does not exist, skipping config update."); + $this->expectExceptionMessage('Module directory does not exist, skipping config update.'); $moduleManager->addModuleConfig(); } - public function testIncompleteCopyTemplates(){ - $moduleManager = Mockery::mock(ModuleManager::class, ["Api", "DefaultApi", "yes", false])->makePartial(); + public function testIncompleteCopyTemplates() + { + $moduleManager = Mockery::mock(ModuleManager::class, ['Api', 'DefaultApi', 'yes', false])->makePartial(); $moduleManager->shouldAllowMockingProtectedMethods(); @@ -75,8 +79,9 @@ public function testIncompleteCopyTemplates(){ $moduleManager->writeContents(); } - public function testInvalidTemplate(){ - $moduleManager = new ModuleManager("NotExists", "notExists", "yes", false); + public function testInvalidTemplate() + { + $moduleManager = new ModuleManager('NotExists', 'notExists', 'yes', false); $this->expectException(Exception::class); @@ -89,10 +94,10 @@ public function tearDown(): void $moduleConfigs = $this->fs->require($this->modulesConfigPath); - $apiModulePath = App::getBaseDir() . DS . "modules" . DS . "Api"; + $apiModulePath = App::getBaseDir() . DS . 'modules' . DS . 'Api'; - if(isset($moduleConfigs["Api"])){ - unset($moduleConfigs["Api"]); + if (isset($moduleConfigs['Api'])) { + unset($moduleConfigs['Api']); $this->fs->put( $this->modulesConfigPath, @@ -100,8 +105,8 @@ public function tearDown(): void ); } - if($this->fs->isDirectory($apiModulePath)) { + if ($this->fs->isDirectory($apiModulePath)) { deleteDirectoryWithFiles($apiModulePath); } } -} \ No newline at end of file +} diff --git a/tests/Unit/Paginator/Adapters/ArrayPaginatorTest.php b/tests/Unit/Paginator/Adapters/ArrayPaginatorTest.php index 92ef6cbd8..b1ceb31d3 100644 --- a/tests/Unit/Paginator/Adapters/ArrayPaginatorTest.php +++ b/tests/Unit/Paginator/Adapters/ArrayPaginatorTest.php @@ -22,7 +22,7 @@ public function setUp(): void ['id' => 2, 'title' => 'Item 2'], ['id' => 3, 'title' => 'Item 3'], ['id' => 4, 'title' => 'Item 4'], - ['id' => 5, 'title' => 'Item 5'] + ['id' => 5, 'title' => 'Item 5'], ]; $this->paginator = new ArrayPaginator($this->items, 2, 1); @@ -132,4 +132,4 @@ public function testArrayPaginatorPerPage() { $this->assertEquals(2, $this->paginator->perPage()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Paginator/Adapters/ModelPaginatorTest.php b/tests/Unit/Paginator/Adapters/ModelPaginatorTest.php index 1eae8f49f..97b69e175 100644 --- a/tests/Unit/Paginator/Adapters/ModelPaginatorTest.php +++ b/tests/Unit/Paginator/Adapters/ModelPaginatorTest.php @@ -160,4 +160,4 @@ public function testModelPaginatorPerPage() { $this->assertEquals(2, $this->paginator->perPage()); } -} \ No newline at end of file +} diff --git a/tests/Unit/Paginator/Factories/PaginatorFactoryTest.php b/tests/Unit/Paginator/Factories/PaginatorFactoryTest.php index dd09173c5..8e00be1a4 100644 --- a/tests/Unit/Paginator/Factories/PaginatorFactoryTest.php +++ b/tests/Unit/Paginator/Factories/PaginatorFactoryTest.php @@ -14,7 +14,6 @@ class PaginatorFactoryTest extends PaginatorTestCase { - private $postModel; public function setUp(): void @@ -73,4 +72,4 @@ public function testPaginatorFactoryInvalidAdapter() 'page' => 2, ]); } -} \ No newline at end of file +} diff --git a/tests/Unit/Paginator/PaginatorTest.php b/tests/Unit/Paginator/PaginatorTest.php index dcf79070e..d24fe666d 100644 --- a/tests/Unit/Paginator/PaginatorTest.php +++ b/tests/Unit/Paginator/PaginatorTest.php @@ -12,7 +12,6 @@ class PaginatorTest extends PaginatorTestCase { - private $model; public function setUp(): void @@ -54,4 +53,4 @@ public function testPaginatorCallingInvalidMethod() $paginator->callingInvalidMethod(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Paginator/PaginatorTestCase.php b/tests/Unit/Paginator/PaginatorTestCase.php index d149e7547..cc0e48724 100644 --- a/tests/Unit/Paginator/PaginatorTestCase.php +++ b/tests/Unit/Paginator/PaginatorTestCase.php @@ -7,7 +7,6 @@ class PaginatorTestCase extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -19,19 +18,19 @@ public function setUp(): void public function tearDown(): void { - IdiormDbal::execute("DROP TABLE IF EXISTS posts"); + IdiormDbal::execute('DROP TABLE IF EXISTS posts'); } private function _createPostTableWithData() { - IdiormDbal::execute("CREATE TABLE IF NOT EXISTS posts ( + IdiormDbal::execute('CREATE TABLE IF NOT EXISTS posts ( id INTEGER PRIMARY KEY, title VARCHAR(255), content VARCHAR(255), author VARCHAR(255), published_at DATETIME, created_at DATETIME - )"); + )'); IdiormDbal::execute("INSERT INTO posts @@ -44,4 +43,4 @@ private function _createPostTableWithData() ('FYI', 'Just info', 'Nola Ho', '2020-06-15 16:10:00', '2020-06-14 10:15:12') "); } -} \ No newline at end of file +} diff --git a/tests/Unit/Renderer/Adapters/HtmlAdapterTest.php b/tests/Unit/Renderer/Adapters/HtmlAdapterTest.php index ae16a475a..bcd68af23 100644 --- a/tests/Unit/Renderer/Adapters/HtmlAdapterTest.php +++ b/tests/Unit/Renderer/Adapters/HtmlAdapterTest.php @@ -13,11 +13,11 @@ public function setUp(): void parent::setUp(); Router::setCurrentRoute([ - "route" => "test", - "method" => "GET", - "controller" => "SomeController", - "action" => "test", - "module" => "Test" + 'route' => 'test', + 'method' => 'GET', + 'controller' => 'SomeController', + 'action' => 'test', + 'module' => 'Test', ]); } @@ -32,4 +32,4 @@ public function testHtmlAdapterRenderView(): void $this->assertSame('

Hello Tester, this is rendered html view

', $output); } -} \ No newline at end of file +} diff --git a/tests/Unit/Renderer/Adapters/TwigAdapterTest.php b/tests/Unit/Renderer/Adapters/TwigAdapterTest.php index 6c373b206..22a147731 100644 --- a/tests/Unit/Renderer/Adapters/TwigAdapterTest.php +++ b/tests/Unit/Renderer/Adapters/TwigAdapterTest.php @@ -13,11 +13,11 @@ public function setUp(): void parent::setUp(); Router::setCurrentRoute([ - "route" => "test", - "method" => "GET", - "controller" => "SomeController", - "action" => "test", - "module" => "Test" + 'route' => 'test', + 'method' => 'GET', + 'controller' => 'SomeController', + 'action' => 'test', + 'module' => 'Test', ]); } @@ -32,4 +32,4 @@ public function testHtmlAdapterRenderView(): void $this->assertSame('

Hello Tester, this is rendered twig view

', $output); } -} \ No newline at end of file +} diff --git a/tests/Unit/Renderer/Factories/RendererFactoryTest.php b/tests/Unit/Renderer/Factories/RendererFactoryTest.php index 0934bde9a..4dc95c9f8 100644 --- a/tests/Unit/Renderer/Factories/RendererFactoryTest.php +++ b/tests/Unit/Renderer/Factories/RendererFactoryTest.php @@ -12,7 +12,6 @@ class RendererFactoryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -70,4 +69,4 @@ public function testRendererFactoryReturnsSameInstance() $this->assertSame($renderer1, $renderer2); } -} \ No newline at end of file +} diff --git a/tests/Unit/Renderer/RendererTest.php b/tests/Unit/Renderer/RendererTest.php index 2604a9266..87bc4c4b4 100644 --- a/tests/Unit/Renderer/RendererTest.php +++ b/tests/Unit/Renderer/RendererTest.php @@ -12,17 +12,16 @@ class RendererTest extends AppTestCase { - public function setUp(): void { parent::setUp(); Router::setCurrentRoute([ - "route" => "test", - "method" => "GET", - "controller" => "SomeController", - "action" => "test", - "module" => "Test" + 'route' => 'test', + 'method' => 'GET', + 'controller' => 'SomeController', + 'action' => 'test', + 'module' => 'Test', ]); } @@ -66,4 +65,4 @@ public function testRendererCallingInvalidMethod() $renderer->callingInvalidMethod(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Router/Helpers/RouterHelperTest.php b/tests/Unit/Router/Helpers/RouterHelperTest.php index 385bf89d9..d3b9da80d 100644 --- a/tests/Unit/Router/Helpers/RouterHelperTest.php +++ b/tests/Unit/Router/Helpers/RouterHelperTest.php @@ -9,7 +9,6 @@ class RouterHelperTest extends AppTestCase { - private $router; private $request; @@ -26,24 +25,24 @@ public function testMvcHelpers() { Router::setRoutes([ [ - "route" => "signin", - "method" => "POST", - "controller" => "SomeController", - "action" => "signin", - "module" => "Test", - "middlewares" => ["guest", "anonymous"], - 'prefix' => 'api' + 'route' => 'signin', + 'method' => 'POST', + 'controller' => 'SomeController', + 'action' => 'signin', + 'module' => 'Test', + 'middlewares' => ['guest', 'anonymous'], + 'prefix' => 'api', ], [ - "route" => "user/[id=:num]", - "method" => "GET", - "controller" => "SomeController", - "action" => "signout", - "module" => "Test", - "middlewares" => ["user"], + 'route' => 'user/[id=:num]', + 'method' => 'GET', + 'controller' => 'SomeController', + 'action' => 'signout', + 'module' => 'Test', + 'middlewares' => ['user'], 'name' => 'user', - 'prefix' => 'api' - ] + 'prefix' => 'api', + ], ]); $this->request->create('POST', 'http://testdomain.com/signin'); @@ -93,11 +92,11 @@ public function testMvcRouteCallback() { Router::setRoutes([ [ - "route" => "home", - "method" => "GET", - "callback" => function (Response $response) {}, - "module" => "Test", - ] + 'route' => 'home', + 'method' => 'GET', + 'callback' => function (Response $response) {}, + 'module' => 'Test', + ], ]); $this->request->create('GET', '/home'); @@ -113,14 +112,14 @@ public function testMvcFindRouteByName() Router::setRoutes([ [ - "route" => "api-user/[id=:num]", - "method" => "GET", - "controller" => "SomeController", - "action" => "signout", - "module" => "Test", - "middlewares" => ["user"], - "name" => "user" - ] + 'route' => 'api-user/[id=:num]', + 'method' => 'GET', + 'controller' => 'SomeController', + 'action' => 'signout', + 'module' => 'Test', + 'middlewares' => ['user'], + 'name' => 'user', + ], ]); $this->assertNotNull(find_route_by_name('user', 'Test')); @@ -134,18 +133,18 @@ public function testMvcCheckRouteGroupExists() Router::setRoutes([ [ - "route" => "api-user/[id=:num]", - "method" => "GET", - "controller" => "SomeController", - "action" => "signout", - "module" => "Test", - "middlewares" => ["user"], + 'route' => 'api-user/[id=:num]', + 'method' => 'GET', + 'controller' => 'SomeController', + 'action' => 'signout', + 'module' => 'Test', + 'middlewares' => ['user'], 'group' => 'guest', - "name" => "user" - ] + 'name' => 'user', + ], ]); $this->assertTrue(route_group_exists('guest', 'Test')); } -} \ No newline at end of file +} diff --git a/tests/Unit/Router/RouteControllerTest.php b/tests/Unit/Router/RouteControllerTest.php index 1c30805d0..dae4d5d9d 100644 --- a/tests/Unit/Router/RouteControllerTest.php +++ b/tests/Unit/Router/RouteControllerTest.php @@ -22,7 +22,6 @@ class SomeController extends RouteController */ class RouteControllerTest extends AppTestCase { - public function setUp(): void { parent::setUp(); diff --git a/tests/Unit/Router/RouteTest.php b/tests/Unit/Router/RouteTest.php index 6f7e866e5..6ea5babf7 100644 --- a/tests/Unit/Router/RouteTest.php +++ b/tests/Unit/Router/RouteTest.php @@ -8,7 +8,6 @@ class RouteTest extends AppTestCase { - private $route; public function setUp(): void @@ -18,8 +17,8 @@ public function setUp(): void $module = [ 'Test' => [ 'prefix' => '', - 'endabled' => true - ] + 'endabled' => true, + ], ]; $this->route = new Route($module); @@ -167,13 +166,13 @@ public function testGroupRoute() $this->assertCount(2, $this->route->getVirtualRoutes()['auth']); } - public function testCacheable() - { - $this->route->post('posts', 'PostsController', 'posts')->cacheable(true, 100); + public function testCacheable() + { + $this->route->post('posts', 'PostsController', 'posts')->cacheable(true, 100); - $this->assertTrue($this->route->getRuntimeRoutes()[0]['cache_settings']['shouldCache']); - $this->assertEquals(100, $this->route->getRuntimeRoutes()[0]['cache_settings']['ttl']); - } + $this->assertTrue($this->route->getRuntimeRoutes()[0]['cache_settings']['shouldCache']); + $this->assertEquals(100, $this->route->getRuntimeRoutes()[0]['cache_settings']['ttl']); + } public function testMiddlewares() { diff --git a/tests/Unit/Router/RouterTest.php b/tests/Unit/Router/RouterTest.php index f69a65c23..99c6313ad 100644 --- a/tests/Unit/Router/RouterTest.php +++ b/tests/Unit/Router/RouterTest.php @@ -11,7 +11,6 @@ class RouterTest extends AppTestCase { - private $request; private $router; @@ -38,19 +37,19 @@ public function testSetGetRoutes() { Router::setRoutes([ [ - "route" => "[:alpha:2]?", - "method" => "GET", - "controller" => "MainController", - "action" => "index", - "module" => "Web" + 'route' => '[:alpha:2]?', + 'method' => 'GET', + 'controller' => 'MainController', + 'action' => 'index', + 'module' => 'Web', ], [ - "route" => "[:alpha:2]?/about", - "method" => "GET", - "controller" => "MainController", - "action" => "about", - "module" => "Web" - ] + 'route' => '[:alpha:2]?/about', + 'method' => 'GET', + 'controller' => 'MainController', + 'action' => 'about', + 'module' => 'Web', + ], ]); $this->assertNotEmpty(Router::getRoutes()); @@ -64,22 +63,22 @@ public function testFindRoute() Router::setRoutes([ [ - "route" => "auth/api-signin", - "method" => "POST", - "controller" => "AuthController", - "action" => "signin", - "module" => "Api", + 'route' => 'auth/api-signin', + 'method' => 'POST', + 'controller' => 'AuthController', + 'action' => 'signin', + 'module' => 'Api', ], [ - "route" => "auth/api-signout-test", - "method" => "GET", - "controller" => "AuthController", - "action" => "signout", - "module" => "Api", - "middlewares" => [ - 0 => "guest" - ] - ] + 'route' => 'auth/api-signout-test', + 'method' => 'GET', + 'controller' => 'AuthController', + 'action' => 'signout', + 'module' => 'Api', + 'middlewares' => [ + 0 => 'guest', + ], + ], ]); $this->request->create('POST', 'http://testdomain.com/auth/api-signin'); @@ -99,12 +98,12 @@ public function testFindRouteWithParams() { Router::setRoutes([ [ - "route" => "[:alpha:2]/my-posts/amend/[:any]", - "method" => "POST", - "controller" => "PostController", - "action" => "amendPost", - "module" => "Web", - ] + 'route' => '[:alpha:2]/my-posts/amend/[:any]', + 'method' => 'POST', + 'controller' => 'PostController', + 'action' => 'amendPost', + 'module' => 'Web', + ], ]); $this->request->create('POST', 'http://testdomain.com/en/my-posts/amend/5e538098-1095-3976-b05f-29a0bb2a799f'); @@ -124,12 +123,12 @@ public function testFindRouteWithOptionalParams() { Router::setRoutes([ [ - "route" => "[:any]?/my-posts/amend/[:any]/[:num]?", - "method" => "POST", - "controller" => "PostController", - "action" => "amendPost", - "module" => "Web", - ] + 'route' => '[:any]?/my-posts/amend/[:any]/[:num]?', + 'method' => 'POST', + 'controller' => 'PostController', + 'action' => 'amendPost', + 'module' => 'Web', + ], ]); $this->request->create('POST', 'http://testdomain.com/my-posts/amend/5e538098-1095-3976-b05f-29a0bb2a799f'); @@ -149,12 +148,12 @@ public function testFindRouteWithNamedParams() { Router::setRoutes([ [ - "route" => "[lang=:alpha:2]?/my-posts/amend/[postId=:any]/[ref=:num]?", - "method" => "POST", - "controller" => "PostController", - "action" => "amendPost", - "module" => "Web", - ] + 'route' => '[lang=:alpha:2]?/my-posts/amend/[postId=:any]/[ref=:num]?', + 'method' => 'POST', + 'controller' => 'PostController', + 'action' => 'amendPost', + 'module' => 'Web', + ], ]); $this->request->create('POST', 'http://testdomain.com/my-posts/amend/5e538098-1095-3976-b05f-29a0bb2a799f/523'); @@ -172,19 +171,19 @@ public function testRestfulRoutes() { Router::setRoutes([ [ - "route" => "api-task", - "method" => "POST", - "controller" => "TaskController", - "action" => "create", - "module" => "Api", + 'route' => 'api-task', + 'method' => 'POST', + 'controller' => 'TaskController', + 'action' => 'create', + 'module' => 'Api', ], [ - "route" => "api-task", - "method" => "GET", - "controller" => "TaskController", - "action" => "show", - "module" => "Api", - ] + 'route' => 'api-task', + 'method' => 'GET', + 'controller' => 'TaskController', + 'action' => 'show', + 'module' => 'Api', + ], ]); $this->request->create('GET', 'http://testdomain.com/api-task'); @@ -212,12 +211,12 @@ public function testRouteIncorrectMethod() { Router::setRoutes([ [ - "route" => "api-signin", - "method" => "POST", - "controller" => "AuthController", - "action" => "signin", - "module" => "Api", - ] + 'route' => 'api-signin', + 'method' => 'POST', + 'controller' => 'AuthController', + 'action' => 'signin', + 'module' => 'Api', + ], ]); $this->request->create('GET', 'http://testdomain.com/api-signin'); @@ -233,19 +232,19 @@ public function testRepetitiveRoutesWithSameMethod() { Router::setRoutes([ [ - "route" => "api-signin", - "method" => "POST", - "controller" => "AuthController", - "action" => "signin", - "module" => "Api", + 'route' => 'api-signin', + 'method' => 'POST', + 'controller' => 'AuthController', + 'action' => 'signin', + 'module' => 'Api', ], [ - "route" => "api-signin", - "method" => "POST", - "controller" => "AuthController", - "action" => "signin", - "module" => "Api", - ] + 'route' => 'api-signin', + 'method' => 'POST', + 'controller' => 'AuthController', + 'action' => 'signin', + 'module' => 'Api', + ], ]); $this->request->create('POST', 'http://testdomain.com/api-signin'); @@ -261,19 +260,19 @@ public function testRepetitiveRoutesInDifferentModules() { Router::setRoutes([ [ - "route" => "api-signin", - "method" => "POST", - "controller" => "AuthController", - "action" => "signin", - "module" => "Api", + 'route' => 'api-signin', + 'method' => 'POST', + 'controller' => 'AuthController', + 'action' => 'signin', + 'module' => 'Api', ], [ - "route" => "api-signin", - "method" => "PUT", - "controller" => "AuthController", - "action" => "signin", - "module" => "Web", - ] + 'route' => 'api-signin', + 'method' => 'PUT', + 'controller' => 'AuthController', + 'action' => 'signin', + 'module' => 'Web', + ], ]); $this->request->create('POST', 'http://testdomain.com/api-signin'); @@ -295,4 +294,4 @@ public function testRouteNotFound() $this->router->findRoute(); } -} \ No newline at end of file +} diff --git a/tests/Unit/Service/Factories/ServiceFactoryTest.php b/tests/Unit/Service/Factories/ServiceFactoryTest.php index cad3b7c8a..ec359a11e 100644 --- a/tests/Unit/Service/Factories/ServiceFactoryTest.php +++ b/tests/Unit/Service/Factories/ServiceFactoryTest.php @@ -7,7 +7,6 @@ class TestService extends QtService { - public static $count = 0; public $model; @@ -32,7 +31,6 @@ public function hello() class TestModel extends QtModel { - } } @@ -47,7 +45,6 @@ class TestModel extends QtModel class ServiceFactoryTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -125,4 +122,4 @@ public function testServiceFactoryServiceNotFound() ServiceFactory::get(\NonExistentClass::class); } } -} \ No newline at end of file +} diff --git a/tests/Unit/Service/Helpers/ServiceHelperFunctionTest.php b/tests/Unit/Service/Helpers/ServiceHelperFunctionTest.php index 5ea3b22d0..e940480ff 100644 --- a/tests/Unit/Service/Helpers/ServiceHelperFunctionTest.php +++ b/tests/Unit/Service/Helpers/ServiceHelperFunctionTest.php @@ -24,4 +24,4 @@ public function testModelThrowsOnInvalidClass() service('NonExistentServiceClass'); } -} \ No newline at end of file +} diff --git a/tests/Unit/Service/QtServiceTest.php b/tests/Unit/Service/QtServiceTest.php index 3f500c069..af9d729b6 100644 --- a/tests/Unit/Service/QtServiceTest.php +++ b/tests/Unit/Service/QtServiceTest.php @@ -2,12 +2,10 @@ namespace Quantum\Services { - use Quantum\Service\QtService; class TestingService extends QtService { - } } @@ -25,7 +23,6 @@ class TestingService extends QtService */ class QtServiceTest extends AppTestCase { - public function setUp(): void { parent::setUp(); @@ -37,11 +34,11 @@ public function testMissingMethods() $this->expectExceptionMessage('The method `undefinedMethod` is not supported for `' . QtService::class . '`'); - $service = (new ServiceFactory)->get(TestingService::class); + $service = (new ServiceFactory())->get(TestingService::class); $service->undefinedMethod(); } } -} \ No newline at end of file +} diff --git a/tests/Unit/View/Factories/ViewFactoryTest.php b/tests/Unit/View/Factories/ViewFactoryTest.php index 6f5136e48..92b033230 100644 --- a/tests/Unit/View/Factories/ViewFactoryTest.php +++ b/tests/Unit/View/Factories/ViewFactoryTest.php @@ -8,13 +8,12 @@ class ViewFactoryTest extends AppTestCase { - private $viewFactory; public function setUp(): void { parent::setUp(); - + $this->viewFactory = new ViewFactory(); } diff --git a/tests/Unit/View/Helpers/ViewHelperTest.php b/tests/Unit/View/Helpers/ViewHelperTest.php index 3f622cc92..56e2d9fb0 100644 --- a/tests/Unit/View/Helpers/ViewHelperTest.php +++ b/tests/Unit/View/Helpers/ViewHelperTest.php @@ -8,7 +8,6 @@ class ViewHelperTest extends AppTestCase { - private $view; public function setUp(): void @@ -25,11 +24,11 @@ public function tearDown(): void public function testView() { RouteController::setCurrentRoute([ - "route" => "test", - "method" => "POST", - "controller" => "TestController", - "action" => "testAction", - "module" => "Test", + 'route' => 'test', + 'method' => 'POST', + 'controller' => 'TestController', + 'action' => 'testAction', + 'module' => 'Test', ]); $this->view->setLayout('layout'); @@ -46,12 +45,11 @@ public function testPartial() $this->assertEquals('

Hello John, this is rendered partial html view

', partial('partial', ['name' => 'John'])); } - public function testMarkdownToHtml(): void { - $markdown = "**bold** text"; + $markdown = '**bold** text'; $html = trim(markdown_to_html($markdown, true)); $this->assertEquals('

bold text

', $html); } -} \ No newline at end of file +} diff --git a/tests/Unit/View/QtViewTest.php b/tests/Unit/View/QtViewTest.php index a2ec637b7..ca64ddb7a 100644 --- a/tests/Unit/View/QtViewTest.php +++ b/tests/Unit/View/QtViewTest.php @@ -8,10 +8,8 @@ use Quantum\Router\Router; use Quantum\View\RawParam; - class QtViewTest extends AppTestCase { - private $view; public function setUp(): void @@ -19,11 +17,11 @@ public function setUp(): void parent::setUp(); Router::setCurrentRoute([ - "route" => "test", - "method" => "GET", - "controller" => "SomeController", - "action" => "test", - "module" => "Test" + 'route' => 'test', + 'method' => 'GET', + 'controller' => 'SomeController', + 'action' => 'test', + 'module' => 'Test', ]); $this->view = ViewFactory::get(); @@ -179,4 +177,4 @@ public function testRenderViewWithTwig(): void $this->assertEquals('' . PHP_EOL . '' . PHP_EOL . '' . PHP_EOL . '

Hello Tester, this is rendered twig view

' . PHP_EOL . '' . PHP_EOL . '' . PHP_EOL, $renderedView); } -} \ No newline at end of file +} diff --git a/tests/_root/modules/Test/Controllers/TestController.php b/tests/_root/modules/Test/Controllers/TestController.php index 1a9ab1663..da259bef6 100644 --- a/tests/_root/modules/Test/Controllers/TestController.php +++ b/tests/_root/modules/Test/Controllers/TestController.php @@ -6,9 +6,8 @@ class TestController extends RouteController { - public function tests() { // } -} \ No newline at end of file +} diff --git a/tests/_root/modules/Test/Services/AuthService.php b/tests/_root/modules/Test/Services/AuthService.php index 0609361d9..363e939ad 100644 --- a/tests/_root/modules/Test/Services/AuthService.php +++ b/tests/_root/modules/Test/Services/AuthService.php @@ -8,7 +8,6 @@ class AuthService extends QtService implements AuthServiceInterface { - public function get(string $field, ?string $value): ?User { return new User(); diff --git a/tests/_root/modules/Test/Transformers/PostTransformer.php b/tests/_root/modules/Test/Transformers/PostTransformer.php index 11678e2b4..ebfcd0c6e 100644 --- a/tests/_root/modules/Test/Transformers/PostTransformer.php +++ b/tests/_root/modules/Test/Transformers/PostTransformer.php @@ -22,7 +22,6 @@ */ class PostTransformer implements TransformerInterface { - /** * Transforms the post data * @param $item @@ -36,7 +35,7 @@ public function transform($item): array 'content' => markdown_to_html($item->content, true), 'image' => $item->image ? $item->user_directory . '/' . $item->image : null, 'date' => date('Y/m/d H:i', strtotime($item->updated_at)), - 'author' => $item->firstname . ' ' . $item->lastname + 'author' => $item->firstname . ' ' . $item->lastname, ]; } -} \ No newline at end of file +} diff --git a/tests/_root/modules/Test/Views/index.php b/tests/_root/modules/Test/Views/index.php index 440795ba4..a5d5f5668 100644 --- a/tests/_root/modules/Test/Views/index.php +++ b/tests/_root/modules/Test/Views/index.php @@ -1 +1 @@ -

Hello , this is rendered html view

\ No newline at end of file +

Hello , this is rendered html view

\ No newline at end of file diff --git a/tests/_root/modules/Test/Views/partial.php b/tests/_root/modules/Test/Views/partial.php index 51a7b4ddb..ef247f55e 100644 --- a/tests/_root/modules/Test/Views/partial.php +++ b/tests/_root/modules/Test/Views/partial.php @@ -1 +1 @@ -

Hello , this is rendered partial html view

\ No newline at end of file +

Hello , this is rendered partial html view

\ No newline at end of file diff --git a/tests/_root/modules/Test/Views/post.php b/tests/_root/modules/Test/Views/post.php index ade36f083..5a253180c 100644 --- a/tests/_root/modules/Test/Views/post.php +++ b/tests/_root/modules/Test/Views/post.php @@ -1 +1,3 @@ - \ No newline at end of file + PostTransformer::class, TokenServiceInterface::class => TokenService::class, -]; \ No newline at end of file +]; diff --git a/tests/_root/modules/Test/resources/lang/en/custom.php b/tests/_root/modules/Test/resources/lang/en/custom.php index 4ce07e676..9e8a4641a 100644 --- a/tests/_root/modules/Test/resources/lang/en/custom.php +++ b/tests/_root/modules/Test/resources/lang/en/custom.php @@ -3,5 +3,5 @@ return [ 'learn_more' => 'Learn more', 'info' => 'Information about the {%1} feature', - 'test' => 'Testing' -]; \ No newline at end of file + 'test' => 'Testing', +]; diff --git a/tests/_root/modules/Test/resources/lang/es/custom.php b/tests/_root/modules/Test/resources/lang/es/custom.php index 80ef6b057..6d09f3071 100644 --- a/tests/_root/modules/Test/resources/lang/es/custom.php +++ b/tests/_root/modules/Test/resources/lang/es/custom.php @@ -3,5 +3,5 @@ return [ 'learn_more' => 'Aprender más', 'info' => 'Información sobre la función {%1}', - 'test' => 'Prueba' -]; \ No newline at end of file + 'test' => 'Prueba', +]; diff --git a/tests/_root/modules/Test/routes/routes.php b/tests/_root/modules/Test/routes/routes.php index 36ee8a1c9..a5cd9152d 100644 --- a/tests/_root/modules/Test/routes/routes.php +++ b/tests/_root/modules/Test/routes/routes.php @@ -1,6 +1,6 @@ get("[:alpha:2]?/tests", "TestController", "tests"); - $route->get("[:alpha:2]?/Test/[id=:any]", "TestController", "test"); -}; \ No newline at end of file + $route->get('[:alpha:2]?/tests', 'TestController', 'tests'); + $route->get('[:alpha:2]?/Test/[id=:any]', 'TestController', 'test'); +}; diff --git a/tests/_root/shared/Commands/TestCommand.php b/tests/_root/shared/Commands/TestCommand.php index aa5920f36..267a00ad9 100644 --- a/tests/_root/shared/Commands/TestCommand.php +++ b/tests/_root/shared/Commands/TestCommand.php @@ -22,4 +22,4 @@ public function exec() { // intentionally empty } -} \ No newline at end of file +} diff --git a/tests/_root/shared/Models/TestEventModel.php b/tests/_root/shared/Models/TestEventModel.php index 9f590508d..677064c69 100644 --- a/tests/_root/shared/Models/TestEventModel.php +++ b/tests/_root/shared/Models/TestEventModel.php @@ -14,7 +14,7 @@ class TestEventModel extends QtModel public $fillable = [ 'title', 'country', - 'started_at' + 'started_at', ]; public function relations(): array @@ -23,8 +23,8 @@ public function relations(): array TestUserEventModel::class => [ 'type' => Relation::HAS_MANY, 'foreign_key' => 'event_id', - 'local_key' => 'id' - ] + 'local_key' => 'id', + ], ]; } } diff --git a/tests/_root/shared/Models/TestNotesModel.php b/tests/_root/shared/Models/TestNotesModel.php index 52b3a315e..8d08a0e68 100644 --- a/tests/_root/shared/Models/TestNotesModel.php +++ b/tests/_root/shared/Models/TestNotesModel.php @@ -14,4 +14,4 @@ class TestNotesModel extends QtModel 'ticket_id', 'note', ]; -} \ No newline at end of file +} diff --git a/tests/_root/shared/Models/TestPostModel.php b/tests/_root/shared/Models/TestPostModel.php index bf0820fbe..66c078317 100644 --- a/tests/_root/shared/Models/TestPostModel.php +++ b/tests/_root/shared/Models/TestPostModel.php @@ -6,7 +6,6 @@ class TestPostModel extends QtModel { - public $idColumn = 'id'; public $table = 'posts'; @@ -16,6 +15,6 @@ class TestPostModel extends QtModel 'content', 'author', 'published_at', - 'created_at' + 'created_at', ]; } diff --git a/tests/_root/shared/Models/TestProductsModel.php b/tests/_root/shared/Models/TestProductsModel.php index d891ae2f0..a3adee89d 100644 --- a/tests/_root/shared/Models/TestProductsModel.php +++ b/tests/_root/shared/Models/TestProductsModel.php @@ -7,7 +7,6 @@ class TestProductsModel extends QtModel { - use SoftDeletes; public $idColumn = 'id'; diff --git a/tests/_root/shared/Models/TestProfileModel.php b/tests/_root/shared/Models/TestProfileModel.php index 906aa7f4b..934d60b1b 100644 --- a/tests/_root/shared/Models/TestProfileModel.php +++ b/tests/_root/shared/Models/TestProfileModel.php @@ -26,7 +26,7 @@ public function relations(): array TestUserModel::class => [ 'type' => Relation::BELONGS_TO, 'foreign_key' => 'user_id', - 'local_key' => 'id' + 'local_key' => 'id', ], ]; } diff --git a/tests/_root/shared/Models/TestTicketModel.php b/tests/_root/shared/Models/TestTicketModel.php index 494ae5707..7e07e7d2f 100644 --- a/tests/_root/shared/Models/TestTicketModel.php +++ b/tests/_root/shared/Models/TestTicketModel.php @@ -23,8 +23,8 @@ public function relations(): array TestNotesModel::class => [ 'type' => Relation::HAS_MANY, 'foreign_key' => 'ticket_id', - 'local_key' => 'id' - ] + 'local_key' => 'id', + ], ]; } -} \ No newline at end of file +} diff --git a/tests/_root/shared/Models/TestUserEventModel.php b/tests/_root/shared/Models/TestUserEventModel.php index ec338bbb1..59d2cedb4 100644 --- a/tests/_root/shared/Models/TestUserEventModel.php +++ b/tests/_root/shared/Models/TestUserEventModel.php @@ -24,8 +24,8 @@ public function relations(): array TestEventModel::class => [ 'type' => Relation::BELONGS_TO, 'foreign_key' => 'event_id', - 'local_key' => 'id' - ] + 'local_key' => 'id', + ], ]; } } diff --git a/tests/_root/shared/Models/TestUserMeetingModel.php b/tests/_root/shared/Models/TestUserMeetingModel.php index 5b9335dca..4c91f9b60 100644 --- a/tests/_root/shared/Models/TestUserMeetingModel.php +++ b/tests/_root/shared/Models/TestUserMeetingModel.php @@ -14,7 +14,7 @@ class TestUserMeetingModel extends QtModel public $fillable = [ 'user_id', 'title', - 'start_date' + 'start_date', ]; public function relations(): array @@ -23,8 +23,8 @@ public function relations(): array TestTicketModel::class => [ 'type' => Relation::HAS_MANY, 'foreign_key' => 'meeting_id', - 'local_key' => 'id' - ] + 'local_key' => 'id', + ], ]; } diff --git a/tests/_root/shared/Models/TestUserModel.php b/tests/_root/shared/Models/TestUserModel.php index fb4f569df..4987c0a15 100644 --- a/tests/_root/shared/Models/TestUserModel.php +++ b/tests/_root/shared/Models/TestUserModel.php @@ -7,7 +7,6 @@ class TestUserModel extends QtModel { - public $idColumn = 'id'; public $table = 'users'; @@ -18,7 +17,7 @@ class TestUserModel extends QtModel ]; public $hidden = [ - 'password' + 'password', ]; public function relations(): array @@ -27,25 +26,25 @@ public function relations(): array TestProfileModel::class => [ 'type' => Relation::HAS_ONE, 'foreign_key' => 'user_id', - 'local_key' => 'id' + 'local_key' => 'id', ], TestUserProfessionModel::class => [ 'type' => Relation::HAS_MANY, 'foreign_key' => 'user_id', - 'local_key' => 'id' + 'local_key' => 'id', ], TestUserMeetingModel::class => [ 'type' => Relation::HAS_MANY, 'foreign_key' => 'user_id', - 'local_key' => 'id' + 'local_key' => 'id', ], TestUserEventModel::class => [ 'type' => Relation::HAS_MANY, 'foreign_key' => 'user_id', - 'local_key' => 'id' + 'local_key' => 'id', ], ]; } diff --git a/tests/_root/shared/Models/TestUserProfessionModel.php b/tests/_root/shared/Models/TestUserProfessionModel.php index e46022aed..d780a0bbf 100644 --- a/tests/_root/shared/Models/TestUserProfessionModel.php +++ b/tests/_root/shared/Models/TestUserProfessionModel.php @@ -6,13 +6,12 @@ class TestUserProfessionModel extends QtModel { - public $table = 'user_professions'; public $primaryKey = 'id'; public $fillable = [ 'user_id', - 'title' + 'title', ]; } diff --git a/tests/_root/shared/Services/TokenService.php b/tests/_root/shared/Services/TokenService.php index e161e4bb2..894add54b 100644 --- a/tests/_root/shared/Services/TokenService.php +++ b/tests/_root/shared/Services/TokenService.php @@ -7,7 +7,6 @@ class TokenService extends QtService implements TokenServiceInterface { - public function getAccessToken(): string { return 'xxxyyyzz'; @@ -22,4 +21,4 @@ public function saveTokens(string $accessToken, ?string $refreshToken = null): b { return true; } -} \ No newline at end of file +} diff --git a/tests/_root/shared/config/app.php b/tests/_root/shared/config/app.php index b9359e04f..49e9f1568 100644 --- a/tests/_root/shared/config/app.php +++ b/tests/_root/shared/config/app.php @@ -7,4 +7,4 @@ 'base_url' => 'http://localhost', 'debug' => true, 'test' => 'Testing', -]; \ No newline at end of file +]; diff --git a/tests/_root/shared/config/auth.php b/tests/_root/shared/config/auth.php index a7b879e78..53a5c8db7 100644 --- a/tests/_root/shared/config/auth.php +++ b/tests/_root/shared/config/auth.php @@ -4,7 +4,7 @@ 'default' => 'session', 'session' => [ - 'service' => Quantum\Tests\_root\modules\Test\Services\AuthService::class + 'service' => Quantum\Tests\_root\modules\Test\Services\AuthService::class, ], 'jwt' => [ @@ -15,8 +15,8 @@ 'aud' => 'audience', 'iat' => time(), 'nbf' => time() + 1, - 'exp' => time() + 3600 // 1 hour - ] + 'exp' => time() + 3600, // 1 hour + ], ], 'two_fa' => env('TWO_FA', true), diff --git a/tests/_root/shared/config/cache.php b/tests/_root/shared/config/cache.php index 326bcbeb3..4a730fff9 100644 --- a/tests/_root/shared/config/cache.php +++ b/tests/_root/shared/config/cache.php @@ -1,29 +1,30 @@ 'file', 'file' => [ 'prefix' => str_replace(' ', '', env('APP_NAME') ?? ''), 'path' => base_dir() . DS . 'cache' . DS . 'data', - 'ttl' => 600 + 'ttl' => 600, ], 'database' => [ 'prefix' => str_replace(' ', '', env('APP_NAME') ?? ''), 'table' => 'cache', - 'ttl' => 60 + 'ttl' => 60, ], 'memcached' => [ 'prefix' => str_replace(' ', '', env('APP_NAME') ?? ''), 'host' => '127.0.0.1', 'port' => 11211, - 'ttl' => 60 + 'ttl' => 60, ], 'redis' => [ 'prefix' => str_replace(' ', '', env('APP_NAME') ?? ''), 'host' => '127.0.0.1', 'port' => 6379, - 'ttl' => 60 - ] -]; \ No newline at end of file + 'ttl' => 60, + ], +]; diff --git a/tests/_root/shared/config/captcha.php b/tests/_root/shared/config/captcha.php index 7e1edb9aa..56c70bdc0 100644 --- a/tests/_root/shared/config/captcha.php +++ b/tests/_root/shared/config/captcha.php @@ -6,12 +6,12 @@ 'recaptcha' => [ 'type' => 'visible', 'secret_key' => '10000000-ffff-ffff-ffff-000000000001', - 'site_key' => '0x0000000000000000000000000000000000000000' + 'site_key' => '0x0000000000000000000000000000000000000000', ], 'hcaptcha' => [ 'type' => 'visible', 'secret_key' => '0xE1a02fB374Bf228678E613645295A2d0fD0Dc5Fa', - 'site_key' => '07737dfc-abfa-44e3-a695-66ac44365d0c' - ] + 'site_key' => '07737dfc-abfa-44e3-a695-66ac44365d0c', + ], ]; diff --git a/tests/_root/shared/config/database.php b/tests/_root/shared/config/database.php index 6923d0a9a..661ee46c2 100644 --- a/tests/_root/shared/config/database.php +++ b/tests/_root/shared/config/database.php @@ -23,9 +23,9 @@ 'min_length' => 2, 'mode' => 'or', 'score_key' => 'scoreKey', - 'algorithm' => 1 + 'algorithm' => 1, ], ], 'database_dir' => base_dir() . DS . 'shared' . DS . 'store', - ] -]; \ No newline at end of file + ], +]; diff --git a/tests/_root/shared/config/env.php b/tests/_root/shared/config/env.php index 49e049c4d..3d99831c9 100644 --- a/tests/_root/shared/config/env.php +++ b/tests/_root/shared/config/env.php @@ -1,5 +1,5 @@ 'testing' -]; \ No newline at end of file + 'app_env' => 'testing', +]; diff --git a/tests/_root/shared/config/fs.php b/tests/_root/shared/config/fs.php index 023598d41..6d369b3d9 100644 --- a/tests/_root/shared/config/fs.php +++ b/tests/_root/shared/config/fs.php @@ -8,7 +8,7 @@ 'params' => [ 'app_key' => '', 'app_secret' => '', - ] + ], ], 'gdrive' => [ @@ -16,6 +16,6 @@ 'params' => [ 'app_key' => '', 'app_secret' => '', - ] - ] + ], + ], ]; diff --git a/tests/_root/shared/config/lang.php b/tests/_root/shared/config/lang.php index 56835fb06..407b240d0 100644 --- a/tests/_root/shared/config/lang.php +++ b/tests/_root/shared/config/lang.php @@ -10,4 +10,4 @@ 'supported' => ['en', 'es'], 'default' => 'en', 'url_segment' => 1, -]; \ No newline at end of file +]; diff --git a/tests/_root/shared/config/logging.php b/tests/_root/shared/config/logging.php index 9983c1769..0fff5b72b 100644 --- a/tests/_root/shared/config/logging.php +++ b/tests/_root/shared/config/logging.php @@ -1,4 +1,5 @@ 'single', @@ -10,5 +11,5 @@ 'daily' => [ 'path' => logs_dir(), 'level' => 'warning', - ] -]; \ No newline at end of file + ], +]; diff --git a/tests/_root/shared/config/mailer.php b/tests/_root/shared/config/mailer.php index 3e4593b3c..b1e028a0d 100644 --- a/tests/_root/shared/config/mailer.php +++ b/tests/_root/shared/config/mailer.php @@ -10,7 +10,7 @@ 'secure' => 'ssl', 'port' => '80', 'username' => 'test', - 'password' => 'test' + 'password' => 'test', ], 'sendinblue' => [ @@ -22,7 +22,7 @@ ], 'mandrill' => [ - 'api_key' => 'mandrill_api_key' + 'api_key' => 'mandrill_api_key', ], 'mailgun' => [ diff --git a/tests/_root/shared/config/session.php b/tests/_root/shared/config/session.php index 014ad9128..98fed352f 100644 --- a/tests/_root/shared/config/session.php +++ b/tests/_root/shared/config/session.php @@ -4,11 +4,11 @@ 'default' => 'native', 'native' => [ - 'timeout' => 300 + 'timeout' => 300, ], 'database' => [ 'table' => 'sessions', 'timeout' => 300, - ] -]; \ No newline at end of file + ], +]; diff --git a/tests/_root/shared/config/uploads.php b/tests/_root/shared/config/uploads.php index f8bca8a9b..89b3086c1 100644 --- a/tests/_root/shared/config/uploads.php +++ b/tests/_root/shared/config/uploads.php @@ -23,4 +23,4 @@ 'video/webm' => ['webm'], 'video/x-msvideo' => ['avi'], ], -]; \ No newline at end of file +]; diff --git a/tests/_root/shared/config/view.php b/tests/_root/shared/config/view.php index 80e78f47f..fc6c851d1 100644 --- a/tests/_root/shared/config/view.php +++ b/tests/_root/shared/config/view.php @@ -1,4 +1,5 @@ 'html', @@ -7,9 +8,9 @@ ], 'twig' => [ - 'autoescape' => FALSE, + 'autoescape' => false, 'charset' => 'UTF-8', 'debug' => false, 'cache' => false, - ] + ], ]; diff --git a/tests/_root/shared/config/view_cache.php b/tests/_root/shared/config/view_cache.php index 4f2fdbe88..a602fd18b 100644 --- a/tests/_root/shared/config/view_cache.php +++ b/tests/_root/shared/config/view_cache.php @@ -1,7 +1,7 @@ 300, - 'cache_dir' => 'cache', - 'minify' => false + 'ttl' => 300, + 'cache_dir' => 'cache', + 'minify' => false, ]; diff --git a/tests/_root/shared/resources/lang/en/custom.php b/tests/_root/shared/resources/lang/en/custom.php index 4ce07e676..9e8a4641a 100644 --- a/tests/_root/shared/resources/lang/en/custom.php +++ b/tests/_root/shared/resources/lang/en/custom.php @@ -3,5 +3,5 @@ return [ 'learn_more' => 'Learn more', 'info' => 'Information about the {%1} feature', - 'test' => 'Testing' -]; \ No newline at end of file + 'test' => 'Testing', +]; diff --git a/tests/_root/shared/resources/lang/es/custom.php b/tests/_root/shared/resources/lang/es/custom.php index 80ef6b057..6d09f3071 100644 --- a/tests/_root/shared/resources/lang/es/custom.php +++ b/tests/_root/shared/resources/lang/es/custom.php @@ -3,5 +3,5 @@ return [ 'learn_more' => 'Aprender más', 'info' => 'Información sobre la función {%1}', - 'test' => 'Prueba' -]; \ No newline at end of file + 'test' => 'Prueba', +]; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 5dd247e20..4fa5639eb 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -7,7 +7,7 @@ } if (!defined('PROJECT_ROOT')) { - define("PROJECT_ROOT", __DIR__ . DS . '_root'); + define('PROJECT_ROOT', __DIR__ . DS . '_root'); } require_once dirname(__DIR__) . DS . 'vendor' . DS . 'autoload.php'; @@ -18,4 +18,4 @@ register_shutdown_function(function () { removeEnvFile(); -}); \ No newline at end of file +});