This repository was archived by the owner on Apr 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathEncryptionFacade.php
61 lines (54 loc) · 1.55 KB
/
EncryptionFacade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* src/EncryptionFacade.php.
*
* @author Austin Heap <me@austinheap.com>
* @version v0.2.1
*/
declare(strict_types=1);
namespace AustinHeap\Database\Encryption;
use RuntimeException;
/**
* EncryptionFacade.
*
* @link https://github.com/austinheap/laravel-database-encryption
* @link https://packagist.org/packages/austinheap/laravel-database-encryption
* @link https://austinheap.github.io/laravel-database-encryption/classes/AustinHeap.Database.Encryption.EncryptionFacade.html
*/
class EncryptionFacade extends \Illuminate\Support\Facades\Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
public static function getFacadeAccessor()
{
return 'DatabaseEncryption';
}
/**
* Get the singleton of EncryptionHelper.
*
* @return EncryptionHelper
*/
public static function getInstance()
{
return app(self::getFacadeAccessor());
}
/**
* 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::getInstance();
throw_if(! $instance, RuntimeException::class, 'A facade root has not been set.');
throw_if(! method_exists($instance, $method), RuntimeException::class, 'Method "'.$method.'" does not exist on "'.get_class($instance).'".');
return $instance->$method(...$args);
}
}