Skip to content

Commit 8ae5602

Browse files
committed
chore(license): update headers across codebase
Signed-off-by: otengkwame <[email protected]>
1 parent 37bc0ef commit 8ae5602

File tree

139 files changed

+1433
-501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+1433
-501
lines changed

Core/DotEnv.php

Lines changed: 27 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,16 @@
11
<?php
2-
defined('COREPATH') or exit('No direct script access allowed');
32

43
/**
5-
* CodeIgniter
6-
*
7-
* An open source application development framework for PHP
8-
*
9-
* This content is released under the MIT License (MIT)
10-
*
11-
* Copyright (c) 2014-2019 British Columbia Institute of Technology
12-
* Copyright (c) 2019-2020 CodeIgniter Foundation
13-
*
14-
* Permission is hereby granted, free of charge, to any person obtaining a copy
15-
* of this software and associated documentation files (the "Software"), to deal
16-
* in the Software without restriction, including without limitation the rights
17-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18-
* copies of the Software, and to permit persons to whom the Software is
19-
* furnished to do so, subject to the following conditions:
4+
* This file is part of WebbyPHP Framework.
205
*
21-
* The above copyright notice and this permission notice shall be included in
22-
* all copies or substantial portions of the Software.
6+
* (c) Kwame Oteng Appiah-Nti <[email protected]>
237
*
24-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30-
* THE SOFTWARE.
31-
*
32-
* @package CodeIgniter
33-
* @author CodeIgniter Dev Team
34-
* @copyright 2019-2020 CodeIgniter Foundation
35-
* @license https://opensource.org/licenses/MIT MIT License
36-
* @link https://codeigniter.com
37-
* @since Version 4.0.0
38-
* @used-for Version 3.1.11
39-
* @filesource
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
4010
*/
4111

12+
defined('COREPATH') or exit('No direct script access allowed');
13+
4214
/**
4315
* Environment-specific configuration
4416
*/
@@ -78,13 +50,11 @@ public function load(): bool
7850
{
7951
$vars = $this->parse();
8052

81-
if ($vars === null)
82-
{
53+
if ($vars === null) {
8354
return false;
8455
}
8556

86-
foreach ($vars as $name => $value)
87-
{
57+
foreach ($vars as $name => $value) {
8858
$this->setVariable($name, $value);
8959
}
9060

@@ -101,32 +71,27 @@ public function load(): bool
10171
public function parse(): ?array
10272
{
10373
// We don't want to enforce the presence of a .env file, they should be optional.
104-
if (! is_file($this->path))
105-
{
74+
if (! is_file($this->path)) {
10675
return null;
10776
}
10877

10978
// Ensure the file is readable
110-
if (! is_readable($this->path))
111-
{
79+
if (! is_readable($this->path)) {
11280
throw new \InvalidArgumentException("The .env file is not readable: {$this->path}");
11381
}
11482

11583
$vars = [];
11684

11785
$lines = file($this->path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
11886

119-
foreach ($lines as $line)
120-
{
87+
foreach ($lines as $line) {
12188
// Is it a comment?
122-
if (strpos(trim($line), '#') === 0)
123-
{
89+
if (strpos(trim($line), '#') === 0) {
12490
continue;
12591
}
12692

12793
// If there is an equal sign, then we know we are assigning a variable.
128-
if (strpos($line, '=') !== false)
129-
{
94+
if (strpos($line, '=') !== false) {
13095
list($name, $value) = $this->normaliseVariable($line);
13196
$vars[$name] = $value;
13297
}
@@ -147,16 +112,13 @@ public function parse(): ?array
147112
*/
148113
protected function setVariable(string $name, string $value = '')
149114
{
150-
if (! getenv($name, true))
151-
{
115+
if (! getenv($name, true)) {
152116
putenv("$name=$value");
153117
}
154-
if (empty($_ENV[$name]))
155-
{
118+
if (empty($_ENV[$name])) {
156119
$_ENV[$name] = $value;
157120
}
158-
if (empty($_SERVER[$name]))
159-
{
121+
if (empty($_SERVER[$name])) {
160122
$_SERVER[$name] = $value;
161123
}
162124
}
@@ -175,8 +137,7 @@ protected function setVariable(string $name, string $value = '')
175137
public function normaliseVariable(string $name, string $value = ''): array
176138
{
177139
// Split our compound string into it's parts.
178-
if (strpos($name, '=') !== false)
179-
{
140+
if (strpos($name, '=') !== false) {
180141
list($name, $value) = explode('=', $name, 2);
181142
}
182143

@@ -212,18 +173,16 @@ public function normaliseVariable(string $name, string $value = ''): array
212173
*/
213174
protected function sanitizeValue(string $value): string
214175
{
215-
if (! $value)
216-
{
176+
if (! $value) {
217177
return $value;
218178
}
219179

220180
// Does it begin with a quote?
221-
if (strpbrk($value[0], '"\'') !== false)
222-
{
181+
if (strpbrk($value[0], '"\'') !== false) {
223182
// value starts with a quote
224183
$quote = $value[0];
225184
$regexPattern = sprintf(
226-
'/^
185+
'/^
227186
%1$s # match a quote at the start of the value
228187
( # capturing sub-pattern used
229188
(?: # we do not need to capture this
@@ -234,21 +193,19 @@ protected function sanitizeValue(string $value): string
234193
) # end of the capturing sub-pattern
235194
%1$s # and the closing quote
236195
.*$ # and discard any string after the closing quote
237-
/mx', $quote
196+
/mx',
197+
$quote
238198
);
239199
$value = preg_replace($regexPattern, '$1', $value);
240200
$value = str_replace("\\$quote", $quote, $value);
241201
$value = str_replace('\\\\', '\\', $value);
242-
}
243-
else
244-
{
202+
} else {
245203
$parts = explode(' #', $value, 2);
246204

247205
$value = trim($parts[0]);
248206

249207
// Unquoted values cannot contain whitespace
250-
if (preg_match('/\s+/', $value) > 0)
251-
{
208+
if (preg_match('/\s+/', $value) > 0) {
252209
throw new \InvalidArgumentException('.env values containing spaces must be surrounded by quotes.');
253210
}
254211
}
@@ -273,17 +230,15 @@ protected function sanitizeValue(string $value): string
273230
*/
274231
protected function resolveNestedVariables(string $value): string
275232
{
276-
if (strpos($value, '$') !== false)
277-
{
233+
if (strpos($value, '$') !== false) {
278234
$loader = $this;
279235

280236
$value = preg_replace_callback(
281237
'/\${([a-zA-Z0-9_]+)}/',
282238
function ($matchedPatterns) use ($loader) {
283239
$nestedVariable = $loader->getVariable($matchedPatterns[1]);
284240

285-
if (is_null($nestedVariable))
286-
{
241+
if (is_null($nestedVariable)) {
287242
return $matchedPatterns[0];
288243
}
289244

@@ -328,8 +283,7 @@ public function prepareVariable(string $value): string
328283
*/
329284
protected function getVariable(string $name)
330285
{
331-
switch (true)
332-
{
286+
switch (true) {
333287
case array_key_exists($name, $_ENV):
334288
return $_ENV[$name];
335289
case array_key_exists($name, $_SERVER):

Core/controllers/Commands/Baseurl.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/**
4+
* This file is part of WebbyPHP Framework.
5+
*
6+
* (c) Kwame Oteng Appiah-Nti <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
use Base\Helpers\DotEnvWriter;
413
use Base\Console\ConsoleColor;
514
use Base\Controllers\ConsoleController;

Core/controllers/Commands/Cache.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/**
4+
* This file is part of WebbyPHP Framework.
5+
*
6+
* (c) Kwame Oteng Appiah-Nti <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
use Base\Cache\Cache as Cached;
413
use Base\Controllers\ConsoleController;
514

Core/controllers/Commands/Create.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/**
4+
* This file is part of WebbyPHP Framework.
5+
*
6+
* (c) Kwame Oteng Appiah-Nti <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
use Base\Helpers\Inflector;
413
use Base\Console\ConsoleColor;
514
use Base\Controllers\ConsoleController;

Core/controllers/Commands/Environment.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/**
4+
* This file is part of WebbyPHP Framework.
5+
*
6+
* (c) Kwame Oteng Appiah-Nti <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
use Base\Helpers\DotEnvWriter;
413
use Base\Console\ConsoleColor;
514
use Base\Controllers\ConsoleController;

Core/controllers/Commands/Help.php

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1-
<?php
1+
<?php
22

3-
use Base\Console\ConsoleColor;
4-
use Base\Console\Commands\Help as ConsoleHelp;
5-
use Base\Controllers\ConsoleController;
3+
/**
4+
* This file is part of WebbyPHP Framework.
5+
*
6+
* (c) Kwame Oteng Appiah-Nti <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
611

7-
class Help extends ConsoleController
12+
use Base\Console\ConsoleColor;
13+
use Base\Console\Commands\Help as ConsoleHelp;
14+
use Base\Controllers\ConsoleController;
15+
16+
class Help extends ConsoleController
17+
{
18+
public function __construct()
819
{
9-
public function __construct()
10-
{
11-
parent::__construct();
12-
$this->onlydev();
13-
}
20+
parent::__construct();
21+
$this->onlydev();
22+
}
1423

15-
public function index()
16-
{
17-
ConsoleHelp::showHelp();
18-
}
24+
public function index()
25+
{
26+
ConsoleHelp::showHelp();
1927
}
28+
}

Core/controllers/Commands/Key.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/**
4+
* This file is part of WebbyPHP Framework.
5+
*
6+
* (c) Kwame Oteng Appiah-Nti <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
use Base\Helpers\DotEnvWriter;
413
use Base\Console\ConsoleColor;
514
use Base\Controllers\ConsoleController;

Core/controllers/Commands/Maintenance.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/**
4+
* This file is part of WebbyPHP Framework.
5+
*
6+
* (c) Kwame Oteng Appiah-Nti <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
use Base\Helpers\DotEnvWriter;
413
use Base\Console\ConsoleColor;
514
use Base\Controllers\ConsoleController;

Core/controllers/Commands/Migration.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/**
4+
* This file is part of WebbyPHP Framework.
5+
*
6+
* (c) Kwame Oteng Appiah-Nti <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
use Base\Helpers\TraverseClassFile;
413
use Base\Controllers\ConsoleController;
514
use Base\Migrations\Migration as Migrate;

Core/controllers/Commands/Routes.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<?php
22

33
/**
4-
* Routes Command Controller
4+
* This file is part of WebbyPHP Framework.
5+
*
6+
* (c) Kwame Oteng Appiah-Nti <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
510
*/
611

712
use Base\Console\ConsoleColor;

0 commit comments

Comments
 (0)