@@ -1,11 +1,8 @@ |
||
| 1 | 1 | <?php namespace jlourenco\support\Commands; |
| 2 | 2 | |
| 3 | -use Illuminate\Console\Command; |
|
| 4 | -use Symfony\Component\Console\Input\InputOption; |
|
| 5 | -use Symfony\Component\Console\Input\InputArgument; |
|
| 6 | -use File; |
|
| 7 | -use jlourenco\support\Helpers\FileLoader; |
|
| 8 | -use Setting; |
|
| 3 | +use Illuminate\Console\Command; |
|
| 4 | +use File; |
|
| 5 | +use Setting; |
|
| 9 | 6 | use Schema; |
| 10 | 7 | |
| 11 | 8 | class SetupCommand extends Command {
|
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | /** |
| 85 | 85 | * Set the path to the file to use |
| 86 | 86 | * @param string $path The path to the file |
| 87 | - * @return \Philf\Setting\Setting |
|
| 87 | + * @return Setting |
|
| 88 | 88 | */ |
| 89 | 89 | public function path($path) |
| 90 | 90 | { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | /** |
| 95 | 95 | * Set the filename to use |
| 96 | 96 | * @param string $filename The filename |
| 97 | - * @return \Philf\Setting\Setting |
|
| 97 | + * @return Setting |
|
| 98 | 98 | */ |
| 99 | 99 | public function filename($filename) |
| 100 | 100 | { |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * Load the file in to $this->settings so values can be used immediately |
| 166 | 166 | * @param string $path The path to be used |
| 167 | 167 | * @param string $filename The filename to be used |
| 168 | - * @return \Philf\Setting\Setting |
|
| 168 | + * @return Setting |
|
| 169 | 169 | */ |
| 170 | 170 | public function load($path = null, $filename = null) |
| 171 | 171 | { |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | return $this->settings; |
| 115 | 115 | } |
| 116 | 116 | $ts = microtime(true); |
| 117 | - if($ts !== array_get($this->settings, $key, $ts)) |
|
| 117 | + if ($ts !== array_get($this->settings, $key, $ts)) |
|
| 118 | 118 | { |
| 119 | 119 | return array_get($this->settings, $key); |
| 120 | 120 | } |
| 121 | - if ( ! is_null($this->fallback) and $this->fallback->fallbackHas($key)) |
|
| 121 | + if (!is_null($this->fallback) and $this->fallback->fallbackHas($key)) |
|
| 122 | 122 | { |
| 123 | 123 | return $this->fallback->fallbackGet($key, $default); |
| 124 | 124 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function set($key, $value) |
| 134 | 134 | { |
| 135 | - array_set($this->settings,$key,$value); |
|
| 135 | + array_set($this->settings, $key, $value); |
|
| 136 | 136 | $this->save($this->path, $this->filename); |
| 137 | 137 | $this->load($this->path, $this->filename); |
| 138 | 138 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public function forget($deleteKey) |
| 145 | 145 | { |
| 146 | - array_forget($this->settings,$deleteKey); |
|
| 146 | + array_forget($this->settings, $deleteKey); |
|
| 147 | 147 | $this->save($this->path, $this->filename); |
| 148 | 148 | $this->load($this->path, $this->filename); |
| 149 | 149 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | public function has($searchKey) |
| 156 | 156 | { |
| 157 | 157 | $default = microtime(true); |
| 158 | - if($default == array_get($this->settings, $searchKey, $default) and !is_null($this->fallback)) |
|
| 158 | + if ($default == array_get($this->settings, $searchKey, $default) and !is_null($this->fallback)) |
|
| 159 | 159 | { |
| 160 | 160 | return $this->fallback->fallbackHas($searchKey); |
| 161 | 161 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | { |
| 192 | 192 | $this->path = isset($path) ? $path : $this->path; |
| 193 | 193 | $this->filename = isset($filename) ? $filename : $this->filename; |
| 194 | - if ( ! file_exists($this->path)) |
|
| 194 | + if (!file_exists($this->path)) |
|
| 195 | 195 | { |
| 196 | 196 | mkdir($this->path, 0755, true); |
| 197 | 197 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | { |
| 217 | 217 | foreach ($data as $key => $value) |
| 218 | 218 | { |
| 219 | - array_set($this->settings,$key,$value); |
|
| 219 | + array_set($this->settings, $key, $value); |
|
| 220 | 220 | } |
| 221 | 221 | $this->save($this->path, $this->filename); |
| 222 | 222 | $this->load($this->path, $this->filename); |
@@ -174,8 +174,7 @@ |
||
| 174 | 174 | if (is_file($this->path.'/'.$this->filename)) |
| 175 | 175 | { |
| 176 | 176 | $this->settings = json_decode(file_get_contents($this->path.'/'.$this->filename), true); |
| 177 | - } |
|
| 178 | - else |
|
| 177 | + } else |
|
| 179 | 178 | { |
| 180 | 179 | $this->settings = array(); |
| 181 | 180 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | { |
| 50 | 50 | // Publish a config file |
| 51 | 51 | $this->publishes([ |
| 52 | - __DIR__ . '/config' => base_path('/config') |
|
| 52 | + __DIR__.'/config' => base_path('/config') |
|
| 53 | 53 | ], 'config'); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | protected function registerSetting() |
| 109 | 109 | { |
| 110 | - $this->app->singleton('setting', function ($app) { |
|
| 110 | + $this->app->singleton('setting', function($app) { |
|
| 111 | 111 | $config = $app['config']->get('jlourenco.support'); |
| 112 | 112 | |
| 113 | 113 | $path = array_get($config, 'Setting.path'); |
@@ -121,8 +121,9 @@ |
||
| 121 | 121 | |
| 122 | 122 | $config = $this->app['config']->get('jlourenco.support'); |
| 123 | 123 | |
| 124 | - if (array_get($config, 'Setting.autoAlias')) |
|
| 125 | - $this->app->alias('setting', 'jlourenco\support\Setting'); |
|
| 124 | + if (array_get($config, 'Setting.autoAlias')) { |
|
| 125 | + $this->app->alias('setting', 'jlourenco\support\Setting'); |
|
| 126 | + } |
|
| 126 | 127 | } |
| 127 | 128 | |
| 128 | 129 | /** |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | $file = (!$environment || ($environment == 'production')) ? "{$path}/{$group}.php" : "{$path}/{$environment}/{$group}.php"; |
| 14 | 14 | |
| 15 | - $this->files->put($file, '<?php return ' . var_export($items, true) . ';'); |
|
| 15 | + $this->files->put($file, '<?php return '.var_export($items, true).';'); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | } |
| 19 | 19 | \ No newline at end of file |
@@ -7,8 +7,9 @@ |
||
| 7 | 7 | { |
| 8 | 8 | $path = $this->getPath($namespace); |
| 9 | 9 | |
| 10 | - if (is_null($path)) |
|
| 11 | - return; |
|
| 10 | + if (is_null($path)) { |
|
| 11 | + return; |
|
| 12 | + } |
|
| 12 | 13 | |
| 13 | 14 | $file = (!$environment || ($environment == 'production')) ? "{$path}/{$group}.php" : "{$path}/{$environment}/{$group}.php"; |
| 14 | 15 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | 'Dates_Format' => 'd/m/Y', |
| 20 | 20 | 'DateTime_Format' => 'd/m/Y h:i', |
| 21 | 21 | 'Setting' => [ |
| 22 | - 'path' => app_path() . '/storage/meta', |
|
| 22 | + 'path' => app_path().'/storage/meta', |
|
| 23 | 23 | 'filename' => 'setting.json', |
| 24 | 24 | 'fallback' => true, |
| 25 | 25 | 'autoAlias'=> true, |