-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a8e38c
commit 43c5785
Showing
9 changed files
with
241 additions
and
351 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
/** | ||
* Axm Framework PHP. | ||
* | ||
* The Axm class serves as the entry point for the AXM Framework. It provides methods for | ||
* initializing the application. | ||
* | ||
* @author Juan Cristobal <[email protected]> | ||
* @link http://www.axm.com/ | ||
* @license http://www.axm.com/license/ | ||
* @package Framework | ||
*/ | ||
abstract class Axm | ||
{ | ||
private static ?App $_app = null; | ||
|
||
/** | ||
* Initializes the application. | ||
*/ | ||
public static function makeApplication() | ||
{ | ||
return new App; | ||
} | ||
|
||
/** | ||
* Sets the application instance. | ||
* | ||
* This method sets the application instance, ensuring that it can only be set once. | ||
* If the application instance is already set, an exception is thrown. | ||
*/ | ||
public static function setApplication(App $app): void | ||
{ | ||
if (self::$_app !== null) { | ||
throw new Exception('Axm application can only be created once.'); | ||
} | ||
|
||
self::$_app = $app; | ||
} | ||
|
||
/** | ||
* Gets instance of the application. | ||
*/ | ||
public static function getApp(): ?App | ||
{ | ||
return self::$_app; | ||
} | ||
|
||
/** | ||
* Returns a new instance of the ConsoleApplication class | ||
*/ | ||
public static function makeConsoleApplication() | ||
{ | ||
static $console; | ||
return $console ??= new \Console\ConsoleApplication; | ||
} | ||
|
||
/** | ||
* Check if the application is in production mode. | ||
*/ | ||
public static function isProduction(): bool | ||
{ | ||
return env('APP_ENVIRONMENT') === 'production'; | ||
} | ||
|
||
/** | ||
* Get the version of a specified library. | ||
*/ | ||
public static function version(string $libraryName = 'axm/framework'): ?string | ||
{ | ||
$v = \Composer\InstalledVersions::getVersion($libraryName); | ||
return $v; | ||
} | ||
} |
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
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
Oops, something went wrong.