GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( ebbbe1...4650a2 )
by James
08:48
created

app/Services/Internal/File/EncryptService.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * EncryptService.php
4
 * Copyright (c) 2018 [email protected]
5
 *
6
 * This file is part of Firefly III.
7
 *
8
 * Firefly III is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * Firefly III is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
declare(strict_types=1);
23
24
namespace FireflyIII\Services\Internal\File;
25
26
use FireflyIII\Exceptions\FireflyException;
27
28
/**
29
 * Class EncryptService
30
 */
31
class EncryptService
32
{
33
    /**
34
     * @param string $file
35
     * @param string $key
36
     *
37
     * @throws FireflyException
38
     */
39
    public function encrypt(string $file, string $key): void
40
    {
41
        if (!file_exists($file)) {
42
            throw new FireflyException(sprintf('File "%s" does not seem to exist.', $file));
43
        }
44
        $content = file_get_contents($file);
45
        $content = Crypt::encrypt($content);
0 ignored issues
show
The type FireflyIII\Services\Internal\File\Crypt was not found. Did you mean Crypt? If so, make sure to prefix the type with \.
Loading history...
46
        $newName = sprintf('%s.upload', $key);
47
        $path    = storage_path('upload') . '/' . $newName;
48
49
        file_put_contents($path, $content);
50
    }
51
52
}
53