summaryrefslogtreecommitdiff
path: root/src/Singleton.php
blob: 3238248ae64a4e1d58a3fae50adcf8953abf2909 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

namespace App;

trait Singleton
{
  private static self $instance;

  public static function getInstance(): static
  {
    if (! isset(self::$instance)) {
      self::$instance = new static();
    }

    return self::$instance;
  }
}