Completed
Branch master (34dfe2)
by Jakub
06:35
created
src/Bridges/NetteDI/RssExtension.php 2 patches
Unused Use Statements   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@
 block discarded – undo
3 3
 
4 4
 namespace Nexendrie\Rss\Bridges\NetteDI;
5 5
 
6
-use Nette\DI\CompilerExtension,
7
-    Nette\Utils\Validators,
8
-    Nexendrie\Rss\Generator;
6
+use Nette\DI\CompilerExtension;
7
+use Nette\Utils\Validators;
8
+use Nexendrie\Rss\Generator;
9 9
 
10 10
 /**
11 11
  * RssExtension for Nette DI Container
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Rss\Bridges\NetteDI;
5 5
 
Please login to merge, or discard this patch.
src/RssResponse.php 2 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 
4 4
 namespace Nexendrie\Rss;
5 5
 
6
-use Nette\Http\IRequest,
7
-    Nette\Http\IResponse;
6
+use Nette\Http\IRequest;
7
+use Nette\Http\IResponse;
8 8
 
9 9
 /**
10 10
  * RSS channel response
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Rss;
5 5
 
Please login to merge, or discard this patch.
src/Generator.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Rss;
5 5
 
@@ -130,37 +130,37 @@  discard block
 block discarded – undo
130 130
    * @throws \InvalidArgumentException
131 131
    */
132 132
   function generate(): \SimpleXMLElement {
133
-    if(is_null($this->dataSource)) {
133
+    if (is_null($this->dataSource)) {
134 134
       throw new InvalidStateException("Data source for RSS generator is not set.");
135 135
     }
136 136
     $items = call_user_func($this->dataSource);
137
-    if(!$items instanceof Collection) {
137
+    if (!$items instanceof Collection) {
138 138
       throw new \InvalidArgumentException("Callback for data source for RSS generator has to return " . Collection::class . ".");
139 139
     }
140 140
     $channel = simplexml_load_file(__DIR__ . "/template.xml");
141
-    if($this->link) {
141
+    if ($this->link) {
142 142
       $channel->channel->link[0][0] = $this->link;
143 143
     }
144 144
     $lastBuildDate = call_user_func($this->lastBuildDate);
145
-    if(!is_int($lastBuildDate)) {
145
+    if (!is_int($lastBuildDate)) {
146 146
       throw new \InvalidArgumentException("Callback for last build date for RSS generator has to return integer.");
147 147
     }
148 148
     $channel->channel->lastBuildDate[0][0] = date($this->dateTimeFormat, $lastBuildDate);
149
-    if($this->title) {
149
+    if ($this->title) {
150 150
       $channel->channel->title[0][0] = $this->title;
151 151
     }
152
-    if($this->description) {
152
+    if ($this->description) {
153 153
       $channel->channel->description[0][0] = $this->description;
154 154
     }
155 155
     /** @var RssChannelItem $item */
156
-    foreach($items as $item) {
156
+    foreach ($items as $item) {
157 157
       /** @var \SimpleXMLElement $i */
158 158
       $i = $channel->channel->addChild("item");
159 159
       $i->addChild("title", $item->title);
160 160
       $i->addChild("link", $item->link);
161 161
       $i->addChild("pubDate", $item->pubDate);
162 162
       $description = ($this->shortenDescription) ? substr($item->description, 0, $this->shortenDescription) : $item->description;
163
-      if($description !== $item->description) {
163
+      if ($description !== $item->description) {
164 164
         $description .= "...";
165 165
       }
166 166
       $i->addChild("description", $description);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
   function response(): RssResponse {
177 177
     try {
178 178
       return new RssResponse($this->generate());
179
-    } catch(InvalidStateException | \InvalidArgumentException $e) {
179
+    } catch (InvalidStateException | \InvalidArgumentException $e) {
180 180
       throw $e;
181 181
     }
182 182
   }
Please login to merge, or discard this patch.
src/Collection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Rss;
5 5
 
Please login to merge, or discard this patch.
src/RssChannelItem.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Rss;
5 5
 
Please login to merge, or discard this patch.