diff --git a/src/Bootstrap.php b/src/Bootstrap.php index 8a051db..7cdb688 100644 --- a/src/Bootstrap.php +++ b/src/Bootstrap.php @@ -210,6 +210,9 @@ class Bootstrap } } + /** + * Runs the code to extend models. + */ public function extendModels() { AnnotationRegistry::registerLoader("class_exists"); diff --git a/src/Doctrine/EntityPostLoadEventListener.php b/src/Doctrine/EntityPostLoadEventListener.php index 35e0e4f..f86bef3 100644 --- a/src/Doctrine/EntityPostLoadEventListener.php +++ b/src/Doctrine/EntityPostLoadEventListener.php @@ -17,11 +17,19 @@ class EntityPostLoadEventListener /** @var Game $game */ private $game; + /** + * EntityPostLoadEventListener constructor. + * @param Game $g + */ public function __construct(Game $g) { $this->game = $g; } + /** + * Called upon event postLoad. + * @param LifecycleEventArgs $args + */ public function postLoad(LifecycleEventArgs $args) { $entity = $args->getEntity(); diff --git a/src/LibraryConfiguration.php b/src/LibraryConfiguration.php index 7ff32ed..8a42702 100644 --- a/src/LibraryConfiguration.php +++ b/src/LibraryConfiguration.php @@ -124,7 +124,7 @@ class LibraryConfiguration /** * Returns a subkey if it exists or null. * @param array $arguments - * @return type + * @return mixed */ public function getSubKeyIfItExists(array $arguments) { diff --git a/src/ModelExtender.php b/src/ModelExtender.php index 35a1f34..9415b5e 100644 --- a/src/ModelExtender.php +++ b/src/ModelExtender.php @@ -10,11 +10,20 @@ use ReflectionClass; use Doctrine\Common\Annotations\AnnotationReader; use LotGD\Core\Doctrine\Annotations\Extension; +/** + * Contains method to help the extension of a model. + * @package LotGD\Core + */ class ModelExtender { + /** @var AnnotationReader */ private $reader; + /** @var array */ private static $classes = []; + /** + * ModelExtender constructor. + */ public function __construct() { $this->reader = new AnnotationReader(); @@ -65,6 +74,12 @@ class ModelExtender } } + /** + * Returns a callback registered in the model extender globally. + * @param string $modelClassName + * @param string $methodName + * @return callable|null + */ public static function get(string $modelClassName, string $methodName): ?callable { if (empty(self::$classes[$modelClassName])) { diff --git a/src/Tools/Model/ExtendableModel.php b/src/Tools/Model/ExtendableModel.php index ad793d4..c7cabda 100644 --- a/src/Tools/Model/ExtendableModel.php +++ b/src/Tools/Model/ExtendableModel.php @@ -5,6 +5,10 @@ namespace LotGD\Core\Tools\Model; use LotGD\Core\ModelExtender; +/** + * Trait to add the __call class required for extendable models. + * @package LotGD\Core\Tools\Model + */ trait ExtendableModel { public function __call($method, $arguments)