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.

Issues (724)

Import/JobConfiguration/FinTSJobConfiguration.php (2 issues)

1
<?php
2
/**
3
 * FinTSJobConfiguration.php
4
 * Copyright (c) 2019 https://github.com/bnw
5
 *
6
 * This file is part of Firefly III (https://github.com/firefly-iii).
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License as
10
 * published by the Free Software Foundation, either version 3 of the
11
 * License, or (at your option) any later version.
12
 *
13
 * This program 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 Affero General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public License
19
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
 */
21
declare(strict_types=1);
22
23
namespace FireflyIII\Import\JobConfiguration;
24
25
use FireflyIII\Exceptions\FireflyException;
26
use FireflyIII\Models\ImportJob;
27
use FireflyIII\Support\Import\JobConfiguration\FinTS\ChooseAccountHandler;
28
use FireflyIII\Support\Import\JobConfiguration\FinTS\FinTSConfigurationInterface;
29
use FireflyIII\Support\Import\JobConfiguration\FinTS\NewFinTSJobHandler;
30
use Illuminate\Support\MessageBag;
31
32
/**
33
 *
34
 * Class FinTSJobConfiguration
35
 *
36
 * @deprecated
37
 * @codeCoverageIgnore
38
 */
39
class FinTSJobConfiguration implements JobConfigurationInterface
0 ignored issues
show
Deprecated Code introduced by
The interface FireflyIII\Import\JobCon...bConfigurationInterface has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

39
class FinTSJobConfiguration implements /** @scrutinizer ignore-deprecated */ JobConfigurationInterface

This interface has been deprecated. The supplier of the interface has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.

Loading history...
40
{
41
    /** @var ImportJob */
42
    private $importJob;
43
44
    /**
45
     * Returns true when the initial configuration for this job is complete.
46
     *
47
     * @return bool
48
     */
49
    public function configurationComplete(): bool
50
    {
51
        return $this->importJob->stage === FinTSConfigurationSteps::GO_FOR_IMPORT;
52
    }
53
54
    /**
55
     * Store any data from the $data array into the job. Anything in the message bag will be flashed
56
     * as an error to the user, regardless of its content.
57
     *
58
     * @param array $data
59
     *
60
     * @throws FireflyException
61
     * @return MessageBag
62
     */
63
    public function configureJob(array $data): MessageBag
64
    {
65
        return $this->getConfigurationObject()->configureJob($data);
66
    }
67
68
    /**
69
     * Return the data required for the next step in the job configuration.
70
     *
71
     * @throws FireflyException
72
     * @return array
73
     */
74
    public function getNextData(): array
75
    {
76
        return $this->getConfigurationObject()->getNextData();
77
    }
78
79
    /**
80
     * Returns the view of the next step in the job configuration.
81
     *
82
     * @throws FireflyException
83
     * @return string
84
     */
85
    public function getNextView(): string
86
    {
87
        switch ($this->importJob->stage) {
88
            case FinTSConfigurationSteps::NEW:
89
            case FinTSConfigurationSteps::CHOOSE_ACCOUNT:
90
                return 'import.fints.' . $this->importJob->stage;
91
                break;
0 ignored issues
show
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
92
            default:
93
                // @codeCoverageIgnoreStart
94
                throw new FireflyException(
95
                    sprintf('FinTSJobConfiguration::getNextView() cannot handle stage "%s"', $this->importJob->stage)
96
                );
97
            // @codeCoverageIgnoreEnd
98
        }
99
    }
100
101
    /**
102
     * @param ImportJob $importJob
103
     */
104
    public function setImportJob(ImportJob $importJob): void
105
    {
106
        $this->importJob = $importJob;
107
    }
108
109
    /**
110
     * Get the configuration handler for this specific stage.
111
     *
112
     * @throws FireflyException
113
     * @return FinTSConfigurationInterface
114
     */
115
    private function getConfigurationObject(): FinTSConfigurationInterface
116
    {
117
        $class = 'DoNotExist';
118
        switch ($this->importJob->stage) {
119
            case FinTSConfigurationSteps::NEW:
120
                $class = NewFinTSJobHandler::class;
121
                break;
122
            case FinTSConfigurationSteps::CHOOSE_ACCOUNT:
123
                $class = ChooseAccountHandler::class;
124
                break;
125
        }
126
        if (!class_exists($class)) {
127
            throw new FireflyException(sprintf('Class %s does not exist in getConfigurationClass().', $class)); // @codeCoverageIgnore
128
        }
129
130
        $configurator = app($class);
131
        $configurator->setImportJob($this->importJob);
132
133
        return $configurator;
134
    }
135
136
137
}
138