mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-19 20:14:09 -08:00
25 lines
455 B
PHP
25 lines
455 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Presenters;
|
||
|
|
||
|
trait Presentable
|
||
|
{
|
||
|
|
||
|
protected $presenterInterface;
|
||
|
|
||
|
public function present()
|
||
|
{
|
||
|
|
||
|
if (!$this->presenter || !class_exists($this->presenter)) {
|
||
|
throw new \Exception('Presenter class does not exist');
|
||
|
}
|
||
|
|
||
|
if (!isset($this->presenterInterface)) {
|
||
|
$this->presenterInterface = new $this->presenter($this);
|
||
|
}
|
||
|
|
||
|
return $this->presenterInterface;
|
||
|
|
||
|
}
|
||
|
}
|