-
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.
- Loading branch information
Showing
7 changed files
with
114 additions
and
28 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,13 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Magnetar\Model\Exceptions; | ||
|
||
use Exception; | ||
|
||
/** | ||
* Exception thrown when a model error occurs | ||
*/ | ||
class ModelException extends Exception { | ||
|
||
} |
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,13 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Magnetar\Model\Exceptions; | ||
|
||
use Exception; | ||
|
||
/** | ||
* Exception thrown when a model could not be found by the specified identifer | ||
*/ | ||
class ModelNotFoundException extends Exception { | ||
|
||
} |
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,29 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Magnetar\Utilities; | ||
|
||
/** | ||
* PHP Internals utility static class | ||
*/ | ||
class Internals { | ||
/** | ||
* Get the basename of a namespaced class | ||
* @param string $class_name The class name (including namespace) | ||
* @return string The base class name | ||
*/ | ||
public static function basename_class(string $class_name): string { | ||
$bits = explode('\\', $class_name); | ||
|
||
return end($bits); | ||
} | ||
|
||
/** | ||
* Get the base class name of a namespaced class from an instance | ||
* @param mixed $instance The instance to get the class name from | ||
* @return string The base class name | ||
*/ | ||
public static function class_basename_instance(mixed $instance): string { | ||
return self::basename_class(get_class($instance)); | ||
} | ||
} |
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