Skip to content

Commit 2264936

Browse files
author
Fredrick Peter
committed
Update
1 parent c657005 commit 2264936

File tree

17 files changed

+574
-214
lines changed

17 files changed

+574
-214
lines changed

Asset.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Asset{
2121
*
2222
* @return string
2323
*/
24-
public static function asset(?string $asset = null)
24+
static public function asset(?string $asset = null)
2525
{
2626
// if coniguration has not been used in the global space
2727
// then we call to define paths for us
@@ -61,7 +61,7 @@ public static function asset(?string $asset = null)
6161
*
6262
* @return void
6363
*/
64-
public static function config(?string $base_path = null, ?bool $cache = true)
64+
static public function config(?string $base_path = null, ?bool $cache = true)
6565
{
6666
// severs
6767
$server = self::getServers();
@@ -94,7 +94,7 @@ public static function config(?string $base_path = null, ?bool $cache = true)
9494
*
9595
* @return int|false
9696
*/
97-
private static function getFiletime(?string $file_path = null)
97+
static private function getFiletime(?string $file_path = null)
9898
{
9999
return file_exists($file_path)
100100
? "?v=" . filemtime($file_path)

AutoloadRegister.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ class AutoloadRegister{
1616
* The base directory to scan for classes and files.
1717
* @var string
1818
*/
19-
private static $baseDirectory;
19+
static private $baseDirectory;
2020

2121
/**
2222
* The class map that stores the class names and their corresponding file paths.
2323
* @var array
2424
*/
25-
private static $classMap = [];
25+
static private $classMap = [];
2626

2727
/**
2828
* The file map that stores the file paths and their corresponding relative paths.
2929
* @var array
3030
*/
31-
private static $fileMap = [];
31+
static private $fileMap = [];
3232

3333
/**
3434
* Autoload function to load class and files in a given folder
@@ -40,7 +40,7 @@ class AutoloadRegister{
4040
*
4141
* @return void
4242
*/
43-
public static function load(string|array $baseDirectory)
43+
static public function load(string|array $baseDirectory)
4444
{
4545
if(is_array($baseDirectory)){
4646
foreach($baseDirectory as $directory){
@@ -64,7 +64,7 @@ public static function load(string|array $baseDirectory)
6464
* - Scanning the directory, and registering the autoload method.
6565
* @return void
6666
*/
67-
private static function boot()
67+
static private function boot()
6868
{
6969
self::generateClassMap();
7070
self::generateFileMap();
@@ -78,7 +78,7 @@ private static function boot()
7878
* @param string $className The name of the class to load.
7979
* @return void
8080
*/
81-
private static function loadClass($className)
81+
static private function loadClass($className)
8282
{
8383
$filePath = self::$classMap[$className] ?? null;
8484
if ($filePath && file_exists($filePath)) {
@@ -91,7 +91,7 @@ private static function loadClass($className)
9191
*
9292
* @return void
9393
*/
94-
private static function loadFiles()
94+
static private function loadFiles()
9595
{
9696
foreach (self::$fileMap as $fileName => $filePath) {
9797
if (file_exists($filePath)) {
@@ -105,7 +105,7 @@ private static function loadFiles()
105105
*
106106
* @return void
107107
*/
108-
private static function generateClassMap()
108+
static private function generateClassMap()
109109
{
110110
$fileIterator = new RecursiveIteratorIterator(
111111
new RecursiveDirectoryIterator(self::$baseDirectory)
@@ -127,7 +127,7 @@ private static function generateClassMap()
127127
*
128128
* @return void
129129
*/
130-
private static function generateFileMap()
130+
static private function generateFileMap()
131131
{
132132
$fileIterator = new RecursiveIteratorIterator(
133133
new RecursiveDirectoryIterator(self::$baseDirectory)
@@ -152,7 +152,7 @@ private static function generateFileMap()
152152
* @param string $filePath The file path.
153153
* @return string The relative path.
154154
*/
155-
private static function getRelativePath($filePath)
155+
static private function getRelativePath($filePath)
156156
{
157157
$relativePath = substr($filePath, strlen(self::$baseDirectory));
158158
return ltrim($relativePath, '/\\');
@@ -164,7 +164,7 @@ private static function getRelativePath($filePath)
164164
* @param string $filePath The file path.
165165
* @return string|null The class name, or null if not found.
166166
*/
167-
private static function getClassName($filePath)
167+
static private function getClassName($filePath)
168168
{
169169
$namespace = '';
170170
$content = file_get_contents($filePath);

Capsule/FileCache.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class FileCache{
2020
* @param string $path
2121
* @return void
2222
*/
23-
public static function setCachePath(string $path = "cache"): void
23+
static public function setCachePath(string $path = "cache"): void
2424
{
2525
// if \storage folder not found
2626
$path = storage_path($path);
@@ -39,7 +39,7 @@ public static function setCachePath(string $path = "cache"): void
3939
* @param int|null $expirationTime Expiration time in seconds (null for no expiration)
4040
* @return void
4141
*/
42-
public static function put(string $key, $value, ?int $expirationTime = 604800): void
42+
static public function put(string $key, $value, ?int $expirationTime = 604800): void
4343
{
4444
$cachePath = self::getCachePath($key);
4545

@@ -57,7 +57,7 @@ public static function put(string $key, $value, ?int $expirationTime = 604800):
5757
* @param string $key
5858
* @return mixed|null
5959
*/
60-
public static function get(string $key)
60+
static public function get(string $key)
6161
{
6262
$cachePath = self::getCachePath($key);
6363

@@ -81,7 +81,7 @@ public static function get(string $key)
8181
* @param string $key
8282
* @return bool
8383
*/
84-
public static function exists(string $key)
84+
static public function exists(string $key)
8585
{
8686
$key = self::getCachePath($key);
8787
return file_exists( $key ) && !is_dir($key);
@@ -93,7 +93,7 @@ public static function exists(string $key)
9393
* @param string $key
9494
* @return bool
9595
*/
96-
public static function has(string $key): bool
96+
static public function has(string $key): bool
9797
{
9898
$cachePath = self::getCachePath($key);
9999

@@ -112,7 +112,7 @@ public static function has(string $key): bool
112112
* @param string $key
113113
* @return bool
114114
*/
115-
public static function expired(string $key): bool
115+
static public function expired(string $key): bool
116116
{
117117
$cachePath = self::getCachePath($key);
118118

@@ -133,7 +133,7 @@ public static function expired(string $key): bool
133133
* @param string $key
134134
* @return void
135135
*/
136-
public static function forget(string $key): void
136+
static public function forget(string $key): void
137137
{
138138
$cachePath = self::getCachePath($key);
139139

@@ -147,7 +147,7 @@ public static function forget(string $key): void
147147
*
148148
* @return void
149149
*/
150-
public static function clear(): void
150+
static public function clear(): void
151151
{
152152
$files = glob(self::$cachePath . '/*.cache');
153153

@@ -164,7 +164,7 @@ public static function clear(): void
164164
* @param string $key
165165
* @return string
166166
*/
167-
protected static function getCachePath(string $key): string
167+
static protected function getCachePath(string $key): string
168168
{
169169
return self::$cachePath . '/' . md5($key) . '.cache';
170170
}

Capsule/Manager.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,28 @@
55
namespace Tamedevelopers\Support\Capsule;
66

77
use Tamedevelopers\Support\Env;
8+
use Tamedevelopers\Support\Str;
89

910
class Manager{
1011

1112
/**
1213
* Remove all whitespace characters
1314
* @var string
1415
*/
15-
public static $regex_whitespace = "/\s+/";
16+
static public $regex_whitespace = "/\s+/";
1617

1718
/**
1819
* Remove leading or trailing spaces/tabs from each line
1920
* @var string
2021
*/
21-
public static $regex_lead_and_end = "/^[ \t]+|[ \t]+$/m";
22+
static public $regex_lead_and_end = "/^[ \t]+|[ \t]+$/m";
2223

2324
/**
2425
* Sample copy of env file
2526
*
2627
* @return string
2728
*/
28-
public static function envDummy()
29+
static public function envDummy()
2930
{
3031
return preg_replace("/^[ \t]+|[ \t]+$/m", "", 'APP_NAME="ORM Database"
3132
APP_ENV=local
@@ -73,7 +74,7 @@ public static function envDummy()
7374
*
7475
* @return string
7576
*/
76-
private static function generate($length = 32)
77+
static private function generate($length = 32)
7778
{
7879
$randomBytes = random_bytes($length);
7980
$appKey = 'base64:' . rtrim(strtr(base64_encode($randomBytes), '+/', '-_'), '=');
@@ -94,7 +95,7 @@ private static function generate($length = 32)
9495
*
9596
* @return void
9697
*/
97-
public static function regenerate()
98+
static public function regenerate()
9899
{
99100
Env::updateENV('APP_KEY', self::generate(), false);
100101
}
@@ -104,7 +105,7 @@ public static function regenerate()
104105
*
105106
* @return bool
106107
*/
107-
public static function AppDebug()
108+
static public function AppDebug()
108109
{
109110
return self::isEnvBool($_ENV['APP_DEBUG'] ?? true);
110111
}
@@ -115,10 +116,10 @@ public static function AppDebug()
115116
*
116117
* @return mixed
117118
*/
118-
public static function isEnvBool($value)
119+
static public function isEnvBool($value)
119120
{
120121
if(is_string($value)){
121-
return trim((string) strtolower($value)) === 'true'
122+
return Str::lower($value) === 'true'
122123
? true
123124
: false;
124125
}
@@ -132,7 +133,7 @@ public static function isEnvBool($value)
132133
*
133134
* @return bool
134135
*/
135-
public static function isEnvSet($key)
136+
static public function isEnvSet($key)
136137
{
137138
return isset($_ENV[$key]) ? true : false;
138139
}
@@ -144,7 +145,7 @@ public static function isEnvSet($key)
144145
* @param callable $function
145146
* @return void
146147
*/
147-
public static function setHeaders($status = 404, callable $function = null)
148+
static public function setHeaders($status = 404, callable $function = null)
148149
{
149150
// Set HTTP response status code to 404
150151
@http_response_code($status);
@@ -164,7 +165,7 @@ public static function setHeaders($status = 404, callable $function = null)
164165
*
165166
* @return string
166167
*/
167-
public static function replaceWhiteSpace(?string $string = null)
168+
static public function replaceWhiteSpace(?string $string = null)
168169
{
169170
return trim(preg_replace(
170171
self::$regex_whitespace,
@@ -180,7 +181,7 @@ public static function replaceWhiteSpace(?string $string = null)
180181
*
181182
* @return string
182183
*/
183-
public static function replaceLeadEndSpace(?string $string = null)
184+
static public function replaceLeadEndSpace(?string $string = null)
184185
{
185186
return preg_replace(self::$regex_lead_and_end, " ", $string);
186187
}

0 commit comments

Comments
 (0)