@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | if(!extension_loaded('gd')) die('GD ext is required to run this!'); |
| 4 | 4 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | private $className; |
| 10 | 10 | |
| 11 | 11 | public function __construct() { |
| 12 | - if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3){ |
|
| 12 | + if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3) { |
|
| 13 | 13 | $this->baseURL = rtrim($_SERVER['argv'][1], '/'); |
| 14 | 14 | $this->className = $_SERVER['argv'][2]; |
| 15 | 15 | |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | //Update @updated |
| 94 | 94 | $currentDate = date("Y-m-d", time()); |
| 95 | - $baseFile = str_replace("@updated {$matches[1]}","@updated {$currentDate}", $baseFile); |
|
| 95 | + $baseFile = str_replace("@updated {$matches[1]}", "@updated {$currentDate}", $baseFile); |
|
| 96 | 96 | |
| 97 | 97 | //Update @version |
| 98 | 98 | $currentVersion = explode('.', $matches[2]); |
| 99 | - $newVersion = "{$currentVersion[0]}.{$currentVersion[1]}.". (((int) $currentVersion[2]) + 1); |
|
| 100 | - $baseFile = str_replace("@version {$matches[2]}","@version {$newVersion}", $baseFile); |
|
| 99 | + $newVersion = "{$currentVersion[0]}.{$currentVersion[1]}.".(((int) $currentVersion[2]) + 1); |
|
| 100 | + $baseFile = str_replace("@version {$matches[2]}", "@version {$newVersion}", $baseFile); |
|
| 101 | 101 | |
| 102 | 102 | //Add site |
| 103 | 103 | $siteData = <<<EOT |
@@ -1,6 +1,8 @@ discard block |
||
| 1 | 1 | <?php declare(strict_types=1); |
| 2 | 2 | |
| 3 | -if(!extension_loaded('gd')) die('GD ext is required to run this!'); |
|
| 3 | +if(!extension_loaded('gd')) { |
|
| 4 | + die('GD ext is required to run this!'); |
|
| 5 | +} |
|
| 4 | 6 | |
| 5 | 7 | chdir(dirname(__FILE__).'/../'); //Just to make things easier, change dir to project root. |
| 6 | 8 | |
@@ -9,7 +11,7 @@ discard block |
||
| 9 | 11 | private $className; |
| 10 | 12 | |
| 11 | 13 | public function __construct() { |
| 12 | - if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3){ |
|
| 14 | + if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3) { |
|
| 13 | 15 | $this->baseURL = rtrim($_SERVER['argv'][1], '/'); |
| 14 | 16 | $this->className = $_SERVER['argv'][2]; |
| 15 | 17 | |
@@ -82,7 +84,9 @@ discard block |
||
| 82 | 84 | $baseFile = file_get_contents('./public/userscripts/manga-tracker.user.js'); |
| 83 | 85 | |
| 84 | 86 | $parse = parse_url($this->baseURL); |
| 85 | - if(strpos($baseFile, $parse['host']) !== false) die("Domain already exists in userscript?"); |
|
| 87 | + if(strpos($baseFile, $parse['host']) !== false) { |
|
| 88 | + die("Domain already exists in userscript?"); |
|
| 89 | + } |
|
| 86 | 90 | |
| 87 | 91 | preg_match('/\@updated ([0-9\-]+)\r.*?\@version ([0-9\.]+)/s', $baseFile, $matches); |
| 88 | 92 | |
@@ -179,7 +183,9 @@ discard block |
||
| 179 | 183 | } |
| 180 | 184 | } |
| 181 | 185 | |
| 182 | - if(empty($titleArr)) die("API isn't returning any titles?"); |
|
| 186 | + if(empty($titleArr)) { |
|
| 187 | + die("API isn't returning any titles?"); |
|
| 188 | + } |
|
| 183 | 189 | return $titleArr; |
| 184 | 190 | } |
| 185 | 191 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | //Replace class names |
| 60 | 60 | $baseFile = str_replace('class HelveticaScans', "class {$this->className}", $baseFile); |
| 61 | - $baseFile = str_replace('coversDefaultClass HelveticaScans', "coversDefaultClass {$this->className}", $baseFile); |
|
| 61 | + $baseFile = str_replace('coversDefaultClass HelveticaScans', "coversdefaultclass {$this->className}", $baseFile); |
|
| 62 | 62 | |
| 63 | 63 | //Replace tests |
| 64 | 64 | $titleList = $this->getTitles(); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $baseFile = file_get_contents('./public/userscripts/manga-tracker.user.js'); |
| 83 | 83 | |
| 84 | 84 | $parse = parse_url($this->baseURL); |
| 85 | - if(strpos($baseFile, $parse['host']) !== false) die("Domain already exists in userscript?"); |
|
| 85 | + if(strpos($baseFile, $parse['host']) !== FALSE) die("Domain already exists in userscript?"); |
|
| 86 | 86 | |
| 87 | 87 | preg_match('/\@updated ([0-9\-]+)\r.*?\@version ([0-9\.]+)/s', $baseFile, $matches); |
| 88 | 88 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | }), |
| 114 | 114 | |
| 115 | 115 | //Tracking site |
| 116 | -EOT; |
|
| 116 | +eot; |
|
| 117 | 117 | $baseFile = str_replace(' //Tracking site', $siteData, $baseFile); |
| 118 | 118 | |
| 119 | 119 | file_put_contents('./public/userscripts/manga-tracker.user.js', $baseFile); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | ## [{$date}] |
| 147 | 147 | ### Added |
| 148 | 148 | - Support for {$this->className}. |
| 149 | -EOT; |
|
| 149 | +eot; |
|
| 150 | 150 | $changelogFile = str_replace('All notable changes to this project will be documented in this file.', "All notable changes to this project will be documented in this file.\r\n\r\n{$log}", $changelogFile); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | $ch = curl_init("{$this->baseURL}/api/reader/chapters/orderby/desc_created/format/json"); |
| 160 | 160 | |
| 161 | - curl_setopt($ch, CURLOPT_NOBODY, true); |
|
| 161 | + curl_setopt($ch, CURLOPT_NOBODY, TRUE); |
|
| 162 | 162 | curl_exec($ch); |
| 163 | 163 | $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
| 164 | 164 | curl_close($ch); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | if($content = file_get_contents($jsonURL)) { |
| 173 | 173 | $json = json_decode($content, TRUE); |
| 174 | 174 | shuffle($json['comics']); |
| 175 | - $comics = array_slice($json['comics'], 0, 5, true); |
|
| 175 | + $comics = array_slice($json['comics'], 0, 5, TRUE); |
|
| 176 | 176 | |
| 177 | 177 | foreach($comics as $comic) { |
| 178 | 178 | $titleArr[$comic['stub']] = $comic['name']; |
@@ -53,7 +53,8 @@ |
||
| 53 | 53 | $this->session->keep_flashdata('referred_from'); |
| 54 | 54 | if($prevURL = $this->session->flashdata('referred_from')) { |
| 55 | 55 | redirect($prevURL); |
| 56 | - } else { //@codeCoverageIgnore |
|
| 56 | + } else { |
|
| 57 | +//@codeCoverageIgnore |
|
| 57 | 58 | redirect('/'); //TODO (CHECK): Should this be refresh? |
| 58 | 59 | } //@codeCoverageIgnore |
| 59 | 60 | } else { |