@@ -70,14 +70,14 @@ |
||
| 70 | 70 | return null; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Write to an environment variable. |
|
| 75 | - * |
|
| 76 | - * @param string $name |
|
| 77 | - * @param string $value |
|
| 78 | - * |
|
| 79 | - * @return bool |
|
| 80 | - */ |
|
| 73 | + /** |
|
| 74 | + * Write to an environment variable. |
|
| 75 | + * |
|
| 76 | + * @param string $name |
|
| 77 | + * @param string $value |
|
| 78 | + * |
|
| 79 | + * @return bool |
|
| 80 | + */ |
|
| 81 | 81 | public function write(string $name, string $value) |
| 82 | 82 | { |
| 83 | 83 | if ( ! $this->has($name)) { |
@@ -70,14 +70,14 @@ |
||
| 70 | 70 | return null; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Write to an environment variable. |
|
| 75 | - * |
|
| 76 | - * @param string $name |
|
| 77 | - * @param string $value |
|
| 78 | - * |
|
| 79 | - * @return bool |
|
| 80 | - */ |
|
| 73 | + /** |
|
| 74 | + * Write to an environment variable. |
|
| 75 | + * |
|
| 76 | + * @param string $name |
|
| 77 | + * @param string $value |
|
| 78 | + * |
|
| 79 | + * @return bool |
|
| 80 | + */ |
|
| 81 | 81 | public function write(string $name, string $value) |
| 82 | 82 | { |
| 83 | 83 | return apache_setenv($name, $value); |
@@ -70,14 +70,14 @@ |
||
| 70 | 70 | return null; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Write to an environment variable. |
|
| 75 | - * |
|
| 76 | - * @param string $name |
|
| 77 | - * @param string $value |
|
| 78 | - * |
|
| 79 | - * @return bool |
|
| 80 | - */ |
|
| 73 | + /** |
|
| 74 | + * Write to an environment variable. |
|
| 75 | + * |
|
| 76 | + * @param string $name |
|
| 77 | + * @param string $value |
|
| 78 | + * |
|
| 79 | + * @return bool |
|
| 80 | + */ |
|
| 81 | 81 | public function write(string $name, string $value) |
| 82 | 82 | { |
| 83 | 83 | if (empty($_ENV[$name])) |
@@ -69,14 +69,14 @@ |
||
| 69 | 69 | return null; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Write to an environment variable. |
|
| 74 | - * |
|
| 75 | - * @param string $name |
|
| 76 | - * @param string $value |
|
| 77 | - * |
|
| 78 | - * @return bool |
|
| 79 | - */ |
|
| 72 | + /** |
|
| 73 | + * Write to an environment variable. |
|
| 74 | + * |
|
| 75 | + * @param string $name |
|
| 76 | + * @param string $value |
|
| 77 | + * |
|
| 78 | + * @return bool |
|
| 79 | + */ |
|
| 80 | 80 | public function write(string $name, string $value) |
| 81 | 81 | { |
| 82 | 82 | $notHttpName = 0 !== strpos($name, 'HTTP_'); |
@@ -113,9 +113,9 @@ |
||
| 113 | 113 | protected function createEnv($app) |
| 114 | 114 | { |
| 115 | 115 | return Dotenv::create( |
| 116 | - Environment::getRepositoryCreator(), |
|
| 117 | - $app->environmentPath(), |
|
| 118 | - $app->environmentFile() |
|
| 116 | + Environment::getRepositoryCreator(), |
|
| 117 | + $app->environmentPath(), |
|
| 118 | + $app->environmentFile() |
|
| 119 | 119 | ); |
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | \ No newline at end of file |
@@ -73,14 +73,14 @@ |
||
| 73 | 73 | return $this->readers->read($name); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Set an environment variable. |
|
| 78 | - * |
|
| 79 | - * @param string $name |
|
| 80 | - * @param string $value |
|
| 81 | - * |
|
| 82 | - * @return bool |
|
| 83 | - */ |
|
| 76 | + /** |
|
| 77 | + * Set an environment variable. |
|
| 78 | + * |
|
| 79 | + * @param string $name |
|
| 80 | + * @param string $value |
|
| 81 | + * |
|
| 82 | + * @return bool |
|
| 83 | + */ |
|
| 84 | 84 | public function set(string $name, string $value) |
| 85 | 85 | { |
| 86 | 86 | return $this->writers->write($name, $value); |
@@ -259,7 +259,7 @@ |
||
| 259 | 259 | $quote = $value[0]; |
| 260 | 260 | |
| 261 | 261 | $regexPattern = sprintf( |
| 262 | - '/^ |
|
| 262 | + '/^ |
|
| 263 | 263 | %1$s # match a quote at the start of the value |
| 264 | 264 | ( # capturing sub-pattern used |
| 265 | 265 | (?: # we do not need to capture this |
@@ -274,7 +274,7 @@ |
||
| 274 | 274 | if (strpos($value, '$') !== false) { |
| 275 | 275 | $repository = $this->repository; |
| 276 | 276 | |
| 277 | - $value = preg_replace_callback('~\${([a-zA-Z0-9_]+)}~', function ($pattern) use ($repository) { |
|
| 277 | + $value = preg_replace_callback('~\${([a-zA-Z0-9_]+)}~', function($pattern) use ($repository) { |
|
| 278 | 278 | $nestedVariable = $repository->get($pattern[1]); |
| 279 | 279 | |
| 280 | 280 | if (is_null($nestedVariable)) { |
@@ -31,14 +31,14 @@ |
||
| 31 | 31 | interface Lenevor |
| 32 | 32 | { |
| 33 | 33 | /** |
| 34 | - * Initializes the framework, this can only be called once. |
|
| 35 | - * Launch the application. |
|
| 36 | - * |
|
| 37 | - * @param \Syscodes\http\Request $request |
|
| 38 | - * |
|
| 39 | - * @return void |
|
| 40 | - * |
|
| 41 | - * @uses new \Syscodes\Http\Response |
|
| 42 | - */ |
|
| 43 | - public function handle($request); |
|
| 34 | + * Initializes the framework, this can only be called once. |
|
| 35 | + * Launch the application. |
|
| 36 | + * |
|
| 37 | + * @param \Syscodes\http\Request $request |
|
| 38 | + * |
|
| 39 | + * @return void |
|
| 40 | + * |
|
| 41 | + * @uses new \Syscodes\Http\Response |
|
| 42 | + */ |
|
| 43 | + public function handle($request); |
|
| 44 | 44 | } |
| 45 | 45 | \ No newline at end of file |
@@ -36,147 +36,147 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | class Configure implements ArrayAccess, ConfigureContract |
| 38 | 38 | { |
| 39 | - /** |
|
| 40 | - * Currently registered routes. |
|
| 41 | - * |
|
| 42 | - * @var array $vars |
|
| 43 | - */ |
|
| 44 | - protected $vars = []; |
|
| 39 | + /** |
|
| 40 | + * Currently registered routes. |
|
| 41 | + * |
|
| 42 | + * @var array $vars |
|
| 43 | + */ |
|
| 44 | + protected $vars = []; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Determine if the given configuration value exists. |
|
| 48 | - * |
|
| 49 | - * @param string $key |
|
| 50 | - * |
|
| 51 | - * @return bool |
|
| 52 | - */ |
|
| 53 | - public function has(string $key) |
|
| 54 | - { |
|
| 55 | - return Arr::has($this->vars, $key); |
|
| 56 | - } |
|
| 46 | + /** |
|
| 47 | + * Determine if the given configuration value exists. |
|
| 48 | + * |
|
| 49 | + * @param string $key |
|
| 50 | + * |
|
| 51 | + * @return bool |
|
| 52 | + */ |
|
| 53 | + public function has(string $key) |
|
| 54 | + { |
|
| 55 | + return Arr::has($this->vars, $key); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * Returns a (dot notated) config setting. |
|
| 60 | - * |
|
| 61 | - * @param string $key The dot-notated key or array of keys |
|
| 62 | - * @param mixed $default The default value |
|
| 63 | - * |
|
| 64 | - * @return mixed |
|
| 65 | - * |
|
| 66 | - * @uses \Syscodes\Support\Arr |
|
| 67 | - */ |
|
| 68 | - public function get(string $key, $default = null) |
|
| 69 | - { |
|
| 70 | - $keys = explode('.', $key); |
|
| 58 | + /** |
|
| 59 | + * Returns a (dot notated) config setting. |
|
| 60 | + * |
|
| 61 | + * @param string $key The dot-notated key or array of keys |
|
| 62 | + * @param mixed $default The default value |
|
| 63 | + * |
|
| 64 | + * @return mixed |
|
| 65 | + * |
|
| 66 | + * @uses \Syscodes\Support\Arr |
|
| 67 | + */ |
|
| 68 | + public function get(string $key, $default = null) |
|
| 69 | + { |
|
| 70 | + $keys = explode('.', $key); |
|
| 71 | 71 | |
| 72 | - if ( ! array_key_exists($file = current($keys), $this->vars)) { |
|
| 73 | - foreach ([CON_PATH] as $paths) { |
|
| 74 | - if (is_readable($path = $paths.$file.'.php')) { |
|
| 75 | - $this->vars[$file] = require $path; |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - } |
|
| 72 | + if ( ! array_key_exists($file = current($keys), $this->vars)) { |
|
| 73 | + foreach ([CON_PATH] as $paths) { |
|
| 74 | + if (is_readable($path = $paths.$file.'.php')) { |
|
| 75 | + $this->vars[$file] = require $path; |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - return Arr::get($this->vars, $key, $default); |
|
| 81 | - } |
|
| 80 | + return Arr::get($this->vars, $key, $default); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Sets a value in the config array. |
|
| 85 | - * |
|
| 86 | - * @param string $key The dot-notated key or array of keys |
|
| 87 | - * @param mixed $value The default value |
|
| 88 | - * |
|
| 89 | - * @return mixed |
|
| 90 | - * |
|
| 91 | - * @uses \Syscodes\Support\Arr |
|
| 92 | - */ |
|
| 93 | - public function set(string $key, $value) |
|
| 94 | - { |
|
| 95 | - strpos($key, '.') === false || $this->vars[$key] = $value; |
|
| 83 | + /** |
|
| 84 | + * Sets a value in the config array. |
|
| 85 | + * |
|
| 86 | + * @param string $key The dot-notated key or array of keys |
|
| 87 | + * @param mixed $value The default value |
|
| 88 | + * |
|
| 89 | + * @return mixed |
|
| 90 | + * |
|
| 91 | + * @uses \Syscodes\Support\Arr |
|
| 92 | + */ |
|
| 93 | + public function set(string $key, $value) |
|
| 94 | + { |
|
| 95 | + strpos($key, '.') === false || $this->vars[$key] = $value; |
|
| 96 | 96 | |
| 97 | - Arr::set($this->$vars, $key, $value); |
|
| 98 | - } |
|
| 97 | + Arr::set($this->$vars, $key, $value); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Deletes a (dot notated) config item. |
|
| 102 | - * |
|
| 103 | - * @param string $key A (dot notated) config key |
|
| 104 | - * |
|
| 105 | - * @return array|bool |
|
| 106 | - * |
|
| 107 | - * @uses \Syscodes\Support\Arr |
|
| 108 | - */ |
|
| 109 | - public function erase(string $key) |
|
| 110 | - { |
|
| 111 | - if (isset($this->$vars[$key])) { |
|
| 112 | - unset($this->$vars[$key]); |
|
| 113 | - } |
|
| 100 | + /** |
|
| 101 | + * Deletes a (dot notated) config item. |
|
| 102 | + * |
|
| 103 | + * @param string $key A (dot notated) config key |
|
| 104 | + * |
|
| 105 | + * @return array|bool |
|
| 106 | + * |
|
| 107 | + * @uses \Syscodes\Support\Arr |
|
| 108 | + */ |
|
| 109 | + public function erase(string $key) |
|
| 110 | + { |
|
| 111 | + if (isset($this->$vars[$key])) { |
|
| 112 | + unset($this->$vars[$key]); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - Arr::erase($this->$vars, $key); |
|
| 116 | - } |
|
| 115 | + Arr::erase($this->$vars, $key); |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * Get all of the configuration items for the application. |
|
| 120 | - * |
|
| 121 | - * @return array |
|
| 122 | - */ |
|
| 123 | - public function all() |
|
| 124 | - { |
|
| 125 | - return $this->vars; |
|
| 126 | - } |
|
| 118 | + /** |
|
| 119 | + * Get all of the configuration items for the application. |
|
| 120 | + * |
|
| 121 | + * @return array |
|
| 122 | + */ |
|
| 123 | + public function all() |
|
| 124 | + { |
|
| 125 | + return $this->vars; |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - /* |
|
| 128 | + /* |
|
| 129 | 129 | |----------------------------------------------------------------- |
| 130 | 130 | | ArrayAccess Methods |
| 131 | 131 | |----------------------------------------------------------------- |
| 132 | 132 | */ |
| 133 | 133 | |
| 134 | - /** |
|
| 135 | - * Determine if the given configuration option exists. |
|
| 136 | - * |
|
| 137 | - * @param string $key |
|
| 138 | - * |
|
| 139 | - * @return bool |
|
| 140 | - */ |
|
| 141 | - public function offsetExists($key) |
|
| 142 | - { |
|
| 143 | - return $this->has($key); |
|
| 144 | - } |
|
| 134 | + /** |
|
| 135 | + * Determine if the given configuration option exists. |
|
| 136 | + * |
|
| 137 | + * @param string $key |
|
| 138 | + * |
|
| 139 | + * @return bool |
|
| 140 | + */ |
|
| 141 | + public function offsetExists($key) |
|
| 142 | + { |
|
| 143 | + return $this->has($key); |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Get a configuration option. |
|
| 148 | - * |
|
| 149 | - * @param string $key |
|
| 150 | - * |
|
| 151 | - * @return mixed |
|
| 152 | - */ |
|
| 153 | - public function offsetGet($key) |
|
| 154 | - { |
|
| 155 | - return $this->get($key); |
|
| 156 | - } |
|
| 146 | + /** |
|
| 147 | + * Get a configuration option. |
|
| 148 | + * |
|
| 149 | + * @param string $key |
|
| 150 | + * |
|
| 151 | + * @return mixed |
|
| 152 | + */ |
|
| 153 | + public function offsetGet($key) |
|
| 154 | + { |
|
| 155 | + return $this->get($key); |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | - /** |
|
| 159 | - * Set a configuration option. |
|
| 160 | - * |
|
| 161 | - * @param string $key |
|
| 162 | - * @param mixed $value |
|
| 163 | - * |
|
| 164 | - * @return void |
|
| 165 | - */ |
|
| 166 | - public function offsetSet($key, $value) |
|
| 167 | - { |
|
| 168 | - $this->set($key, $value); |
|
| 169 | - } |
|
| 158 | + /** |
|
| 159 | + * Set a configuration option. |
|
| 160 | + * |
|
| 161 | + * @param string $key |
|
| 162 | + * @param mixed $value |
|
| 163 | + * |
|
| 164 | + * @return void |
|
| 165 | + */ |
|
| 166 | + public function offsetSet($key, $value) |
|
| 167 | + { |
|
| 168 | + $this->set($key, $value); |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - /** |
|
| 172 | - * Unset a configuration option. |
|
| 173 | - * |
|
| 174 | - * @param string $key |
|
| 175 | - * |
|
| 176 | - * @return void |
|
| 177 | - */ |
|
| 178 | - public function offsetUnset($key) |
|
| 179 | - { |
|
| 180 | - $this->set($key, null); |
|
| 181 | - } |
|
| 171 | + /** |
|
| 172 | + * Unset a configuration option. |
|
| 173 | + * |
|
| 174 | + * @param string $key |
|
| 175 | + * |
|
| 176 | + * @return void |
|
| 177 | + */ |
|
| 178 | + public function offsetUnset($key) |
|
| 179 | + { |
|
| 180 | + $this->set($key, null); |
|
| 181 | + } |
|
| 182 | 182 | } |
| 183 | 183 | \ No newline at end of file |