@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\ApiSkeleton\Search; |
6 | 6 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\ApiSkeleton\Provider; |
6 | 6 | |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | $container['console.name'] = 'chubbyphp-api-slim-skeleton'; |
18 | 18 | $container['console.version'] = '1.0'; |
19 | 19 | |
20 | - $container['console.helpers'] = function () { |
|
20 | + $container['console.helpers'] = function() { |
|
21 | 21 | return []; |
22 | 22 | }; |
23 | 23 | |
24 | - $container['console.commands'] = function () { |
|
24 | + $container['console.commands'] = function() { |
|
25 | 25 | return []; |
26 | 26 | }; |
27 | 27 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\ApiSkeleton; |
6 | 6 | |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | |
17 | 17 | /* @var Container $container */ |
18 | 18 | |
19 | -$container[IndexController::class] = function () use ($container) { |
|
19 | +$container[IndexController::class] = function() use ($container) { |
|
20 | 20 | return new IndexController($container['api-http.response.manager']); |
21 | 21 | }; |
22 | 22 | |
23 | -$container[SampleSearchController::class] = function () use ($container) { |
|
23 | +$container[SampleSearchController::class] = function() use ($container) { |
|
24 | 24 | return new SampleSearchController( |
25 | 25 | $container['defaultLanguage'], |
26 | 26 | $container[ErrorManager::class], |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | ); |
32 | 32 | }; |
33 | 33 | |
34 | -$container[SampleCreateController::class] = function () use ($container) { |
|
34 | +$container[SampleCreateController::class] = function() use ($container) { |
|
35 | 35 | return new SampleCreateController( |
36 | 36 | $container['defaultLanguage'], |
37 | 37 | $container[ErrorManager::class], |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | ); |
43 | 43 | }; |
44 | 44 | |
45 | -$container[SampleReadController::class] = function () use ($container) { |
|
45 | +$container[SampleReadController::class] = function() use ($container) { |
|
46 | 46 | return new SampleReadController( |
47 | 47 | $container[ErrorManager::class], |
48 | 48 | $container[SampleRepository::class], |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | ); |
51 | 51 | }; |
52 | 52 | |
53 | -$container[SampleUpdateController::class] = function () use ($container) { |
|
53 | +$container[SampleUpdateController::class] = function() use ($container) { |
|
54 | 54 | return new SampleUpdateController( |
55 | 55 | $container['defaultLanguage'], |
56 | 56 | $container[ErrorManager::class], |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ); |
62 | 62 | }; |
63 | 63 | |
64 | -$container[SampleDeleteController::class] = function () use ($container) { |
|
64 | +$container[SampleDeleteController::class] = function() use ($container) { |
|
65 | 65 | return new SampleDeleteController( |
66 | 66 | $container[ErrorManager::class], |
67 | 67 | $container[SampleRepository::class], |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\ApiSkeleton; |
6 | 6 | |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | $container->register(new ValidationProvider()); |
19 | 19 | |
20 | -$container->extend('validator.objectmappings', function (array $objectMappings) use ($container) { |
|
20 | +$container->extend('validator.objectmappings', function(array $objectMappings) use ($container) { |
|
21 | 21 | $objectMappings[] = new LazyObjectMapping( |
22 | 22 | $container, |
23 | 23 | SampleMapping::class, |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | return $objectMappings; |
34 | 34 | }); |
35 | 35 | |
36 | -$container[SampleMapping::class] = function () use ($container) { |
|
36 | +$container[SampleMapping::class] = function() use ($container) { |
|
37 | 37 | return new SampleMapping($container[Resolver::class]); |
38 | 38 | }; |
39 | 39 | |
40 | -$container[SampleSearchMapping::class] = function () { |
|
40 | +$container[SampleSearchMapping::class] = function() { |
|
41 | 41 | return new SampleSearchMapping(); |
42 | 42 | }; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\ApiSkeleton; |
6 | 6 | |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | |
15 | 15 | $container->register(new DoctrineServiceProvider()); |
16 | 16 | |
17 | -$container[ArrayStorageCache::class] = function () { |
|
17 | +$container[ArrayStorageCache::class] = function() { |
|
18 | 18 | return new ArrayStorageCache(); |
19 | 19 | }; |
20 | 20 | |
21 | -$container[SampleRepository::class] = function () use ($container) { |
|
21 | +$container[SampleRepository::class] = function() use ($container) { |
|
22 | 22 | return new SampleRepository( |
23 | 23 | $container['db'], |
24 | 24 | $container[Resolver::class], |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | ); |
28 | 28 | }; |
29 | 29 | |
30 | -$container[Resolver::class] = function () use ($container) { |
|
30 | +$container[Resolver::class] = function() use ($container) { |
|
31 | 31 | return new Resolver($container, [ |
32 | 32 | SampleRepository::class, |
33 | 33 | ]); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\ApiSkeleton; |
6 | 6 | |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | $container->register(new DeserializationProvider()); |
18 | 18 | |
19 | -$container->extend('deserializer.objectmappings', function (array $objectMappings) use ($container) { |
|
19 | +$container->extend('deserializer.objectmappings', function(array $objectMappings) use ($container) { |
|
20 | 20 | $objectMappings[] = new LazyObjectMapping( |
21 | 21 | $container, |
22 | 22 | SampleMapping::class, |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | return $objectMappings; |
33 | 33 | }); |
34 | 34 | |
35 | -$container[SampleMapping::class] = function () { |
|
35 | +$container[SampleMapping::class] = function() { |
|
36 | 36 | return new SampleMapping(); |
37 | 37 | }; |
38 | 38 | |
39 | -$container[SampleSearchMapping::class] = function () { |
|
39 | +$container[SampleSearchMapping::class] = function() { |
|
40 | 40 | return new SampleSearchMapping(); |
41 | 41 | }; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\ApiSkeleton; |
6 | 6 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | $container->register(new SerializationProvider()); |
23 | 23 | |
24 | -$container->extend('serializer.objectmappings', function (array $objectMappings) use ($container) { |
|
24 | +$container->extend('serializer.objectmappings', function(array $objectMappings) use ($container) { |
|
25 | 25 | $objectMappings[] = new LazyObjectMapping( |
26 | 26 | $container, |
27 | 27 | ErrorMapping::class, |
@@ -49,22 +49,22 @@ discard block |
||
49 | 49 | return $objectMappings; |
50 | 50 | }); |
51 | 51 | |
52 | -$container[LinkGenerator::class] = function () use ($container) { |
|
52 | +$container[LinkGenerator::class] = function() use ($container) { |
|
53 | 53 | return new LinkGenerator($container['router']); |
54 | 54 | }; |
55 | 55 | |
56 | -$container[ErrorMapping::class] = function () { |
|
56 | +$container[ErrorMapping::class] = function() { |
|
57 | 57 | return new ErrorMapping(); |
58 | 58 | }; |
59 | 59 | |
60 | -$container[IndexMapping::class] = function () use ($container) { |
|
60 | +$container[IndexMapping::class] = function() use ($container) { |
|
61 | 61 | return new IndexMapping($container[LinkGenerator::class]); |
62 | 62 | }; |
63 | 63 | |
64 | -$container[SampleMapping::class] = function () use ($container) { |
|
64 | +$container[SampleMapping::class] = function() use ($container) { |
|
65 | 65 | return new SampleMapping($container[LinkGenerator::class]); |
66 | 66 | }; |
67 | 67 | |
68 | -$container[SampleSearchMapping::class] = function () use ($container) { |
|
68 | +$container[SampleSearchMapping::class] = function() use ($container) { |
|
69 | 69 | return new SampleSearchMapping($container[LinkGenerator::class]); |
70 | 70 | }; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Chubbyphp\ApiSkeleton; |
6 | 6 | |
@@ -16,20 +16,20 @@ discard block |
||
16 | 16 | /* @var Container $container */ |
17 | 17 | $container->register(new ConsoleProvider()); |
18 | 18 | |
19 | -$container[CreateDatabaseCommand::class] = function () use ($container) { |
|
19 | +$container[CreateDatabaseCommand::class] = function() use ($container) { |
|
20 | 20 | return new CreateDatabaseCommand($container['db']); |
21 | 21 | }; |
22 | 22 | |
23 | -$container[RunSqlCommand::class] = function () use ($container) { |
|
23 | +$container[RunSqlCommand::class] = function() use ($container) { |
|
24 | 24 | return new RunSqlCommand($container['db']); |
25 | 25 | }; |
26 | 26 | |
27 | -$container[SchemaUpdateCommand::class] = function () use ($container) { |
|
27 | +$container[SchemaUpdateCommand::class] = function() use ($container) { |
|
28 | 28 | return new SchemaUpdateCommand($container['db'], __DIR__.'/schema.php'); |
29 | 29 | }; |
30 | 30 | |
31 | 31 | /* @var Container $container */ |
32 | -$container->extend('console.commands', function (array $commands) use ($container) { |
|
32 | +$container->extend('console.commands', function(array $commands) use ($container) { |
|
33 | 33 | $commands[] = new LazyCommand( |
34 | 34 | $container, |
35 | 35 | CreateDatabaseCommand::class, |
@@ -1,29 +1,29 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | function checkAllowedIp($remoteAddress) |
6 | 6 | { |
7 | - if(in_array($remoteAddress, array('127.0.0.1', 'fe80::1', '::1'), true)) { |
|
7 | + if (in_array($remoteAddress, array('127.0.0.1', 'fe80::1', '::1'), true)) { |
|
8 | 8 | return true; |
9 | 9 | } |
10 | 10 | $matches = array(); |
11 | 11 | // http://en.wikipedia.org/wiki/Private_network |
12 | - if(preg_match('/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/', $remoteAddress, $matches) === 1) { |
|
13 | - for($i=1;$i<5;$i++) { |
|
12 | + if (preg_match('/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/', $remoteAddress, $matches) === 1) { |
|
13 | + for ($i = 1; $i < 5; $i++) { |
|
14 | 14 | $matches[$i] = (int) $matches[$i]; |
15 | 15 | } |
16 | 16 | // localhost |
17 | - if($matches[1] === 127) { |
|
17 | + if ($matches[1] === 127) { |
|
18 | 18 | return true; |
19 | 19 | } |
20 | - if($matches[1] === 10) { |
|
20 | + if ($matches[1] === 10) { |
|
21 | 21 | return true; |
22 | 22 | } |
23 | - if($matches[1] === 172 && $matches[2] >= 16 && $matches[2] <= 31) { |
|
23 | + if ($matches[1] === 172 && $matches[2] >= 16 && $matches[2] <= 31) { |
|
24 | 24 | return true; |
25 | 25 | } |
26 | - if($matches[1] === 192 && $matches[2] === 168) { |
|
26 | + if ($matches[1] === 192 && $matches[2] === 168) { |
|
27 | 27 | return true; |
28 | 28 | } |
29 | 29 | } |
@@ -42,6 +42,6 @@ discard block |
||
42 | 42 | $env = 'dev'; |
43 | 43 | |
44 | 44 | /** @var \Slim\App $app */ |
45 | -$app = require_once __DIR__ . '/../app/app.php'; |
|
45 | +$app = require_once __DIR__.'/../app/app.php'; |
|
46 | 46 | |
47 | 47 | $app->run(); |