1 | <?php |
||
8 | class FileVault |
||
9 | { |
||
10 | /** |
||
11 | * The storage disk. |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $disk; |
||
16 | |||
17 | /** |
||
18 | * The encryption key. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $key; |
||
23 | |||
24 | /** |
||
25 | * The algorithm used for encryption. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $cipher; |
||
30 | |||
31 | /** |
||
32 | * The storage adapter. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $adapter; |
||
37 | |||
38 | public function __construct() |
||
44 | |||
45 | /** |
||
46 | * Set the disk where the files are located. |
||
47 | * |
||
48 | * @param string $disk |
||
49 | * @return $this |
||
50 | */ |
||
51 | public function disk($disk) |
||
57 | |||
58 | /** |
||
59 | * Set the encryption key. |
||
60 | * |
||
61 | * @param string $key |
||
62 | * @return $this |
||
63 | */ |
||
64 | public function key($key) |
||
70 | |||
71 | /** |
||
72 | * Create a new encryption key for the given cipher. |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | public static function generateKey() |
||
80 | |||
81 | /** |
||
82 | * Encrypt the passed file and saves the result in a new file with ".enc" as suffix. |
||
83 | * |
||
84 | * @param string $sourceFile Path to file that should be encrypted, relative to the storage disk specified |
||
85 | * @param string $destFile File name where the encryped file should be written to, relative to the storage disk specified |
||
86 | * @return $this |
||
87 | */ |
||
88 | public function encrypt($sourceFile, $destFile = null, $deleteSource = true) |
||
109 | |||
110 | public function encryptCopy($sourceFile, $destFile = null) |
||
114 | |||
115 | /** |
||
116 | * Dencrypt the passed file and saves the result in a new file, removing the |
||
117 | * last 4 characters from file name. |
||
118 | * |
||
119 | * @param string $sourceFile Path to file that should be decrypted |
||
120 | * @param string $destFile File name where the decryped file should be written to. |
||
121 | * @return $this |
||
122 | */ |
||
123 | public function decrypt($sourceFile, $destFile = null, $deleteSource = true) |
||
146 | |||
147 | public function decryptCopy($sourceFile, $destFile = null) |
||
151 | |||
152 | public function streamDecrypt($sourceFile) |
||
163 | |||
164 | protected function getFilePath($file) |
||
172 | |||
173 | protected function isS3File() |
||
177 | |||
178 | protected function setAdapter() |
||
186 | |||
187 | protected function registerServices() |
||
196 | } |
||
197 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.