1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* src/helpers.php. |
4
|
|
|
* |
5
|
|
|
* @author Austin Heap <[email protected]> |
6
|
|
|
* @version v0.2.1 |
7
|
|
|
*/ |
8
|
|
|
declare(strict_types=1); |
9
|
|
|
|
10
|
|
|
if (! function_exists('database_encryption')) { |
11
|
|
|
/** |
12
|
|
|
* @return \AustinHeap\Database\Encryption\EncryptionHelper |
13
|
|
|
*/ |
14
|
|
|
function database_encryption(): \AustinHeap\Database\Encryption\EncryptionHelper |
15
|
|
|
{ |
16
|
|
|
return \AustinHeap\Database\Encryption\EncryptionFacade::getInstance(); |
17
|
|
|
} |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
if (! function_exists('db_encryption')) { |
21
|
|
|
/** |
22
|
|
|
* @return \AustinHeap\Database\Encryption\EncryptionHelper |
23
|
|
|
*/ |
24
|
|
|
function db_encryption(): \AustinHeap\Database\Encryption\EncryptionHelper |
25
|
|
|
{ |
26
|
|
|
return database_encryption(); |
27
|
|
|
} |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
if (! function_exists('dbencryption')) { |
31
|
|
|
/** |
32
|
|
|
* @return \AustinHeap\Database\Encryption\EncryptionHelper |
33
|
|
|
*/ |
34
|
|
|
function dbencryption(): \AustinHeap\Database\Encryption\EncryptionHelper |
35
|
|
|
{ |
36
|
|
|
return database_encryption(); |
37
|
|
|
} |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
if (! function_exists('database_encrypt')) { |
41
|
|
|
/** |
42
|
|
|
* @return null|string |
43
|
|
|
*/ |
44
|
|
|
function database_encrypt(?string $value = null): ?string |
|
|
|
|
45
|
|
|
{ |
46
|
|
|
return __FUNCTION__.': FUNCTION-NOT-IMPLEMENTED'; |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
if (! function_exists('db_encrypt')) { |
51
|
|
|
/** |
52
|
|
|
* @return null|string |
53
|
|
|
*/ |
54
|
|
|
function db_encrypt(?string $value = null): ?string |
55
|
|
|
{ |
56
|
|
|
return database_encrypt($value); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
if (! function_exists('dbencrypt')) { |
61
|
|
|
/** |
62
|
|
|
* @return null|string |
63
|
|
|
*/ |
64
|
|
|
function dbencrypt(?string $value = null): ?string |
65
|
|
|
{ |
66
|
|
|
return database_encrypt($value); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
if (! function_exists('database_decrypt')) { |
71
|
|
|
/** |
72
|
|
|
* @return null|string |
73
|
|
|
*/ |
74
|
|
|
function database_decrypt(string $value): ?string |
|
|
|
|
75
|
|
|
{ |
76
|
|
|
return __FUNCTION__.': FUNCTION-NOT-IMPLEMENTED'; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
if (! function_exists('db_decrypt')) { |
81
|
|
|
/** |
82
|
|
|
* @return null|string |
83
|
|
|
*/ |
84
|
|
|
function db_decrypt(string $value): ?string |
85
|
|
|
{ |
86
|
|
|
return database_decrypt($value); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
if (! function_exists('dbdecrypt')) { |
91
|
|
|
/** |
92
|
|
|
* @return null|string |
93
|
|
|
*/ |
94
|
|
|
function dbdecrypt(string $value): ?string |
95
|
|
|
{ |
96
|
|
|
return database_decrypt($value); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.