Passed
Push — feature/super-model ( 24c950...13c8a0 )
by axel
02:30
created
src/MalScraper/Model/General/ProducerModel.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      *
23 23
      * @var string|int
24 24
      */
25
-	private $_id;
25
+    private $_id;
26 26
 
27 27
     /**
28 28
      * Page number.
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
      *
40 40
      * @return void
41 41
      */
42
-	public function __construct($type, $id, $page = 1, $parserArea = '#content .js-categories-seasonal')
42
+    public function __construct($type, $id, $page = 1, $parserArea = '#content .js-categories-seasonal')
43 43
     {
44 44
         $this->_type = $type;
45 45
         $this->_id = $id;
46
-    	$this->_page = $page;
46
+        $this->_page = $page;
47 47
         if ($type == 'anime') {
48 48
             $this->_url = $this->_myAnimeListUrl.'/anime/producer/'.$id.'/?page='.$page;
49 49
         } else {
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,8 +64,9 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function __call($method, $arguments)
66 66
     {
67
-        if ($this->_error)
68
-            return $this->_error;
67
+        if ($this->_error) {
68
+                    return $this->_error;
69
+        }
69 70
         return call_user_func_array([$this, $method], $arguments);
70 71
     }
71 72
 
@@ -141,8 +142,9 @@  discard block
 block discarded – undo
141 142
     {
142 143
         $prod_id = $each_producer->href;
143 144
         $prod_id = explode('/', $prod_id);
144
-        if ($this->_type == 'anime')
145
-            return $prod_id[3];
145
+        if ($this->_type == 'anime') {
146
+                    return $prod_id[3];
147
+        }
146 148
         return $prod_id[4];
147 149
     }
148 150
 
Please login to merge, or discard this patch.
src/MalScraper/Model/MainModel.php 3 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class MainModel
16 16
 {
17
-	/**
17
+    /**
18 18
      * MyAnimeList main URL
19 19
      *
20 20
      * @var string
21 21
      */
22
-	protected $_myAnimeListUrl = 'https://myanimelist.net';
22
+    protected $_myAnimeListUrl = 'https://myanimelist.net';
23 23
 
24
-	/**
24
+    /**
25 25
      * Trimmed HtmlDomParser.
26 26
      *
27 27
      * @var \simplehtmldom_1_5\simple_html_dom
28 28
      */
29
-	protected $_parser;
29
+    protected $_parser;
30 30
 
31
-	/**
31
+    /**
32 32
      * Area to be parsed.
33 33
      *
34 34
      * @var string
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
      *
57 57
      * @return int
58 58
      */
59
-	static function getHeader($url)
60
-	{
61
-		$file_headers = @get_headers($url);
62
-	    if (empty($file_headers) || $file_headers[0] == 'HTTP/1.1 404 Not Found') {
63
-	        return 404;
64
-	    }
65
-	    return 200;
66
-	}
59
+    static function getHeader($url)
60
+    {
61
+        $file_headers = @get_headers($url);
62
+        if (empty($file_headers) || $file_headers[0] == 'HTTP/1.1 404 Not Found') {
63
+            return 404;
64
+        }
65
+        return 200;
66
+    }
67 67
 
68 68
     /**
69 69
      * Get trimmed HtmlDomParser class.
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
      *
74 74
      * @return \simplehtmldom_1_5\simple_html_dom
75 75
      */
76
-	static function getParser($url,$contentDiv, $additionalSetting = false)
77
-	{
78
-		$html = HtmlDomParser::file_get_html($url)->find($contentDiv, 0);
79
-		$html = !$additionalSetting ? $html : $html->next_sibling();
80
-		$html = $html->outertext;
81
-	    $html = str_replace('"', '\"', $html);
82
-	    $html = html_entity_decode($html, ENT_QUOTES, 'UTF-8');
83
-	    $html = HtmlDomParser::str_get_html($html);
84
-
85
-    	return $html;
86
-	}
76
+    static function getParser($url,$contentDiv, $additionalSetting = false)
77
+    {
78
+        $html = HtmlDomParser::file_get_html($url)->find($contentDiv, 0);
79
+        $html = !$additionalSetting ? $html : $html->next_sibling();
80
+        $html = $html->outertext;
81
+        $html = str_replace('"', '\"', $html);
82
+        $html = html_entity_decode($html, ENT_QUOTES, 'UTF-8');
83
+        $html = HtmlDomParser::str_get_html($html);
84
+
85
+        return $html;
86
+    }
87 87
 
88 88
     /**
89 89
      * Header error check.
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
     {
97 97
         $header = self::getHeader($model->_url);
98 98
         if ($header == 200) {
99
-        	$className = self::getCleanClassName($model);
100
-        	$additionalSetting = ($className == 'CharacterPictureModel') || ($className == 'PeoplePictureModel');
99
+            $className = self::getCleanClassName($model);
100
+            $additionalSetting = ($className == 'CharacterPictureModel') || ($className == 'PeoplePictureModel');
101 101
             $model->_parser = self::getParser(self::getAbsoluteUrl($model), $model->_parserArea, $additionalSetting);
102 102
         } else {
103 103
             $model->_error = $header;
@@ -113,32 +113,32 @@  discard block
 block discarded – undo
113 113
      */
114 114
     static function getAbsoluteUrl($model)
115 115
     {
116
-    	$className = self::getCleanClassName($model);
117
-    	$additionalUrl = '';
118
-
119
-    	switch ($className) {
120
-    		case 'CharacterStaffModel':
121
-    			$area = 'li a[href$=characters]';
122
-    			break;
123
-    		case 'StatModel':
124
-    			$area = 'li a[href$=stats]';
125
-    			$additionalUrl = '?m=all&show=1';
126
-    			break;
127
-    		case 'PictureModel':
128
-    			$area = 'li a[href$=pics]';
129
-    			break;
130
-    		case 'CharacterPictureModel':
131
-    		case 'PeoplePictureModel':
132
-    			$area = 'li a[href$=pictures]';
133
-    			break;
134
-    		default:
135
-    			return $model->_url;
136
-    	}
137
-
138
-    	$html = HtmlDomParser::file_get_html($model->_url)->find($area, 0)->href;
139
-
140
-    	if ($model->getType() == 'manga')
141
-    		return 'https://myanimelist.net'.$html.$additionalUrl;
116
+        $className = self::getCleanClassName($model);
117
+        $additionalUrl = '';
118
+
119
+        switch ($className) {
120
+            case 'CharacterStaffModel':
121
+                $area = 'li a[href$=characters]';
122
+                break;
123
+            case 'StatModel':
124
+                $area = 'li a[href$=stats]';
125
+                $additionalUrl = '?m=all&show=1';
126
+                break;
127
+            case 'PictureModel':
128
+                $area = 'li a[href$=pics]';
129
+                break;
130
+            case 'CharacterPictureModel':
131
+            case 'PeoplePictureModel':
132
+                $area = 'li a[href$=pictures]';
133
+                break;
134
+            default:
135
+                return $model->_url;
136
+        }
137
+
138
+        $html = HtmlDomParser::file_get_html($model->_url)->find($area, 0)->href;
139
+
140
+        if ($model->getType() == 'manga')
141
+            return 'https://myanimelist.net'.$html.$additionalUrl;
142 142
         return $html.$additionalUrl;
143 143
     }
144 144
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      *
74 74
      * @return \simplehtmldom_1_5\simple_html_dom
75 75
      */
76
-	static function getParser($url,$contentDiv, $additionalSetting = false)
76
+	static function getParser($url, $contentDiv, $additionalSetting = false)
77 77
 	{
78 78
 		$html = HtmlDomParser::file_get_html($url)->find($contentDiv, 0);
79 79
 		$html = !$additionalSetting ? $html : $html->next_sibling();
@@ -153,6 +153,6 @@  discard block
 block discarded – undo
153 153
     {
154 154
         $className = get_class($model);
155 155
         $className = explode('\\', $className);
156
-        return $className[count($className)-1];
156
+        return $className[count($className) - 1];
157 157
     }
158 158
 }
159 159
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -137,8 +137,9 @@
 block discarded – undo
137 137
 
138 138
     	$html = HtmlDomParser::file_get_html($model->_url)->find($area, 0)->href;
139 139
 
140
-    	if ($model->getType() == 'manga')
141
-    		return 'https://myanimelist.net'.$html.$additionalUrl;
140
+    	if ($model->getType() == 'manga') {
141
+    	    		return 'https://myanimelist.net'.$html.$additionalUrl;
142
+    	}
142 143
         return $html.$additionalUrl;
143 144
     }
144 145
 
Please login to merge, or discard this patch.