1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
SingletonTrait.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Im\V2\Common;
6
7use RuntimeException;
8
10{
11 protected static ?self $instance = null;
12
13 public static function getInstance(): static
14 {
15 if (static::$instance === null)
16 {
17 static::$instance = new static();
18 }
19
20 return static::$instance;
21 }
22
23 private function __construct()
24 {
25 }
26
27 public function __clone()
28 {
29 throw new RuntimeException('Cannot clone a singleton');
30 }
31
32 public function __wakeup()
33 {
34 throw new RuntimeException('Cannot wake up a singleton');
35 }
36}
__wakeup()
Определения SingletonTrait.php:32
trait SingletonTrait
Определения SingletonTrait.php:10
__clone()
Определения SingletonTrait.php:27
$instance
Определения ps_b24_final.php:14