@@ -76,7 +76,7 @@ |
||
76 | 76 | { |
77 | 77 | if(method_exists($this->instance, $name)){ |
78 | 78 | return call_user_func_array([$this->instance, $name], $args); |
79 | - }else{ |
|
79 | + } else{ |
|
80 | 80 | throw new \BadMethodCallException(sprintf('Method %s does not exists', $name)); |
81 | 81 | } |
82 | 82 | } |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | try{ |
110 | 110 | self::$instances[ $instance ] = new $class($config); |
111 | 111 | self::$instances[ $instance ]->setEventManager(EventManager::getInstance()); |
112 | - }catch(phpFastCacheDriverCheckException $e){ |
|
112 | + } catch(phpFastCacheDriverCheckException $e){ |
|
113 | 113 | $fallback = self::standardizeDriverName($config['fallback']); |
114 | 114 | if($fallback && $fallback !== $driver){ |
115 | 115 | $class = self::getNamespacePath() . $fallback . '\Driver'; |
116 | 116 | self::$instances[ $instance ] = new $class($config); |
117 | 117 | self::$instances[ $instance ]->setEventManager(EventManager::getInstance()); |
118 | 118 | trigger_error(sprintf('The "%s" driver is unavailable at the moment, the fallback driver "%s" has been used instead.', $driver, $fallback), E_USER_WARNING); |
119 | - }else{ |
|
119 | + } else{ |
|
120 | 120 | throw new phpFastCacheDriverCheckException($e->getMessage(), $e->getCode(), $e); |
121 | 121 | } |
122 | 122 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | self::$config = array_merge(self::$config, $name); |
230 | 230 | } else if (is_string($name)){ |
231 | 231 | self::$config[ $name ] = $value; |
232 | - }else{ |
|
232 | + } else{ |
|
233 | 233 | throw new phpFastCacheInvalidArgumentException('Invalid variable type: $name'); |
234 | 234 | } |
235 | 235 | } |
@@ -88,13 +88,13 @@ |
||
88 | 88 | if(is_callable($arguments[0])){ |
89 | 89 | if(isset($arguments[1]) && is_string($arguments[0])){ |
90 | 90 | $this->events[$name][$arguments[1]] = $arguments[0]; |
91 | - }else { |
|
91 | + } else { |
|
92 | 92 | $this->events[$name][] = $arguments[0]; |
93 | 93 | } |
94 | - }else{ |
|
94 | + } else{ |
|
95 | 95 | throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', gettype($arguments[0]))); |
96 | 96 | } |
97 | - }else{ |
|
97 | + } else{ |
|
98 | 98 | throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"'); |
99 | 99 | } |
100 | 100 | } |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | return $full_path_tmp; |
96 | 96 | } |
97 | 97 | return $full_path; |
98 | - }else{ |
|
98 | + } else{ |
|
99 | 99 | if (!isset($this->tmp[ $full_path_hash ]) || (!@file_exists($full_path) || !@is_writable($full_path))) { |
100 | 100 | if (!@file_exists($full_path)) { |
101 | 101 | @mkdir($full_path, $this->getDefaultChmod(), true); |
102 | - }else if (!@is_writable($full_path)) { |
|
102 | + } else if (!@is_writable($full_path)) { |
|
103 | 103 | if (!@chmod($full_path, $this->getDefaultChmod()) && $this->config[ 'autoTmpFallback' ]) |
104 | 104 | { |
105 | 105 | /** |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | if(!rename($tmpFilename, $file)){ |
300 | 300 | throw new phpFastCacheIOException(sprintf('Failed to rename %s to %s', $tmpFilename, $file)); |
301 | 301 | } |
302 | - }else{ |
|
302 | + } else{ |
|
303 | 303 | $f = fopen($file, 'w+'); |
304 | 304 | $octetWritten = fwrite($f, $data); |
305 | 305 | fclose($f); |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $reflectionMethod = new \ReflectionMethod(get_class($instance), $method); |
57 | 57 | if($getterMethod){ |
58 | 58 | $return[ $instance->getDriverName() ] = $reflectionMethod->invokeArgs($instance, $args); |
59 | - }else{ |
|
59 | + } else{ |
|
60 | 60 | $result = $reflectionMethod->invokeArgs($instance, $args); |
61 | 61 | if($result !== false){ |
62 | 62 | $return = $result; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | if (is_readable($path)) { |
33 | 33 | require_once $path; |
34 | - }else{ |
|
34 | + } else{ |
|
35 | 35 | trigger_error('Cannot locate the Psr/Cache files', E_USER_ERROR); |
36 | 36 | } |
37 | 37 | return; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | if (is_readable($path)) { |
42 | 42 | require_once $path; |
43 | - }else{ |
|
43 | + } else{ |
|
44 | 44 | trigger_error('Cannot locate the Psr/SimpleCache files', E_USER_ERROR); |
45 | 45 | } |
46 | 46 | return; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | { |
73 | 73 | if(isset($this->config[$optionName])){ |
74 | 74 | return $this->config[$optionName]; |
75 | - }else{ |
|
75 | + } else{ |
|
76 | 76 | return null; |
77 | 77 | } |
78 | 78 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * reuse it else set a new Date |
150 | 150 | */ |
151 | 151 | $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime(); |
152 | - }else{ |
|
152 | + } else{ |
|
153 | 153 | $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null; |
154 | 154 | $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null; |
155 | 155 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if ($item instanceof Item) { |
72 | 72 | try{ |
73 | 73 | $this->instance->putDocument(['data' => $this->encode($this->driverPreWrap($item))], $item->getEncodedKey(), $this->getLatestDocumentRevision($item->getEncodedKey())); |
74 | - }catch (CouchDBException $e){ |
|
74 | + } catch (CouchDBException $e){ |
|
75 | 75 | throw new phpFastCacheDriverException('Got error while trying to upsert a document: ' . $e->getMessage(), null, $e); |
76 | 76 | } |
77 | 77 | return true; |
@@ -89,15 +89,15 @@ discard block |
||
89 | 89 | { |
90 | 90 | try{ |
91 | 91 | $response = $this->instance->findDocument($item->getEncodedKey()); |
92 | - }catch (CouchDBException $e){ |
|
92 | + } catch (CouchDBException $e){ |
|
93 | 93 | throw new phpFastCacheDriverException('Got error while trying to get a document: ' . $e->getMessage(), null, $e); |
94 | 94 | } |
95 | 95 | |
96 | 96 | if($response->status === 404 || empty($response->body['data'])){ |
97 | 97 | return null; |
98 | - }else if($response->status === 200){ |
|
98 | + } else if($response->status === 200){ |
|
99 | 99 | return $this->decode($response->body['data']); |
100 | - }else{ |
|
100 | + } else{ |
|
101 | 101 | throw new phpFastCacheDriverException('Got unexpected HTTP status: ' . $response->status); |
102 | 102 | } |
103 | 103 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if ($item instanceof Item) { |
117 | 117 | try{ |
118 | 118 | $this->instance->deleteDocument($item->getEncodedKey(), $this->getLatestDocumentRevision($item->getEncodedKey())); |
119 | - }catch (CouchDBException $e){ |
|
119 | + } catch (CouchDBException $e){ |
|
120 | 120 | throw new phpFastCacheDriverException('Got error while trying to delete a document: ' . $e->getMessage(), null, $e); |
121 | 121 | } |
122 | 122 | return true; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | try{ |
135 | 135 | $this->instance->deleteDatabase($this->getDatabaseName()); |
136 | 136 | $this->createDatabase(); |
137 | - }catch (CouchDBException $e){ |
|
137 | + } catch (CouchDBException $e){ |
|
138 | 138 | throw new phpFastCacheDriverException('Got error while trying to delete and recreate the database: ' . $e->getMessage(), null, $e); |
139 | 139 | } |
140 | 140 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | ); |
200 | 200 | if(!empty($response->headers['etag'])){ |
201 | 201 | return trim($response->headers['etag'], " '\"\t\n\r\0\x0B"); |
202 | - }else{ |
|
202 | + } else{ |
|
203 | 203 | return null; |
204 | 204 | } |
205 | 205 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | if(!$strtoupper){ |
113 | 113 | print trim($string) . PHP_EOL; |
114 | - }else{ |
|
114 | + } else{ |
|
115 | 115 | print strtoupper(trim($string) . PHP_EOL); |
116 | 116 | } |
117 | 117 | |
@@ -125,8 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | if (substr(php_uname(), 0, 7) === 'Windows'){ |
127 | 127 | pclose(popen('start /B '. $cmd, 'r')); |
128 | - } |
|
129 | - else { |
|
128 | + } else { |
|
130 | 129 | exec($cmd . ' > /dev/null &'); |
131 | 130 | } |
132 | 131 | } |