Completed
Push — master ( e0ef7b...b19794 )
by Chris
02:06
created
src/Fillet/Parser/WordpressExport.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      * Parses a specific XML file
14 14
      *
15 15
      * @param string $inputFile File to parse
16
-     * @return \Generator
16
+     * @return \Iterator
17 17
      */
18 18
     public function parse($inputFile)
19 19
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
         while ($reader->read() && $reader->name !== 'item');
27 27
 
28
-        while($reader->name == 'item') {
28
+        while ($reader->name == 'item') {
29 29
             $xml = simplexml_import_dom($dom->importNode($reader->expand(), true));
30 30
             $wpItems = $xml->children($WPNamespace);
31 31
             $content = $xml->children($DCNamespace)->encoded;
@@ -33,17 +33,17 @@  discard block
 block discarded – undo
33 33
             $categories = [];
34 34
             $tags = [];
35 35
 
36
-            foreach($xml->category as $category) {
37
-                if('category' == $category->attributes()->domain) {
36
+            foreach ($xml->category as $category) {
37
+                if ('category' == $category->attributes()->domain) {
38 38
                     $categories[] = (string)$category;
39 39
                 }
40 40
 
41
-                if('post_tag' == $category->attributes()->domain) {
41
+                if ('post_tag' == $category->attributes()->domain) {
42 42
                     $tags[] = (string)$category;
43 43
                 }
44 44
             }
45 45
 
46
-            if($wpItems) {
46
+            if ($wpItems) {
47 47
                 $post_type = (string)$wpItems->post_type;
48 48
                 $data = [
49 49
                     'type' => $post_type,
Please login to merge, or discard this patch.
src/Fillet/Fillet.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,10 +52,10 @@
 block discarded – undo
52 52
      */
53 53
     public function parse()
54 54
     {
55
-        foreach($this->parser->parse($this->inputFile) as $item) {
55
+        foreach ($this->parser->parse($this->inputFile) as $item) {
56 56
             $writer = WriterFactory::create($item['type'], $this->config);
57 57
 
58
-            if($writer) {
58
+            if ($writer) {
59 59
                 $writer->write($item);
60 60
             }
61 61
         }
Please login to merge, or discard this patch.
src/Fillet/Parser/ParserFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
     public static function create($class)
21 21
     {
22 22
         $className = 'Fillet\\Parser\\' . ucfirst($class);
23
-        if(class_exists($className)) {
23
+        if (class_exists($className)) {
24 24
             /** @var ParserInterface $parser */
25 25
             $parser = new $className();
26 26
             return $parser;
Please login to merge, or discard this patch.
src/Fillet/Writer/PageWriter.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@
 block discarded – undo
22 22
         $filename = $this->generateSlug($data['title']);
23 23
 
24 24
         $headerData = [
25
-			'title' => $data['title'],
26
-			'date' => $post_date_string,
27
-			'layout' => 'page',
28
-			'slug' => $filename,
29
-		];
25
+            'title' => $data['title'],
26
+            'date' => $post_date_string,
27
+            'layout' => 'page',
28
+            'slug' => $filename,
29
+        ];
30 30
 
31
-		$dumper = new YamlDumper();
32
-		$header = '---' . PHP_EOL . $dumper->dump($headerData, 2) . '---' . PHP_EOL;
31
+        $dumper = new YamlDumper();
32
+        $header = '---' . PHP_EOL . $dumper->dump($headerData, 2) . '---' . PHP_EOL;
33 33
         
34 34
         $filename = $this->destinationFolder . '/' . $filename;
35 35
         if ($this->isMarkdownEnabled()) {
Please login to merge, or discard this patch.
src/Fillet/Writer/PostWriter.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,28 +11,28 @@
 block discarded – undo
11 11
  */
12 12
 class PostWriter extends AbstractWriter
13 13
 {
14
-	/**
15
-	 * Write out a set of data into a file
16
-	 *
17
-	 * @param array $data Data to use for constructing the page
18
-	 */
14
+    /**
15
+     * Write out a set of data into a file
16
+     *
17
+     * @param array $data Data to use for constructing the page
18
+     */
19 19
     public function write($data)
20 20
     {
21 21
         $post_date_string = $data['post_date']->format('Y-m-d H:i:s');
22 22
         $slug = $this->generateSlug($data['title']);
23 23
         $filename = $data['post_date']->format('Y-m-d') . '-' . $slug;
24 24
 
25
-		$headerData = [
26
-			'title' => $data['title'],
27
-			'date' => $post_date_string,
28
-			'layout' => 'post',
29
-			'slug' => $slug,
30
-			'categories' => $data['categories'],
31
-			'tags' => $data['tags'],
32
-		];
25
+        $headerData = [
26
+            'title' => $data['title'],
27
+            'date' => $post_date_string,
28
+            'layout' => 'post',
29
+            'slug' => $slug,
30
+            'categories' => $data['categories'],
31
+            'tags' => $data['tags'],
32
+        ];
33 33
 
34
-		$dumper = new YamlDumper();
35
-		$header = '---' . PHP_EOL . $dumper->dump($headerData, 2) . '---' . PHP_EOL;
34
+        $dumper = new YamlDumper();
35
+        $header = '---' . PHP_EOL . $dumper->dump($headerData, 2) . '---' . PHP_EOL;
36 36
 
37 37
         $filename = $this->destinationFolder . $filename;
38 38
         if ($this->isMarkdownEnabled()) {
Please login to merge, or discard this patch.
src/Fillet/Writer/WriterFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@
 block discarded – undo
22 22
     public static function create($postType, $config, $throwExceptionOnInvalidWriter = false)
23 23
     {
24 24
         $className = 'Fillet\\Writer\\' . ucfirst($postType) . 'Writer';
25
-        if(class_exists($className)) {
25
+        if (class_exists($className)) {
26 26
             /** @var WriterInterface $writer */
27 27
             $writer = new $className($config['destinationFolders'][$postType], $config);
28 28
             return $writer;
29 29
         }
30 30
 
31
-        if($throwExceptionOnInvalidWriter) {
31
+        if ($throwExceptionOnInvalidWriter) {
32 32
             throw new \Exception('There is no writer for ' . $postType);
33 33
         }
34 34
     }
Please login to merge, or discard this patch.