Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/App/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@
*/
class App
{
/**
* Web app adapter
*/
public const WEB = 'web';

/**
* Console app adapter
*/
public const CONSOLE = 'console';

private static ?string $baseDir = null;

private AppInterface $adapter;
Expand Down
33 changes: 33 additions & 0 deletions src/App/Enums/AppType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

/**
* Quantum PHP Framework
*
* An open source software development framework for PHP
*
* @package Quantum
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 3.0.0
*/

namespace Quantum\App\Enums;

/**
* Class AppType
* @package Quantum\App
* @codeCoverageIgnore
*/
final class AppType
{
public const WEB = 'web';

public const CONSOLE = 'console';

private function __construct()
{
}
}
5 changes: 3 additions & 2 deletions src/App/Factories/AppFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Quantum\App\Exceptions\BaseException;
use Quantum\App\Exceptions\AppException;
use Quantum\App\Adapters\WebAppAdapter;
use Quantum\App\Enums\AppType;
use Quantum\App\App;

/**
Expand All @@ -32,8 +33,8 @@ class AppFactory
* Supported adapters
*/
public const ADAPTERS = [
App::WEB => WebAppAdapter::class,
App::CONSOLE => ConsoleAppAdapter::class,
AppType::WEB => WebAppAdapter::class,
AppType::CONSOLE => ConsoleAppAdapter::class,
];

/**
Expand Down
10 changes: 0 additions & 10 deletions src/Archive/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@
*/
class Archive
{
/**
* Phar
*/
public const PHAR = 'phar';

/**
* Zip
*/
public const ZIP = 'zip';

private ArchiveInterface $adapter;

public function __construct(ArchiveInterface $adapter)
Expand Down
33 changes: 33 additions & 0 deletions src/Archive/Enums/ArchiveType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

/**
* Quantum PHP Framework
*
* An open source software development framework for PHP
*
* @package Quantum
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 3.0.0
*/

namespace Quantum\Archive\Enums;

/**
* Class ArchiveType
* @package Quantum\Archive
* @codeCoverageIgnore
*/
final class ArchiveType
{
public const PHAR = 'phar';

public const ZIP = 'zip';

private function __construct()
{
}
}
7 changes: 4 additions & 3 deletions src/Archive/Factories/ArchiveFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Quantum\Archive\Adapters\PharAdapter;
use Quantum\App\Exceptions\BaseException;
use Quantum\Archive\Adapters\ZipAdapter;
use Quantum\Archive\Enums\ArchiveType;
use Quantum\Archive\Archive;

/**
Expand All @@ -32,8 +33,8 @@ class ArchiveFactory
* Supported adapters
*/
public const ADAPTERS = [
Archive::PHAR => PharAdapter::class,
Archive::ZIP => ZipAdapter::class,
ArchiveType::PHAR => PharAdapter::class,
ArchiveType::ZIP => ZipAdapter::class,
];

/**
Expand All @@ -44,7 +45,7 @@ class ArchiveFactory
/**
* @throws BaseException
*/
public static function get(string $type = Archive::PHAR): Archive
public static function get(string $type = ArchiveType::PHAR): Archive
{
if (!isset(self::$instances[$type])) {
self::$instances[$type] = self::createInstance($type);
Expand Down
10 changes: 0 additions & 10 deletions src/Auth/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@
*/
class Auth
{
/**
* Web
*/
public const SESSION = 'session';

/**
* Api
*/
public const JWT = 'jwt';

private AuthenticatableInterface $adapter;

public function __construct(AuthenticatableInterface $adapter)
Expand Down
33 changes: 33 additions & 0 deletions src/Auth/Enums/AuthType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

/**
* Quantum PHP Framework
*
* An open source software development framework for PHP
*
* @package Quantum
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 3.0.0
*/

namespace Quantum\Auth\Enums;

/**
* Class AuthType
* @package Quantum\Auth
* @codeCoverageIgnore
*/
final class AuthType
{
public const SESSION = 'session';

public const JWT = 'jwt';

private function __construct()
{
}
}
7 changes: 4 additions & 3 deletions src/Auth/Factories/AuthFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Quantum\Auth\Adapters\JwtAuthAdapter;
use Quantum\App\Exceptions\BaseException;
use Quantum\Di\Exceptions\DiException;
use Quantum\Auth\Enums\AuthType;
use Quantum\Service\QtService;
use Quantum\Hasher\Hasher;
use Quantum\Jwt\JwtToken;
Expand All @@ -42,8 +43,8 @@ class AuthFactory
* Supported adapters
*/
public const ADAPTERS = [
Auth::SESSION => SessionAuthAdapter::class,
Auth::JWT => JwtAuthAdapter::class,
AuthType::SESSION => SessionAuthAdapter::class,
AuthType::JWT => JwtAuthAdapter::class,
];

/**
Expand Down Expand Up @@ -128,6 +129,6 @@ private static function createAuthService(string $adapter): AuthServiceInterface

private static function createJwtInstance(string $adapter): ?JwtToken
{
return $adapter === Auth::JWT ? (new JwtToken())->setLeeway(1)->setClaims((array) config()->get('auth.claims')) : null;
return $adapter === AuthType::JWT ? (new JwtToken())->setLeeway(1)->setClaims((array) config()->get('auth.claims')) : null;
}
}
20 changes: 0 additions & 20 deletions src/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,6 @@
*/
class Cache
{
/**
* File adapter
*/
public const FILE = 'file';

/**
* Database adapter
*/
public const DATABASE = 'database';

/**
* Memcached adapter
*/
public const MEMCACHED = 'memcached';

/**
* Redis adapter
*/
public const REDIS = 'redis';

private CacheInterface $adapter;

/**
Expand Down
37 changes: 37 additions & 0 deletions src/Cache/Enums/CacheType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

/**
* Quantum PHP Framework
*
* An open source software development framework for PHP
*
* @package Quantum
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 3.0.0
*/

namespace Quantum\Cache\Enums;

/**
* Class CacheType
* @package Quantum\Cache
* @codeCoverageIgnore
*/
final class CacheType
{
public const FILE = 'file';

public const DATABASE = 'database';

public const MEMCACHED = 'memcached';

public const REDIS = 'redis';

private function __construct()
{
}
}
9 changes: 5 additions & 4 deletions src/Cache/Factories/CacheFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Quantum\Cache\Adapters\RedisAdapter;
use Quantum\Cache\Adapters\FileAdapter;
use Quantum\Di\Exceptions\DiException;
use Quantum\Cache\Enums\CacheType;
use Quantum\Loader\Setup;
use ReflectionException;
use Quantum\Cache\Cache;
Expand All @@ -38,10 +39,10 @@ class CacheFactory
* Supported adapters
*/
public const ADAPTERS = [
Cache::FILE => FileAdapter::class,
Cache::DATABASE => DatabaseAdapter::class,
Cache::MEMCACHED => MemcachedAdapter::class,
Cache::REDIS => RedisAdapter::class,
CacheType::FILE => FileAdapter::class,
CacheType::DATABASE => DatabaseAdapter::class,
CacheType::MEMCACHED => MemcachedAdapter::class,
CacheType::REDIS => RedisAdapter::class,
];

/**
Expand Down
10 changes: 0 additions & 10 deletions src/Captcha/Captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@
*/
class Captcha
{
/**
* HCaptcha adapter
*/
public const HCAPTCHA = 'hcaptcha';

/**
* ReCaptcha adapter
*/
public const RECAPTCHA = 'recaptcha';

private CaptchaInterface $adapter;

public function __construct(CaptchaInterface $adapter)
Expand Down
33 changes: 33 additions & 0 deletions src/Captcha/Enums/CaptchaType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

/**
* Quantum PHP Framework
*
* An open source software development framework for PHP
*
* @package Quantum
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 3.0.0
*/

namespace Quantum\Captcha\Enums;

/**
* Class CaptchaType
* @package Quantum\Captcha
* @codeCoverageIgnore
*/
final class CaptchaType
{
public const HCAPTCHA = 'hcaptcha';

public const RECAPTCHA = 'recaptcha';

private function __construct()
{
}
}
5 changes: 3 additions & 2 deletions src/Captcha/Factories/CaptchaFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Quantum\Captcha\Adapters\HcaptchaAdapter;
use Quantum\App\Exceptions\BaseException;
use Quantum\Di\Exceptions\DiException;
use Quantum\Captcha\Enums\CaptchaType;
use Quantum\HttpClient\HttpClient;
use Quantum\Captcha\Captcha;
use Quantum\Loader\Setup;
Expand All @@ -37,8 +38,8 @@ class CaptchaFactory
* Supported adapters
*/
public const ADAPTERS = [
Captcha::HCAPTCHA => HcaptchaAdapter::class,
Captcha::RECAPTCHA => RecaptchaAdapter::class,
CaptchaType::HCAPTCHA => HcaptchaAdapter::class,
CaptchaType::RECAPTCHA => RecaptchaAdapter::class,
];

/**
Expand Down
Loading
Loading