@@ -22,13 +22,13 @@ |
||
22 | 22 | |
23 | 23 | $recommended = $this->postRepository |
24 | 24 | ->withAudio() |
25 | - ->filter(function (AudioEpisode $episode) use ($post) { |
|
25 | + ->filter(function(AudioEpisode $episode) use ($post) { |
|
26 | 26 | return $post->guid() !== $episode->guid(); |
27 | 27 | }) |
28 | - ->sortByDesc(function (AudioEpisode $episode) { |
|
28 | + ->sortByDesc(function(AudioEpisode $episode) { |
|
29 | 29 | return $episode->createdAt(); |
30 | 30 | }) |
31 | - ->sortByDesc(function (AudioEpisode $episode) use ($tags) { |
|
31 | + ->sortByDesc(function(AudioEpisode $episode) use ($tags) { |
|
32 | 32 | return count(array_intersect($episode->tags() ?? [], $tags)); |
33 | 33 | }) |
34 | 34 | ->take($amount); |
@@ -26,15 +26,15 @@ |
||
26 | 26 | /** @var Collection|array $paths */ |
27 | 27 | $paths = $this->jigsaw->getOutputPaths(); |
28 | 28 | |
29 | - $paths = array_map(function (string $path) { |
|
29 | + $paths = array_map(function(string $path) { |
|
30 | 30 | return $this->jigsaw->getDestinationPath() . $path . '/index.html'; |
31 | 31 | }, is_array($paths) ? $paths : $paths->toArray()); |
32 | 32 | |
33 | - $paths = array_filter($paths, function (string $path) { |
|
33 | + $paths = array_filter($paths, function(string $path) { |
|
34 | 34 | return $this->filesystem->exists($path); |
35 | 35 | }); |
36 | 36 | |
37 | - return new OutputFileCollection(array_map(function (string $path) { |
|
37 | + return new OutputFileCollection(array_map(function(string $path) { |
|
38 | 38 | return new OutputFile($path, $this->filesystem->get($path)); |
39 | 39 | }, $paths)); |
40 | 40 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | return new PostCollection( |
29 | 29 | $collection |
30 | - ->map(function (PageVariable $post) { |
|
30 | + ->map(function(PageVariable $post) { |
|
31 | 31 | return $this->jigsawPostFactory->newPostFromPageVariable($post); |
32 | 32 | }) |
33 | 33 | ->toArray() |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | return new AudioEpisodeCollection( |
40 | 40 | $collection |
41 | - ->map(function (PageVariable $post) { |
|
41 | + ->map(function(PageVariable $post) { |
|
42 | 42 | return $this->jigsawPostFactory->newAudioEpisodeFromPageVariable($post); |
43 | 43 | }) |
44 | 44 | ->toArray() |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return $this->jigsawCollectionToAudioEpisodeCollection( |
80 | 80 | $this->jigsaw |
81 | 81 | ->getCollection('episodes') |
82 | - ->filter(function (PageVariable $page) { |
|
82 | + ->filter(function(PageVariable $page) { |
|
83 | 83 | return !is_null($page->episode['audioUrl']); |
84 | 84 | }) |
85 | 85 | ); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function testExecuteFetchesExactAmount(): void |
27 | 27 | { |
28 | 28 | $audioEpisodeCollection = $this->createDefaultAudioEpisodeCollection() |
29 | - ->sortByDesc(function (AudioEpisode $episode) { |
|
29 | + ->sortByDesc(function(AudioEpisode $episode) { |
|
30 | 30 | return $episode->createdAt(); |
31 | 31 | }); |
32 | 32 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function testExecuteFiltersCategoryName(): void |
46 | 46 | { |
47 | 47 | $audioEpisodeCollection = $this->createDefaultAudioEpisodeCollection() |
48 | - ->sortByDesc(function (AudioEpisode $episode) { |
|
48 | + ->sortByDesc(function(AudioEpisode $episode) { |
|
49 | 49 | return $episode->createdAt(); |
50 | 50 | }); |
51 | 51 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $referenceEpisode, |
40 | 40 | 999 |
41 | 41 | ) |
42 | - ->filter(function (AudioEpisode $episode) use ($referenceEpisode) { |
|
42 | + ->filter(function(AudioEpisode $episode) use ($referenceEpisode) { |
|
43 | 43 | return $episode->guid() === $referenceEpisode->guid(); |
44 | 44 | }); |
45 | 45 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $referenceEpisodeProphecy->tags()->willReturn([]); |
56 | 56 | $referenceEpisode = $referenceEpisodeProphecy->reveal(); |
57 | 57 | |
58 | - $recommended = $this->recommendationService->recommendEpisodesForPost($referenceEpisode,999); |
|
58 | + $recommended = $this->recommendationService->recommendEpisodesForPost($referenceEpisode, 999); |
|
59 | 59 | |
60 | 60 | $this->assertGreaterThan($recommended->last()->createdAt(), $recommended->first()->createdAt()); |
61 | 61 | } |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | $referenceEpisodeProphecy->tags()->willReturn([]); |
70 | 70 | $referenceEpisode = $referenceEpisodeProphecy->reveal(); |
71 | 71 | |
72 | - $recommended = $this->recommendationService->recommendEpisodesForPost($referenceEpisode,2); |
|
72 | + $recommended = $this->recommendationService->recommendEpisodesForPost($referenceEpisode, 2); |
|
73 | 73 | $this->assertEquals(2, $recommended->count()); |
74 | 74 | |
75 | - $recommended = $this->recommendationService->recommendEpisodesForPost($referenceEpisode,1); |
|
75 | + $recommended = $this->recommendationService->recommendEpisodesForPost($referenceEpisode, 1); |
|
76 | 76 | $this->assertEquals(1, $recommended->count()); |
77 | 77 | } |
78 | 78 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | 'googleTagManagerId' => 'GTM-TEST-ID', |
10 | 10 | 'collections' => [ |
11 | 11 | 'episodes' => [ |
12 | - 'path' => function (\TightenCo\Jigsaw\PageVariable $page) { |
|
12 | + 'path' => function(\TightenCo\Jigsaw\PageVariable $page) { |
|
13 | 13 | $builder = new \PODEntender\Domain\Model\Post\EpisodeSlugBuilder(); |
14 | 14 | return $builder->build( |
15 | 15 | $page->episode['number'], |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $filesystem = new Filesystem(); |
19 | 19 | |
20 | 20 | $outputFileRepository->all() |
21 | - ->filter(function (OutputFile $file) { |
|
21 | + ->filter(function(OutputFile $file) { |
|
22 | 22 | if (!Str::contains($file->path(), 'episodio/')) { |
23 | 23 | return false; |
24 | 24 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | return $crawler->filter('link[rel="oldLink"]')->count(); |
30 | 30 | }) |
31 | - ->each(function (OutputFile $file) use ($jigsaw, $filesystem) { |
|
31 | + ->each(function(OutputFile $file) use ($jigsaw, $filesystem) { |
|
32 | 32 | $crawler = new Crawler(); |
33 | 33 | $crawler->addHtmlContent($file->content()); |
34 | 34 |