Skip to content

Instantly share code, notes, and snippets.

@msacar
Last active August 9, 2020 12:33
Show Gist options
  • Save msacar/e3f2ebfb98937d656a3ba5d2842b5759 to your computer and use it in GitHub Desktop.
Save msacar/e3f2ebfb98937d656a3ba5d2842b5759 to your computer and use it in GitHub Desktop.
<?php
namespace Managar;
class Gsm
{
protected static $instance = null;
public $drivers = [];
/**
* $instance field'ımıza
* sınıf instance edilmemişse
* instancelayıp değişkene kaydeder,
* sınıf zaten instancelı ise
* $instance değişkenini döndürür.
*
* @return static
*/
public static function bootIfNotBooted()
{
if (!self::$instance) {
return self::$instance = (new static);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment