@@ -72,7 +72,7 @@ |
||
72 | 72 | DatabaseConfigLoader::class |
73 | 73 | ); |
74 | 74 | |
75 | - $this->app->share(AppDatabaseConfig::class, function (ContainerInterface $app) { |
|
75 | + $this->app->share(AppDatabaseConfig::class, function(ContainerInterface $app) { |
|
76 | 76 | $env = $app->get(Config::class)->get('app.env', ''); |
77 | 77 | return new AppDatabaseConfig($app->get(DatabaseConfigLoaderInterface::class), $env); |
78 | 78 | }); |
@@ -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 | */ |
@@ -68,10 +68,10 @@ |
||
68 | 68 | public function register(): void |
69 | 69 | { |
70 | 70 | $cfg = $this->app->get(Config::class)->get('session', []); |
71 | - $this->app->bind(Configuration::class, function (ContainerInterface $app) use ($cfg) { |
|
71 | + $this->app->bind(Configuration::class, function(ContainerInterface $app) use ($cfg) { |
|
72 | 72 | return new Configuration($cfg); |
73 | 73 | }); |
74 | - $this->app->bind(SessionHandlerInterface::class, function (ContainerInterface $app) { |
|
74 | + $this->app->bind(SessionHandlerInterface::class, function(ContainerInterface $app) { |
|
75 | 75 | return new LocalStorage( |
76 | 76 | $app->get(Filesystem::class), |
77 | 77 | $app->get(Configuration::class) |
@@ -68,19 +68,19 @@ |
||
68 | 68 | 'updated_at' => '?date', |
69 | 69 | ]); |
70 | 70 | |
71 | - $mapper->filter('status', function (Query $q, $value) { |
|
71 | + $mapper->filter('status', function(Query $q, $value) { |
|
72 | 72 | $q->where('status')->is($value); |
73 | 73 | }); |
74 | 74 | |
75 | - $mapper->filter('env', function (Query $q, $value) { |
|
75 | + $mapper->filter('env', function(Query $q, $value) { |
|
76 | 76 | $q->where('env')->is($value); |
77 | 77 | }); |
78 | 78 | |
79 | - $mapper->filter('module', function (Query $q, $value) { |
|
79 | + $mapper->filter('module', function(Query $q, $value) { |
|
80 | 80 | $q->where('module')->is($value); |
81 | 81 | }); |
82 | 82 | |
83 | - $mapper->filter('type', function (Query $q, $value) { |
|
83 | + $mapper->filter('type', function(Query $q, $value) { |
|
84 | 84 | $q->where('type')->is($value); |
85 | 85 | }); |
86 | 86 | } |
@@ -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 | } |
@@ -128,7 +128,7 @@ |
||
128 | 128 | ->query() |
129 | 129 | ->where('module')->is($group) |
130 | 130 | ->where('status')->is('Y') |
131 | - ->where(function (WhereStatement $where) use ($env) { |
|
131 | + ->where(function(WhereStatement $where) use ($env) { |
|
132 | 132 | $where->where('env')->is($env) |
133 | 133 | ->orWhere('env')->isNull(); |
134 | 134 | }); |
@@ -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 | } |
@@ -129,10 +129,10 @@ |
||
129 | 129 | $name = $results['key']; |
130 | 130 | |
131 | 131 | $config = $this->loader->loadConfig([ |
132 | - 'name' => $name, |
|
133 | - 'module' => $module, |
|
134 | - 'env' => $this->env |
|
135 | - ]); |
|
132 | + 'name' => $name, |
|
133 | + 'module' => $module, |
|
134 | + 'env' => $this->env |
|
135 | + ]); |
|
136 | 136 | |
137 | 137 | if ($config === null) { |
138 | 138 | $this->loader->insertConfig([ |
@@ -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); |