-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create a utility class to store all global utilities
create a utility class to store all global utilities use utility class
- Loading branch information
Showing
8 changed files
with
56 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Steamy\Core; | ||
|
||
class Utility | ||
{ | ||
/** | ||
* Display any data in a formatted block. Use this function | ||
* for debugging. | ||
* @param $stuff | ||
* @return void | ||
*/ | ||
public static function show($stuff): void | ||
{ | ||
echo "<pre>"; | ||
print_r($stuff); | ||
echo "</pre>"; | ||
} | ||
|
||
/** | ||
* Splits the URL into an array of segments. | ||
* | ||
* This function retrieves the 'url' parameter from the $_GET array or defaults to 'home', | ||
* trims leading and trailing slashes, and then explodes the URL into an array of segments. | ||
* | ||
* @return array An array containing the URL segments. | ||
*/ | ||
public static function splitURL(): array | ||
{ | ||
$URL = $_GET['url'] ?? 'home'; | ||
return explode("/", trim($URL, '/')); | ||
} | ||
|
||
/** @noinspection PhpNoReturnAttributeCanBeAddedInspection */ | ||
/** | ||
* Redirects website to a page. | ||
* @param $path string relative URL of page | ||
* @return void | ||
*/ | ||
public static function redirect(string $path): void | ||
{ | ||
header("Location: " . ROOT . "/" . $path); | ||
die; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters