@@ -59,8 +59,7 @@ |
||
| 59 | 59 | * @class DatabaseConfigServiceProvider |
| 60 | 60 | * @package Platine\Framework\Service\Provider |
| 61 | 61 | */ |
| 62 | -class DatabaseConfigServiceProvider extends ServiceProvider |
|
| 63 | -{ |
|
| 62 | +class DatabaseConfigServiceProvider extends ServiceProvider { |
|
| 64 | 63 | /** |
| 65 | 64 | * {@inheritdoc} |
| 66 | 65 | */ |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | * @class Configuration |
| 56 | 56 | * @package Platine\Framework\Config\Model |
| 57 | 57 | */ |
| 58 | -class Configuration extends Entity |
|
| 59 | -{ |
|
| 58 | +class Configuration extends Entity { |
|
| 60 | 59 | /** |
| 61 | 60 | * {@inheritdoc} |
| 62 | 61 | */ |
@@ -54,14 +54,12 @@ |
||
| 54 | 54 | * @class ConfigurationRepository |
| 55 | 55 | * @package Platine\Framework\Config\Model |
| 56 | 56 | */ |
| 57 | -class ConfigurationRepository extends Repository |
|
| 58 | -{ |
|
| 57 | +class ConfigurationRepository extends Repository { |
|
| 59 | 58 | /** |
| 60 | 59 | * Create new instance |
| 61 | 60 | * @param EntityManager $manager |
| 62 | 61 | */ |
| 63 | - public function __construct(EntityManager $manager) |
|
| 64 | - { |
|
| 62 | + public function __construct(EntityManager $manager) { |
|
| 65 | 63 | parent::__construct($manager, Configuration::class); |
| 66 | 64 | } |
| 67 | 65 | } |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | * @class DatabaseConfigLoader |
| 57 | 57 | * @package Platine\Framework\Config |
| 58 | 58 | */ |
| 59 | -class DatabaseConfigLoader implements DatabaseConfigLoaderInterface |
|
| 60 | -{ |
|
| 59 | +class DatabaseConfigLoader implements DatabaseConfigLoaderInterface { |
|
| 61 | 60 | /** |
| 62 | 61 | * The Repository instance |
| 63 | 62 | * @var ConfigurationRepository |
@@ -69,8 +68,7 @@ discard block |
||
| 69 | 68 | * Create new instance |
| 70 | 69 | * @param ConfigurationRepository $repository |
| 71 | 70 | */ |
| 72 | - public function __construct(ConfigurationRepository $repository) |
|
| 73 | - { |
|
| 71 | + public function __construct(ConfigurationRepository $repository) { |
|
| 74 | 72 | $this->repository = $repository; |
| 75 | 73 | } |
| 76 | 74 | |
@@ -93,8 +91,7 @@ discard block |
||
| 93 | 91 | /** |
| 94 | 92 | * {@inheritdoc} |
| 95 | 93 | */ |
| 96 | - public function insertConfig(array $data) |
|
| 97 | - { |
|
| 94 | + public function insertConfig(array $data) { |
|
| 98 | 95 | $entity = $this->repository->create($data); |
| 99 | 96 | return $this->repository->insert($entity); |
| 100 | 97 | } |
@@ -58,8 +58,7 @@ discard block |
||
| 58 | 58 | * @template T |
| 59 | 59 | * @implements ArrayAccess<string, mixed> |
| 60 | 60 | */ |
| 61 | -class AppDatabaseConfig implements ArrayAccess |
|
| 62 | -{ |
|
| 61 | +class AppDatabaseConfig implements ArrayAccess { |
|
| 63 | 62 | /** |
| 64 | 63 | * The configuration loader to use |
| 65 | 64 | * @var DatabaseConfigLoaderInterface |
@@ -83,8 +82,7 @@ discard block |
||
| 83 | 82 | * @param DatabaseConfigLoaderInterface $loader the loader to use |
| 84 | 83 | * @param string $env the name of the environment |
| 85 | 84 | */ |
| 86 | - public function __construct(DatabaseConfigLoaderInterface $loader, string $env = '') |
|
| 87 | - { |
|
| 85 | + public function __construct(DatabaseConfigLoaderInterface $loader, string $env = '') { |
|
| 88 | 86 | $this->loader = $loader; |
| 89 | 87 | $this->env = $env; |
| 90 | 88 | } |
@@ -106,8 +104,7 @@ discard block |
||
| 106 | 104 | * not find the configuration item |
| 107 | 105 | * @return mixed |
| 108 | 106 | */ |
| 109 | - public function get(string $key, $default = null) |
|
| 110 | - { |
|
| 107 | + public function get(string $key, $default = null) { |
|
| 111 | 108 | $results = $this->parseKey($key); |
| 112 | 109 | $group = $results['group']; |
| 113 | 110 | |
@@ -216,16 +213,14 @@ discard block |
||
| 216 | 213 | /** |
| 217 | 214 | * {@inheritdoc} |
| 218 | 215 | */ |
| 219 | - public function offsetExists($key) |
|
| 220 | - { |
|
| 216 | + public function offsetExists($key) { |
|
| 221 | 217 | return $this->has($key); |
| 222 | 218 | } |
| 223 | 219 | |
| 224 | 220 | /** |
| 225 | 221 | * {@inheritdoc} |
| 226 | 222 | */ |
| 227 | - public function offsetGet($key) |
|
| 228 | - { |
|
| 223 | + public function offsetGet($key) { |
|
| 229 | 224 | return $this->get($key); |
| 230 | 225 | } |
| 231 | 226 | |
@@ -235,16 +230,14 @@ discard block |
||
| 235 | 230 | * @param mixed $value |
| 236 | 231 | * @return void |
| 237 | 232 | */ |
| 238 | - public function offsetSet($key, $value) |
|
| 239 | - { |
|
| 233 | + public function offsetSet($key, $value) { |
|
| 240 | 234 | $this->set($key, $value); |
| 241 | 235 | } |
| 242 | 236 | |
| 243 | 237 | /** |
| 244 | 238 | * {@inheritdoc} |
| 245 | 239 | */ |
| 246 | - public function offsetUnset($key) |
|
| 247 | - { |
|
| 240 | + public function offsetUnset($key) { |
|
| 248 | 241 | $this->set($key, null); |
| 249 | 242 | } |
| 250 | 243 | |
@@ -293,8 +286,7 @@ discard block |
||
| 293 | 286 | * @param mixed $value |
| 294 | 287 | * @return mixed |
| 295 | 288 | */ |
| 296 | - protected function getFormattedConfigValue($value) |
|
| 297 | - { |
|
| 289 | + protected function getFormattedConfigValue($value) { |
|
| 298 | 290 | if (is_array($value) || is_object($value)) { |
| 299 | 291 | return serialize($value); |
| 300 | 292 | } |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | * @class DatabaseConfigLoaderInterface |
| 56 | 56 | * @package Platine\Framework\Config |
| 57 | 57 | */ |
| 58 | -interface DatabaseConfigLoaderInterface extends LoaderInterface |
|
| 59 | -{ |
|
| 58 | +interface DatabaseConfigLoaderInterface extends LoaderInterface { |
|
| 60 | 59 | /** |
| 61 | 60 | * Load the configuration from database |
| 62 | 61 | * @param array<string, mixed> $where |
@@ -51,16 +51,14 @@ |
||
| 51 | 51 | * @class ConfigUtil |
| 52 | 52 | * @package Platine\Framework\Config |
| 53 | 53 | */ |
| 54 | -class ConfigUtil |
|
| 55 | -{ |
|
| 54 | +class ConfigUtil { |
|
| 56 | 55 | /** |
| 57 | 56 | * Convert the returned configuration to given type |
| 58 | 57 | * @param mixed $value |
| 59 | 58 | * @param string $type |
| 60 | 59 | * @return mixed |
| 61 | 60 | */ |
| 62 | - public static function convertToDataType($value, string $type) |
|
| 63 | - { |
|
| 61 | + public static function convertToDataType($value, string $type) { |
|
| 64 | 62 | switch ($type) { |
| 65 | 63 | case 'integer': |
| 66 | 64 | $value = intval($value); |