first commit

This commit is contained in:
2026-10-09 08:21:06 +02:00
parent db7456df87
commit d259c62304
3761 changed files with 896046 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Presenters\Traits;
use App\Presenters\Presenter;
use Exception;
trait Presentable
{
protected ?Presenter $presenterInstance = null;
/**
* @throws Exception
*/
public function present(): Presenter
{
if (is_object($this->presenterInstance)) {
return $this->presenterInstance;
}
if (property_exists($this, 'presenter') and class_exists($this->presenter)) {
return $this->presenterInstance = new $this->presenter($this);
}
throw new Exception('Property $presenter was not set correctly in '.get_class($this));
}
}