@@ -11,14 +11,14 @@ |
||
| 11 | 11 | * @link https://github.com/voidtek/windguru.io |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -require_once __DIR__ . "/vendor/autoload.php"; |
|
| 14 | +require_once __DIR__."/vendor/autoload.php"; |
|
| 15 | 15 | |
| 16 | 16 | use voidtek\WindguruIO\WindguruAPI; |
| 17 | 17 | |
| 18 | 18 | if (PHP_SAPI === 'cli') { |
| 19 | - $idspot = $argv[1]; |
|
| 19 | + $idspot = $argv[ 1 ]; |
|
| 20 | 20 | } else { |
| 21 | - $idspot = $_GET['idspot']; |
|
| 21 | + $idspot = $_GET[ 'idspot' ]; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | if (empty($idspot)) { |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @var string; |
| 38 | 38 | */ |
| 39 | - const ENDPOINT='https://www.windguru.cz'; |
|
| 40 | - const LOGFOLDER='logs'; |
|
| 41 | - const CACHEFOLDER='cache'; |
|
| 42 | - const CACHETIME=10*60; // secondes |
|
| 39 | + const ENDPOINT = 'https://www.windguru.cz'; |
|
| 40 | + const LOGFOLDER = 'logs'; |
|
| 41 | + const CACHEFOLDER = 'cache'; |
|
| 42 | + const CACHETIME = 10 * 60; // secondes |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Private Id of the Spot |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $this->_log = new Logger('WindguruAPI'); |
| 103 | 103 | $this->_log->pushHandler( |
| 104 | 104 | new StreamHandler( |
| 105 | - self::LOGFOLDER . '/' . date('Ymd') . '.log', |
|
| 105 | + self::LOGFOLDER.'/'.date('Ymd').'.log', |
|
| 106 | 106 | Logger::WARNING |
| 107 | 107 | ) |
| 108 | 108 | ); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $this->_data = $xml; |
| 200 | 200 | $this->_setCacheData(); |
| 201 | 201 | |
| 202 | - $this->_log->warning($this->_idSpot . ": Load online data."); |
|
| 202 | + $this->_log->warning($this->_idSpot.": Load online data."); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -212,8 +212,8 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | private function _extractVariableIntoScript($script, $variable) |
| 214 | 214 | { |
| 215 | - preg_match('/var ' . $variable . ' = (.*);/', $script, $m); |
|
| 216 | - return $m[1]; |
|
| 215 | + preg_match('/var '.$variable.' = (.*);/', $script, $m); |
|
| 216 | + return $m[ 1 ]; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | { |
| 241 | 241 | $current = file_get_contents(self::CACHEFOLDER.'/'.$this->_idSpot); |
| 242 | 242 | $xml = new \SimpleXMLElement($current); |
| 243 | - if (time() - $xml['updated'] <= self::CACHETIME) { |
|
| 243 | + if (time() - $xml[ 'updated' ] <= self::CACHETIME) { |
|
| 244 | 244 | $this->_data = $xml; |
| 245 | - $this->_log->warning($this->_idSpot . ": Load cache data."); |
|
| 245 | + $this->_log->warning($this->_idSpot.": Load cache data."); |
|
| 246 | 246 | } else { |
| 247 | 247 | $this->_getOnlineData(); |
| 248 | 248 | } |