|
1 | 1 | <?php
|
2 | 2 |
|
| 3 | +declare(strict_types=1); |
| 4 | + |
3 | 5 | use ahinkle\PackagistLatestVersion\PackagistLatestVersion;
|
4 | 6 | use DI\Bridge\Slim\Bridge;
|
5 | 7 | use Doctrine\DBAL\Types\Type;
|
|
10 | 12 | use Doctrine\ORM\Tools\Console\ConsoleRunner;
|
11 | 13 | use Doctrine\ORM\Tools\Console\EntityManagerProvider\SingleManagerProvider;
|
12 | 14 | use Github\Client;
|
13 |
| -use Jenssegers\Agent\Agent; |
14 | 15 | use League\CommonMark\Extension\CommonMarkCoreExtension;
|
15 | 16 | use League\CommonMark\Extension\ExternalLink\ExternalLinkExtension;
|
16 | 17 | use League\CommonMark\Extension\GithubFlavoredMarkdownExtension;
|
|
52 | 53 | use PhpSchool\Website\Online\CloudWorkshopRepository;
|
53 | 54 | use PhpSchool\Website\Online\Command\DownloadComposerPackageList;
|
54 | 55 | use PhpSchool\Website\Online\Middleware\ExerciseRunnerRateLimiter;
|
55 |
| -use PhpSchool\Website\Online\Middleware\Styles; |
56 | 56 | use PhpSchool\Website\Online\PathGenerator;
|
57 | 57 | use PhpSchool\Website\Online\ProblemFileConverter;
|
58 | 58 | use PhpSchool\Website\Online\ProjectUploader;
|
|
101 | 101 | use Symfony\Component\RateLimiter\Storage\CacheStorage;
|
102 | 102 | use Symfony\Contracts\Cache\CacheInterface;
|
103 | 103 | use Tuupola\Middleware\JwtAuthentication;
|
| 104 | + |
104 | 105 | use function DI\factory;
|
105 | 106 | use function DI\get;
|
106 | 107 |
|
|
121 | 122 | $app = Bridge::create($c);
|
122 | 123 | $app->addRoutingMiddleware();
|
123 | 124 |
|
124 |
| - $app->add(function (Request $request, RequestHandler $handler) use($c) : Response { |
| 125 | + $app->add(function (Request $request, RequestHandler $handler) use ($c): Response { |
125 | 126 | /** @var Session $session */
|
126 | 127 | $session = $this->get(Session::class);
|
127 | 128 |
|
|
139 | 140 | }),
|
140 | 141 | 'cache' => factory(function (ContainerInterface $c): CacheInterface {
|
141 | 142 | if (!$c->get('config')['enableCache']) {
|
142 |
| - return new NullAdapter; |
| 143 | + return new NullAdapter(); |
143 | 144 | }
|
144 | 145 |
|
145 | 146 | $redisConnection = new \Predis\Client(['host' => $c->get('config')['redisHost']]);
|
|
157 | 158 |
|
158 | 159 | return new RedisAdapter($redisConnection, 'default');
|
159 | 160 | }),
|
160 |
| - LoggerInterface::class => factory(function (ContainerInterface $c): LoggerInterface{ |
| 161 | + LoggerInterface::class => factory(function (ContainerInterface $c): LoggerInterface { |
161 | 162 | $settings = $c->get('config')['logger'];
|
162 | 163 | $logger = new Logger($settings['name']);
|
163 |
| - $logger->pushProcessor(new UidProcessor); |
| 164 | + $logger->pushProcessor(new UidProcessor()); |
164 | 165 | $logger->pushHandler(new StreamHandler($settings['path'], Logger::DEBUG));
|
165 | 166 | return $logger;
|
166 | 167 | }),
|
167 | 168 |
|
168 | 169 | SessionStorageInterface::class => get(Session::class),
|
169 | 170 |
|
170 | 171 | Session::class => function (ContainerInterface $c): Session {
|
171 |
| - return new Session; |
| 172 | + return new Session(); |
172 | 173 | },
|
173 | 174 |
|
174 | 175 | FormHandlerFactory::class => function (ContainerInterface $c): FormHandlerFactory {
|
|
230 | 231 | Login::class => \DI\factory(function (ContainerInterface $c): Login {
|
231 | 232 | return new Login(
|
232 | 233 | $c->get(AdminAuthenticationService::class),
|
233 |
| - $c->get(FormHandlerFactory::class)->create(new LoginInputFilter), |
| 234 | + $c->get(FormHandlerFactory::class)->create(new LoginInputFilter()), |
234 | 235 | $c->get('config')['jwtSecret']
|
235 | 236 | );
|
236 | 237 | }),
|
|
365 | 366 | },
|
366 | 367 |
|
367 | 368 | 'form.event' => function (ContainerInterface $c): FormHandler {
|
368 |
| - return $c->get(FormHandlerFactory::class)->create(new EventInputFilter); |
| 369 | + return $c->get(FormHandlerFactory::class)->create(new EventInputFilter()); |
369 | 370 | },
|
370 | 371 |
|
371 | 372 | EventAll::class => function (ContainerInterface $c): EventAll {
|
|
474 | 475 |
|
475 | 476 | Generator::class => function (ContainerInterface $c): Generator {
|
476 | 477 | return new Generator(
|
477 |
| - new Parser(null, new class implements \Mni\FrontYAML\Markdown\MarkdownParser { |
| 478 | + new Parser(null, new class () implements \Mni\FrontYAML\Markdown\MarkdownParser { |
478 | 479 | public function parse($markdown): string
|
479 | 480 | {
|
480 | 481 | return (new Parsedown())->parse($markdown);
|
@@ -523,7 +524,7 @@ public function parse($markdown): string
|
523 | 524 | );
|
524 | 525 | },
|
525 | 526 |
|
526 |
| - JwtAuthentication::class => function (ContainerInterface $c): JwtAuthentication { |
| 527 | + JwtAuthentication::class => function (ContainerInterface $c): JwtAuthentication { |
527 | 528 | return new JwtAuthentication([
|
528 | 529 | 'secret' => $c->get('config')['jwtSecret'],
|
529 | 530 | 'path' => '/api/admin',
|
@@ -566,7 +567,7 @@ public function parse($markdown): string
|
566 | 567 | 'src/User/Entity',
|
567 | 568 | ],
|
568 | 569 | 'auto_generate_proxies' => true,
|
569 |
| - 'proxy_dir' => __DIR__.'/../cache/proxies', |
| 570 | + 'proxy_dir' => __DIR__ . '/../cache/proxies', |
570 | 571 | ],
|
571 | 572 | 'connection' => [
|
572 | 573 | 'driver' => 'pdo_mysql',
|
|
0 commit comments