Skip to content

Commit cfe9602

Browse files
committed
cs fix
1 parent a034528 commit cfe9602

17 files changed

Lines changed: 83 additions & 61 deletions

src/App/src/ConfigProvider.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
1111
use Dot\Cache\Adapter\ArrayAdapter;
1212
use Dot\Cache\Adapter\FilesystemAdapter;
13+
use Light\App\DBAL\Types\UuidType;
1314
use Light\App\Factory\EntityListenerResolverFactory;
1415
use Light\App\Factory\GetIndexViewHandlerFactory;
1516
use Light\App\Handler\GetIndexViewHandler;
1617
use Light\App\Resolver\EntityListenerResolver;
1718
use Mezzio\Application;
18-
use Light\App\DBAL\Types\UuidType;
1919
use Roave\PsrContainerDoctrine\EntityManagerFactory;
2020
use Symfony\Component\Cache\Adapter\AdapterInterface;
2121

@@ -79,9 +79,9 @@ class ConfigProvider
7979
public function __invoke(): array
8080
{
8181
return [
82-
'dependencies' => $this->getDependencies(),
83-
'doctrine' => $this->getDoctrineConfig(),
84-
'templates' => $this->getTemplates(),
82+
'dependencies' => $this->getDependencies(),
83+
'doctrine' => $this->getDoctrineConfig(),
84+
'templates' => $this->getTemplates(),
8585
'resultCacheLifetime' => 3600,
8686
];
8787
}
@@ -150,12 +150,12 @@ private function getDoctrineConfig(): array
150150
'configuration' => [
151151
'orm_default' => [
152152
'entity_listener_resolver' => EntityListenerResolver::class,
153-
'result_cache' => 'filesystem',
154-
'metadata_cache' => 'filesystem',
155-
'query_cache' => 'filesystem',
156-
'hydration_cache' => 'array',
157-
'typed_field_mapper' => null,
158-
'second_level_cache' => [
153+
'result_cache' => 'filesystem',
154+
'metadata_cache' => 'filesystem',
155+
'query_cache' => 'filesystem',
156+
'hydration_cache' => 'array',
157+
'typed_field_mapper' => null,
158+
'second_level_cache' => [
159159
'enabled' => true,
160160
'default_lifetime' => 3600,
161161
'default_lock_lifetime' => 60,
@@ -179,7 +179,7 @@ private function getDoctrineConfig(): array
179179
'execution_time_column_name' => 'execution_time',
180180
],
181181
'migrations_paths' => [
182-
'Migration' => 'src/App/src/Migration',
182+
'Migration' => 'src/App/src/Migration',
183183
],
184184
'all_or_nothing' => false,
185185
'check_database_platform' => true,

src/App/src/Factory/EntityListenerResolverFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ public function __invoke(ContainerInterface $container): EntityListenerResolver
1313
{
1414
return new EntityListenerResolver($container);
1515
}
16-
}
16+
}

src/App/src/Fixture/AuthorLoader.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,32 @@
88
use Doctrine\Persistence\ObjectManager;
99
use Light\Blog\Entity\Author;
1010

11+
use function file_get_contents;
12+
use function json_decode;
13+
use function preg_replace;
14+
use function strtolower;
15+
use function trim;
16+
1117
class AuthorLoader extends Fixture
1218
{
1319
public function load(ObjectManager $manager): void
1420
{
15-
$jsonFile = __DIR__ . '/articles_cleaned.json';
21+
$jsonFile = __DIR__ . '/articles_cleaned.json';
1622
$categories = json_decode(file_get_contents($jsonFile), true);
1723

1824
$seenAuthorIds = [];
1925

2026
foreach ($categories as $cat) {
2127
foreach ($cat['articles'] as $article) {
2228
$authorData = $article['author'] ?? null;
23-
if (!$authorData) continue;
29+
if (! $authorData) {
30+
continue;
31+
}
2432

2533
$wpAuthorId = $authorData['user_email'];
26-
if (isset($seenAuthorIds[$wpAuthorId])) continue;
34+
if (isset($seenAuthorIds[$wpAuthorId])) {
35+
continue;
36+
}
2737
$seenAuthorIds[$wpAuthorId] = true;
2838

2939
$name = $authorData['display_name'];
@@ -55,4 +65,4 @@ public function getOrder(): int
5565
{
5666
return 1;
5767
}
58-
}
68+
}

src/App/src/Fixture/CategoryLoader.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Doctrine\Persistence\ObjectManager;
99
use Light\Blog\Entity\Category;
1010

11+
use function file_get_contents;
12+
use function json_decode;
13+
1114
class CategoryLoader extends Fixture
1215
{
1316
public function load(ObjectManager $manager): void
@@ -32,4 +35,4 @@ public function getOrder(): int
3235
{
3336
return 2;
3437
}
35-
}
38+
}

src/App/src/Fixture/PostLoader.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,20 @@
88
use Doctrine\Bundle\FixturesBundle\Fixture;
99
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
1010
use Doctrine\Persistence\ObjectManager;
11-
use Light\Blog\Entity\Post;
1211
use Light\Blog\Entity\Author;
1312
use Light\Blog\Entity\Category;
13+
use Light\Blog\Entity\Post;
1414
use Light\Blog\Enum\PostStatusEnum;
1515

16+
use function file_get_contents;
17+
use function html_entity_decode;
18+
use function json_decode;
19+
use function preg_replace;
20+
use function strtolower;
21+
use function trim;
22+
23+
use const ENT_QUOTES;
24+
1625
class PostLoader extends Fixture implements DependentFixtureInterface
1726
{
1827
public function load(ObjectManager $manager): void
@@ -28,7 +37,7 @@ public function load(ObjectManager $manager): void
2837

2938
foreach ($cat['articles'] as $articleData) {
3039
$wpAuthorId = $articleData['author']['user_email'] ?? null;
31-
if (!$wpAuthorId || !$this->hasReference('author_' . $wpAuthorId, Author::class)) {
40+
if (! $wpAuthorId || ! $this->hasReference('author_' . $wpAuthorId, Author::class)) {
3241
echo "SKIP (no author): {$articleData['post_title']}\n";
3342
continue;
3443
}
@@ -52,7 +61,7 @@ public function load(ObjectManager $manager): void
5261
};
5362

5463
$rawDate = $articleData['post_date'] ?? '';
55-
$postDate = (!empty($rawDate) && $rawDate !== '0000-00-00 00:00:00')
64+
$postDate = ! empty($rawDate) && $rawDate !== '0000-00-00 00:00:00'
5665
? new DateTimeImmutable($rawDate)
5766
: new DateTimeImmutable();
5867

@@ -71,6 +80,7 @@ public function load(ObjectManager $manager): void
7180

7281
$manager->flush();
7382
}
83+
7484
public function getDependencies(): array
7585
{
7686
return [
@@ -90,4 +100,4 @@ public function getOrder(): int
90100
{
91101
return 3;
92102
}
93-
}
103+
}

src/App/src/Helper/Paginator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
22

3-
namespace Light\App\Helper;
3+
declare(strict_types=1);
44

5+
namespace Light\App\Helper;
56

67
use Doctrine\ORM\Tools\Pagination\Paginator as DoctrinePaginator;
78

@@ -140,4 +141,4 @@ public static function wrapper(DoctrinePaginator $paginator, array $params = [],
140141

141142
return $params;
142143
}
143-
}
144+
}

src/App/src/Resolver/EntityListenerResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ public function resolve(string $className): object
2424
{
2525
return $this->container->get($className);
2626
}
27-
}
27+
}

src/Blog/src/ConfigProvider.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66

77
use Doctrine\ORM\Mapping\Driver\AttributeDriver;
88
use Light\Blog\DBAL\Types\PostStatusEnumType;
9-
use Light\Blog\Factory\Post\PostCollectionHandlerFactory;
10-
use Light\Blog\Factory\Post\PostCollectionRepositoryFactory;
11-
use Light\Blog\Factory\Post\PostResourceHandlerFactory;
129
use Light\Blog\Factory\Category\CategoryCollectionHandlerFactory;
1310
use Light\Blog\Factory\Category\CategoryCollectionRepositoryFactory;
1411
use Light\Blog\Factory\Category\CategoryResourceHandlerFactory;
15-
use Light\Blog\Handler\GetPostCollectionHandler;
16-
use Light\Blog\Handler\GetPostResourceHandler;
12+
use Light\Blog\Factory\Post\PostCollectionHandlerFactory;
13+
use Light\Blog\Factory\Post\PostCollectionRepositoryFactory;
14+
use Light\Blog\Factory\Post\PostResourceHandlerFactory;
1715
use Light\Blog\Handler\GetCategoryCollectionHandler;
1816
use Light\Blog\Handler\GetCategoryResourceHandler;
19-
use Light\Blog\Repository\PostRepository;
17+
use Light\Blog\Handler\GetPostCollectionHandler;
18+
use Light\Blog\Handler\GetPostResourceHandler;
2019
use Light\Blog\Repository\CategoryRepository;
20+
use Light\Blog\Repository\PostRepository;
2121
use Mezzio\Application;
2222

2323
class ConfigProvider
@@ -54,9 +54,9 @@ private function getDependencies(): array
5454
'factories' => [
5555
GetCategoryCollectionHandler::class => CategoryCollectionHandlerFactory::class,
5656
CategoryRepository::class => CategoryCollectionRepositoryFactory::class,
57-
GetPostCollectionHandler::class => PostCollectionHandlerFactory::class,
58-
PostRepository::class => PostCollectionRepositoryFactory::class,
59-
GetPostResourceHandler::class => PostResourceHandlerFactory::class,
57+
GetPostCollectionHandler::class => PostCollectionHandlerFactory::class,
58+
PostRepository::class => PostCollectionRepositoryFactory::class,
59+
GetPostResourceHandler::class => PostResourceHandlerFactory::class,
6060
GetCategoryResourceHandler::class => CategoryResourceHandlerFactory::class,
6161
],
6262
];

src/Blog/src/Entity/Author.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ public function setEmail(string $email): void
7777
public function getArrayCopy(): array
7878
{
7979
return [
80-
'id' => $this->id->toString(),
81-
'name' => $this->name,
82-
'slug' => $this->slug,
80+
'id' => $this->id->toString(),
81+
'name' => $this->name,
82+
'slug' => $this->slug,
8383
'email' => $this->email,
84-
'bio' => $this->bio,
84+
'bio' => $this->bio,
8585
];
8686
}
8787
}

src/Blog/src/Entity/Category.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ public function setVisibility(bool $isVisible): void
6363
public function getArrayCopy(): array
6464
{
6565
return [
66-
'id' => $this->id->toString(),
67-
'name' => $this->name,
66+
'id' => $this->id->toString(),
67+
'name' => $this->name,
6868
'isVisible' => $this->isVisible,
69-
'slug' => $this->slug,
69+
'slug' => $this->slug,
7070
];
7171
}
7272
}

0 commit comments

Comments
 (0)