@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function adapter($adapter) |
| 57 | 57 | {
|
| 58 | - if(!is_null($adapter)){
|
|
| 58 | + if (!is_null($adapter)) {
|
|
| 59 | 59 | $this->adapter = $adapter; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | {
|
| 73 | 73 | //name variable is |
| 74 | 74 | //the name of the cache data set to be created. |
| 75 | - if(!is_null($name)){
|
|
| 75 | + if (!is_null($name)) {
|
|
| 76 | 76 | $this->name = $name; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | {
|
| 90 | 90 | //Cache data is set at the time. |
| 91 | 91 | //Data will be valid in this time. |
| 92 | - if(is_numeric($expire)){
|
|
| 92 | + if (is_numeric($expire)) {
|
|
| 93 | 93 | $this->expire = $expire; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | {
|
| 109 | 109 | // this class has a macro that can be managed by the user. |
| 110 | 110 | // macros work as an extensible version of the classes. |
| 111 | - $macro = $this->app['macro']->with(config('kernel.macros.cache'),$this,$this->adapter);
|
|
| 111 | + $macro = $this->app['macro']->with(config('kernel.macros.cache'), $this, $this->adapter);
|
|
| 112 | 112 | |
| 113 | 113 | //set cache macroable object |
| 114 | 114 | $this->cache = $macro->{$this->adapter}($callback);
|
@@ -118,25 +118,25 @@ discard block |
||
| 118 | 118 | $backtrace = debug_backtrace()[1]; |
| 119 | 119 | |
| 120 | 120 | //If name is null, we name it with backtrace. |
| 121 | - if($this->name===null) {
|
|
| 121 | + if ($this->name===null) {
|
|
| 122 | 122 | $this->name = md5($backtrace['function'].'_'.$backtrace['class']); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | //this method may show continuity depending on the macro. |
| 126 | - if(false === $this instanceof $macro) return ; |
|
| 126 | + if (false===$this instanceof $macro) return; |
|
| 127 | 127 | |
| 128 | 128 | // retrieve the cache item |
| 129 | 129 | $cacheItem = $this->cache->getItem($this->name); |
| 130 | 130 | |
| 131 | 131 | if (!$cacheItem->isHit()) {
|
| 132 | 132 | |
| 133 | - $data=call_user_func($callback); |
|
| 133 | + $data = call_user_func($callback); |
|
| 134 | 134 | $cacheItem->set($data); |
| 135 | 135 | $this->cache->save($cacheItem); |
| 136 | 136 | return $data; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - $this->app->register('illuminator','cache',['name'=>$this->name]);
|
|
| 139 | + $this->app->register('illuminator', 'cache', ['name'=>$this->name]);
|
|
| 140 | 140 | |
| 141 | 141 | // retrieve the value stored by the item |
| 142 | 142 | return $cacheItem->get(); |