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