XBackBone/app/Traits/SingletonController.php
Sergio Brighenti 732cf7ff48 Doc blocks
2018-10-13 18:25:48 +02:00

24 lines
350 B
PHP

<?php
namespace App\Traits;
use App\Controllers\Controller;
trait SingletonController
{
protected static $instance;
/**
* Return the controller instance
* @return Controller
*/
public static function instance(): Controller
{
if (static::$instance === null) {
static::$instance = new static();
}
return static::$instance;
}
}