Skip to content

Instantly share code, notes, and snippets.

@elishaukpong
Last active January 11, 2023 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elishaukpong/e57cbb8554f5ab5d8dd3917c190769fd to your computer and use it in GitHub Desktop.
Save elishaukpong/e57cbb8554f5ab5d8dd3917c190769fd to your computer and use it in GitHub Desktop.
<?php
...
/**
* Handle dynamic, static calls to the object.
*
* @param string $method
* @param array $args
* @return mixed
*
* @throws \RuntimeException
*/
public static function __callStatic($method, $args)
{
$instance = static::getFacadeRoot();
if (! $instance) {
throw new RuntimeException('A facade root has not been set.');
}
return $instance->$method(...$args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment