Skip to content

Instantly share code, notes, and snippets.

@msacar
Last active August 9, 2020 16:34
Show Gist options
  • Save msacar/d53363f112dae94e0da1ca634ea65a0d to your computer and use it in GitHub Desktop.
Save msacar/d53363f112dae94e0da1ca634ea65a0d to your computer and use it in GitHub Desktop.
<?php
//Gsm.php ye ekliyoruz
/**
* Managar olan Gsm sınıfında,
* Erişilmeye çalışan static method yoksa;
* Gsm sınıfı kendini instance eder ve kendinden bu method çağr
*
* @param $method
* @param $args
* @return mixed
*/
public static function __callStatic($method, $args)
{
self::bootIfNotBooted();
return self::$instance->$method(...$args);
}
/**
* Managar olan ve instance edilmiş Gsm sınıfında,
* Erişilmeye çalışan method yoksa;
* Driver alınır ve driver üzerinden method çalıştırılır
*
* @param $method
* @param $args
* @return mixed
*/
public function __call($method, $args)
{
return $this->_driver()->$method(...$args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment