mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-07-31 05:40:24 +02:00
[phpcs] Add missing rules
- Do not add spaces after opening or before closing parenthesis // Wrong if( !is_null($var) ) { ... } // Right if(!is_null($var)) { ... } - Add space after closing parenthesis // Wrong if(true){ ... } // Right if(true) { ... } - Add body into new line - Close body in new line // Wrong if(true) { ... } // Right if(true) { ... } Notice: Spaces after keywords are not detected: // Wrong (not detected) // -> space after 'if' and missing space after 'else' if (true) { ... } else{ ... } // Right if(true) { ... } else { ... }
This commit is contained in:
@@ -25,7 +25,7 @@ class FileCache implements CacheInterface {
|
||||
|
||||
public function getTime(){
|
||||
$cacheFile = $this->getCacheFile();
|
||||
if(file_exists($cacheFile)){
|
||||
if(file_exists($cacheFile)) {
|
||||
return filemtime($cacheFile);
|
||||
}
|
||||
|
||||
@@ -34,16 +34,16 @@ class FileCache implements CacheInterface {
|
||||
|
||||
public function purgeCache($duration){
|
||||
$cachePath = $this->getPath();
|
||||
if(file_exists($cachePath)){
|
||||
if(file_exists($cachePath)) {
|
||||
$cacheIterator = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($cachePath),
|
||||
RecursiveIteratorIterator::CHILD_FIRST
|
||||
);
|
||||
|
||||
foreach($cacheIterator as $cacheFile){
|
||||
foreach($cacheIterator as $cacheFile) {
|
||||
if(in_array($cacheFile->getBasename(), array('.', '..', '.gitkeep')))
|
||||
continue;
|
||||
elseif($cacheFile->isFile()){
|
||||
elseif($cacheFile->isFile()) {
|
||||
if(filemtime($cacheFile->getPathname()) < time() - $duration)
|
||||
unlink($cacheFile->getPathname());
|
||||
}
|
||||
@@ -56,7 +56,7 @@ class FileCache implements CacheInterface {
|
||||
* @return self
|
||||
*/
|
||||
public function setPath($path){
|
||||
if(is_null($path) || !is_string($path)){
|
||||
if(is_null($path) || !is_string($path)) {
|
||||
throw new \Exception('The given path is invalid!');
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class FileCache implements CacheInterface {
|
||||
* @return string Cache path
|
||||
*/
|
||||
protected function getPath(){
|
||||
if(is_null($this->path)){
|
||||
if(is_null($this->path)) {
|
||||
throw new \Exception('Call "setPath" first!');
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ class FileCache implements CacheInterface {
|
||||
* return string
|
||||
*/
|
||||
protected function getCacheName(){
|
||||
if(is_null($this->param)){
|
||||
if(is_null($this->param)) {
|
||||
throw new \Exception('Call "setParameters" first!');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user