@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($status != 200) return; |
48 | 48 | |
49 | 49 | $crawler->filter('#main-content div.forabg')->each( |
50 | - function (Crawler $node, $index) use ($output, $entityManager, $entityBridge, $dialogHelper) |
|
50 | + function(Crawler $node, $index) use ($output, $entityManager, $entityBridge, $dialogHelper) |
|
51 | 51 | { |
52 | 52 | $categoryId = $index + 1; |
53 | 53 | $parsedName = $node->filter('ul.topiclist li.header dd.dterm h2')->text(); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $entityManager->persist($entity); |
68 | 68 | |
69 | 69 | $node->filter('ul.forums li.row dd.dterm')->each( |
70 | - function (Crawler $node, $index) use ($output, $entityManager, $entityBridge, $dialogHelper, $categoryId) |
|
70 | + function(Crawler $node, $index) use ($output, $entityManager, $entityBridge, $dialogHelper, $categoryId) |
|
71 | 71 | { |
72 | 72 | $link = $node->filter('a.forumtitle'); |
73 | 73 | $forumId = substr($link->attr('href'), 2, -6); |
@@ -44,7 +44,9 @@ |
||
44 | 44 | $status = $client->getInternalResponse()->getStatus(); |
45 | 45 | $output->writeln("<info>[{$status}]</info>"); |
46 | 46 | |
47 | - if ($status != 200) return; |
|
47 | + if ($status != 200) { |
|
48 | + return; |
|
49 | + } |
|
48 | 50 | |
49 | 51 | $crawler->filter('#main-content div.forabg')->each( |
50 | 52 | function (Crawler $node, $index) use ($output, $entityManager, $entityBridge, $dialogHelper) |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | $crawler = $crawler->filter('#main-content ul.topics li.row'); |
70 | - $crawler->each(function (Crawler $node, $index) use ($output, $entityManager, $entityBridge, $client, $baseUrl, $forumId) |
|
70 | + $crawler->each(function(Crawler $node, $index) use ($output, $entityManager, $entityBridge, $client, $baseUrl, $forumId) |
|
71 | 71 | { |
72 | 72 | $link = $node->filter('dd.dterm a.topictitle'); |
73 | 73 | $topicId = intval(substr($link->attr('href'), 2, -6)); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | /** @var \Symfony\Component\DomCrawler\Crawler $crawler */ |
143 | - $crawler = $crawler->filter('#main-content div.post')->reduce(function (Crawler $node) |
|
143 | + $crawler = $crawler->filter('#main-content div.post')->reduce(function(Crawler $node) |
|
144 | 144 | { |
145 | 145 | return is_numeric(substr($node->attr('id'), 1)); |
146 | 146 | }); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $entityManager->persist($topic); |
152 | 152 | } |
153 | 153 | |
154 | - $crawler->each(function (Crawler $node) use ($output, $entityManager, $entityBridge, $forumId, $topicId) |
|
154 | + $crawler->each(function(Crawler $node) use ($output, $entityManager, $entityBridge, $forumId, $topicId) |
|
155 | 155 | { |
156 | 156 | $postId = substr($node->attr('id'), 1); |
157 | 157 |
@@ -74,8 +74,11 @@ discard block |
||
74 | 74 | $title = $link->text(); |
75 | 75 | |
76 | 76 | $link = $node->filter('dd.dterm span.span-tab a'); |
77 | - if ($link->count() == 1) $authorId = intval(substr($link->attr('href'), 2)); |
|
78 | - else $authorId = 0; |
|
77 | + if ($link->count() == 1) { |
|
78 | + $authorId = intval(substr($link->attr('href'), 2)); |
|
79 | + } else { |
|
80 | + $authorId = 0; |
|
81 | + } |
|
79 | 82 | |
80 | 83 | preg_match("/background-image:url\('(.+)'\);/iU", $node->filter('dl.icon')->attr('style'), $matches); |
81 | 84 | $matches = explode('/', $matches[1]); |
@@ -183,13 +186,17 @@ discard block |
||
183 | 186 | $entityManager->persist($post); |
184 | 187 | }); |
185 | 188 | |
186 | - if ($crawler->count() < ParseTopicsCommand::POSTS_PER_PAGE) break; |
|
189 | + if ($crawler->count() < ParseTopicsCommand::POSTS_PER_PAGE) { |
|
190 | + break; |
|
191 | + } |
|
187 | 192 | } |
188 | 193 | |
189 | 194 | $entityManager->flush(); |
190 | 195 | }); |
191 | 196 | |
192 | - if ($crawler->count() < static::TOPICS_PER_PAGE) break; |
|
197 | + if ($crawler->count() < static::TOPICS_PER_PAGE) { |
|
198 | + break; |
|
199 | + } |
|
193 | 200 | } |
194 | 201 | } |
195 | 202 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | $crawler = $crawler->filter('#memberlist tbody tr'); |
53 | - $crawler->each(function (Crawler $node) use ($output, $entityManager, $entityBridge, $dialogHelper) { |
|
53 | + $crawler->each(function(Crawler $node) use ($output, $entityManager, $entityBridge, $dialogHelper) { |
|
54 | 54 | $columns = $node->children(); |
55 | 55 | $id = substr($columns->eq(1)->filter('a')->attr('href'), 2); |
56 | 56 | $nickname = substr($columns->eq(1)->text(), 2); |
@@ -59,7 +59,9 @@ discard block |
||
59 | 59 | $memberName = $entity->getNickname(); |
60 | 60 | |
61 | 61 | $question = "<question>Member name doesn't match for #{$id} ({$memberName} → {$nickname}). Update entity? [Y/n]:</question> "; |
62 | - if (!empty($memberName) && $memberName != $nickname && !$dialogHelper->askConfirmation($output, $question)) return; |
|
62 | + if (!empty($memberName) && $memberName != $nickname && !$dialogHelper->askConfirmation($output, $question)) { |
|
63 | + return; |
|
64 | + } |
|
63 | 65 | |
64 | 66 | $regDate = \DateTime::createFromFormat('Y-m-d H:i:s', $columns->eq(3)->text() . ' 00:00:00'); |
65 | 67 | $avatarUrl = $columns->eq(1)->filter('a img')->attr('src'); |
@@ -77,7 +79,9 @@ discard block |
||
77 | 79 | |
78 | 80 | $entityManager->flush(); |
79 | 81 | |
80 | - if ($crawler->count() < static::USERS_PER_PAGE) break; |
|
82 | + if ($crawler->count() < static::USERS_PER_PAGE) { |
|
83 | + break; |
|
84 | + } |
|
81 | 85 | } |
82 | 86 | } |
83 | 87 | } |