@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | * @class Cron |
54 | 54 | * @package Platine\Framework\Task |
55 | 55 | */ |
56 | -class Cron |
|
57 | -{ |
|
56 | +class Cron { |
|
58 | 57 | /** |
59 | 58 | * Parse the given cron expression and finds next execution time(stamp) |
60 | 59 | * @param string $expression |
@@ -80,7 +79,7 @@ discard block |
||
80 | 79 | . '((\*(\/[0-9]+)?)|[0-9\-\,\/]+)\s+' |
81 | 80 | . '((\*(\/[0-9]+)?)|[0-9\-\,\/]+)\s+' |
82 | 81 | . '((\*(\/[0-9]+)?)|[0-9\-\,\/]+)$/i'; |
83 | - if (!preg_match($cronRegex, $cronExpression)) { |
|
82 | + if (!preg_match($cronRegex, $cronExpression)) { |
|
84 | 83 | throw new InvalidArgumentException(sprintf( |
85 | 84 | 'Invalid cron expression [%s]', |
86 | 85 | $expression |
@@ -88,12 +87,12 @@ discard block |
||
88 | 87 | } |
89 | 88 | |
90 | 89 | $crons = preg_split('/[\s]+/i', $cronExpression); |
91 | - if ($crons === false) { |
|
90 | + if ($crons === false) { |
|
92 | 91 | return 0; |
93 | 92 | } |
94 | 93 | |
95 | 94 | $start = time(); |
96 | - if ($timestamp !== null) { |
|
95 | + if ($timestamp !== null) { |
|
97 | 96 | $start = $timestamp; |
98 | 97 | } |
99 | 98 | |
@@ -109,7 +108,7 @@ discard block |
||
109 | 108 | // to check more than 1 year ahead |
110 | 109 | $total = 60 * 60 * 24 * 366; |
111 | 110 | |
112 | - for ($i = 0; $i <= $total; $i += 60) { |
|
111 | + for ($i = 0; $i <= $total; $i += 60) { |
|
113 | 112 | $current = $start + $i; |
114 | 113 | if ( |
115 | 114 | in_array((int) date('j', $current), $dates['dom']) && |
@@ -117,7 +116,7 @@ discard block |
||
117 | 116 | in_array((int) date('w', $current), $dates['dow']) && |
118 | 117 | in_array((int) date('G', $current), $dates['hours']) && |
119 | 118 | in_array((int) date('i', $current), $dates['minutes']) |
120 | - ) { |
|
119 | + ) { |
|
121 | 120 | return $current; |
122 | 121 | } |
123 | 122 | } |
@@ -137,7 +136,7 @@ discard block |
||
137 | 136 | { |
138 | 137 | $result = []; |
139 | 138 | $values = explode(',', $expression); |
140 | - foreach ($values as $value) { |
|
139 | + foreach ($values as $value) { |
|
141 | 140 | $slashValues = explode('/', $value); |
142 | 141 | $step = $slashValues[1] ?? 1; |
143 | 142 | $minusValues = explode('-', $slashValues[0]); |
@@ -147,7 +146,7 @@ discard block |
||
147 | 146 | $maximum = count($minusValues) === 2 ? $minusValues[1] |
148 | 147 | : ($slashValues[0] === '*' ? $max : $slashValues[0]); |
149 | 148 | |
150 | - for ($i = $minimum; $i <= $maximum; $i += $step) { |
|
149 | + for ($i = $minimum; $i <= $maximum; $i += $step) { |
|
151 | 150 | $result[$i] = intval($i); |
152 | 151 | } |
153 | 152 | } |
@@ -56,8 +56,7 @@ |
||
56 | 56 | * @class FilesystemServiceProvider |
57 | 57 | * @package Platine\Framework\Service\Provider |
58 | 58 | */ |
59 | -class FilesystemServiceProvider extends ServiceProvider |
|
60 | -{ |
|
59 | +class FilesystemServiceProvider extends ServiceProvider { |
|
61 | 60 | /** |
62 | 61 | * {@inheritdoc} |
63 | 62 | */ |
@@ -56,8 +56,7 @@ |
||
56 | 56 | * @class AuditServiceProvider |
57 | 57 | * @package Platine\Framework\Service\Provider |
58 | 58 | */ |
59 | -class AuditServiceProvider extends ServiceProvider |
|
60 | -{ |
|
59 | +class AuditServiceProvider extends ServiceProvider { |
|
61 | 60 | /** |
62 | 61 | * {@inheritdoc} |
63 | 62 | */ |
@@ -56,8 +56,7 @@ |
||
56 | 56 | * @class RoutingServiceProvider |
57 | 57 | * @package Platine\Framework\Service\Provider |
58 | 58 | */ |
59 | -class RoutingServiceProvider extends ServiceProvider |
|
60 | -{ |
|
59 | +class RoutingServiceProvider extends ServiceProvider { |
|
61 | 60 | /** |
62 | 61 | * {@inheritdoc} |
63 | 62 | */ |
@@ -87,7 +87,7 @@ |
||
87 | 87 | $config = $app->get(Config::class); |
88 | 88 | |
89 | 89 | $pagination->setItemsPerPage($config->get('pagination.item_per_page', 10)) |
90 | - ->setMaxPages($config->get('pagination.max_pages', 5)); |
|
90 | + ->setMaxPages($config->get('pagination.max_pages', 5)); |
|
91 | 91 | |
92 | 92 | return $pagination; |
93 | 93 | }); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function register(): void |
70 | 70 | { |
71 | - $this->app->bind(UrlGeneratorInterface::class, function (ContainerInterface $app) { |
|
71 | + $this->app->bind(UrlGeneratorInterface::class, function(ContainerInterface $app) { |
|
72 | 72 | return new ServerRequestUrlGenerator( |
73 | 73 | $app->get(ServerRequestInterface::class), |
74 | 74 | 'page' |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $this->app->bind(RendererInterface::class, BootstrapRenderer::class); |
79 | 79 | |
80 | - $this->app->bind(Pagination::class, function (ContainerInterface $app) { |
|
80 | + $this->app->bind(Pagination::class, function(ContainerInterface $app) { |
|
81 | 81 | $pagination = new Pagination( |
82 | 82 | $app->get(UrlGeneratorInterface::class), |
83 | 83 | $app->get(RendererInterface::class) |
@@ -61,14 +61,13 @@ discard block |
||
61 | 61 | * @class PaginationServiceProvider |
62 | 62 | * @package Platine\Framework\Service\Provider |
63 | 63 | */ |
64 | -class PaginationServiceProvider extends ServiceProvider |
|
65 | -{ |
|
64 | +class PaginationServiceProvider extends ServiceProvider { |
|
66 | 65 | /** |
67 | 66 | * {@inheritdoc} |
68 | 67 | */ |
69 | 68 | public function register(): void |
70 | 69 | { |
71 | - $this->app->bind(UrlGeneratorInterface::class, function (ContainerInterface $app) { |
|
70 | + $this->app->bind(UrlGeneratorInterface::class, function (ContainerInterface $app) { |
|
72 | 71 | return new ServerRequestUrlGenerator( |
73 | 72 | $app->get(ServerRequestInterface::class), |
74 | 73 | 'page' |
@@ -77,7 +76,7 @@ discard block |
||
77 | 76 | |
78 | 77 | $this->app->bind(RendererInterface::class, BootstrapRenderer::class); |
79 | 78 | |
80 | - $this->app->bind(Pagination::class, function (ContainerInterface $app) { |
|
79 | + $this->app->bind(Pagination::class, function (ContainerInterface $app) { |
|
81 | 80 | $pagination = new Pagination( |
82 | 81 | $app->get(UrlGeneratorInterface::class), |
83 | 82 | $app->get(RendererInterface::class) |
@@ -70,7 +70,7 @@ |
||
70 | 70 | */ |
71 | 71 | public function register(): void |
72 | 72 | { |
73 | - $this->app->bind(SecurityPolicy::class, function (ContainerInterface $app) { |
|
73 | + $this->app->bind(SecurityPolicy::class, function(ContainerInterface $app) { |
|
74 | 74 | return new SecurityPolicy( |
75 | 75 | $app->get(Config::class), |
76 | 76 | $app->get(Router::class), |
@@ -63,14 +63,13 @@ |
||
63 | 63 | * @class SecurityServiceProvider |
64 | 64 | * @package Platine\Framework\Service\Provider |
65 | 65 | */ |
66 | -class SecurityServiceProvider extends ServiceProvider |
|
67 | -{ |
|
66 | +class SecurityServiceProvider extends ServiceProvider { |
|
68 | 67 | /** |
69 | 68 | * {@inheritdoc} |
70 | 69 | */ |
71 | 70 | public function register(): void |
72 | 71 | { |
73 | - $this->app->bind(SecurityPolicy::class, function (ContainerInterface $app) { |
|
72 | + $this->app->bind(SecurityPolicy::class, function (ContainerInterface $app) { |
|
74 | 73 | return new SecurityPolicy( |
75 | 74 | $app->get(Config::class), |
76 | 75 | $app->get(Router::class), |
@@ -70,7 +70,7 @@ |
||
70 | 70 | { |
71 | 71 | $config = $this->app->get(Config::class)->get('template', []); |
72 | 72 | |
73 | - $this->app->bind(Configuration::class, function (ContainerInterface $app) use ($config) { |
|
73 | + $this->app->bind(Configuration::class, function(ContainerInterface $app) use ($config) { |
|
74 | 74 | return new Configuration($config); |
75 | 75 | }); |
76 | 76 | $this->app->bind(AbstractCache::class, $config['cache_driver'] ?? NullCache::class); |
@@ -61,8 +61,7 @@ discard block |
||
61 | 61 | * @class TemplateServiceProvider |
62 | 62 | * @package Platine\Framework\Service\Provider |
63 | 63 | */ |
64 | -class TemplateServiceProvider extends ServiceProvider |
|
65 | -{ |
|
64 | +class TemplateServiceProvider extends ServiceProvider { |
|
66 | 65 | /** |
67 | 66 | * {@inheritdoc} |
68 | 67 | */ |
@@ -70,7 +69,7 @@ discard block |
||
70 | 69 | { |
71 | 70 | $config = $this->app->get(Config::class)->get('template', []); |
72 | 71 | |
73 | - $this->app->bind(Configuration::class, function (ContainerInterface $app) use ($config) { |
|
72 | + $this->app->bind(Configuration::class, function (ContainerInterface $app) use ($config) { |
|
74 | 73 | return new Configuration($config); |
75 | 74 | }); |
76 | 75 | $this->app->bind(AbstractCache::class, $config['cache_driver'] ?? NullCache::class); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | $this->app->share(Application::class, $this->app); |
80 | 80 | $this->app->share('app', $this->app); |
81 | - $this->app->share(ConsoleApp::class, function () { |
|
81 | + $this->app->share(ConsoleApp::class, function() { |
|
82 | 82 | return new ConsoleApp('PLATINE CONSOLE', '1.0.0'); |
83 | 83 | }); |
84 | 84 | $this->app->share(ContainerInterface::class, $this->app); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->app->bind(MiddlewareResolverInterface::class, MiddlewareResolver::class); |
89 | 89 | $this->app->bind(MaintenanceMiddleware::class); |
90 | 90 | $this->app->bind(MaintenanceDriverInterface::class, FileMaintenanceDriver::class); |
91 | - $this->app->bind(EmitterInterface::class, function (ContainerInterface $app) { |
|
91 | + $this->app->bind(EmitterInterface::class, function(ContainerInterface $app) { |
|
92 | 92 | return new ResponseEmitter( |
93 | 93 | $app->get(Config::class)->get('app.response_chunck_size', null) |
94 | 94 | ); |
@@ -69,8 +69,7 @@ discard block |
||
69 | 69 | * @class BaseServiceProvider |
70 | 70 | * @package Platine\Framework\Service\Provider |
71 | 71 | */ |
72 | -class BaseServiceProvider extends ServiceProvider |
|
73 | -{ |
|
72 | +class BaseServiceProvider extends ServiceProvider { |
|
74 | 73 | /** |
75 | 74 | * {@inheritdoc} |
76 | 75 | */ |
@@ -78,7 +77,7 @@ discard block |
||
78 | 77 | { |
79 | 78 | $this->app->share(Application::class, $this->app); |
80 | 79 | $this->app->share('app', $this->app); |
81 | - $this->app->share(ConsoleApp::class, function () { |
|
80 | + $this->app->share(ConsoleApp::class, function () { |
|
82 | 81 | return new ConsoleApp('PLATINE CONSOLE', '1.0.0'); |
83 | 82 | }); |
84 | 83 | $this->app->share(ContainerInterface::class, $this->app); |
@@ -88,7 +87,7 @@ discard block |
||
88 | 87 | $this->app->bind(MiddlewareResolverInterface::class, MiddlewareResolver::class); |
89 | 88 | $this->app->bind(MaintenanceMiddleware::class); |
90 | 89 | $this->app->bind(MaintenanceDriverInterface::class, FileMaintenanceDriver::class); |
91 | - $this->app->bind(EmitterInterface::class, function (ContainerInterface $app) { |
|
90 | + $this->app->bind(EmitterInterface::class, function (ContainerInterface $app) { |
|
92 | 91 | return new ResponseEmitter( |
93 | 92 | $app->get(Config::class)->get('app.response_chunck_size', null) |
94 | 93 | ); |
@@ -65,8 +65,7 @@ |
||
65 | 65 | * @class AuthServiceProvider |
66 | 66 | * @package Platine\Framework\Service\Provider |
67 | 67 | */ |
68 | -class AuthServiceProvider extends ServiceProvider |
|
69 | -{ |
|
68 | +class AuthServiceProvider extends ServiceProvider { |
|
70 | 69 | /** |
71 | 70 | * {@inheritdoc} |
72 | 71 | */ |