Various code cleanup.

This commit is contained in:
James Cole
2017-12-22 18:32:43 +01:00
parent f13a93348f
commit 8bd76d1ff0
188 changed files with 383 additions and 396 deletions

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Import;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Middleware\IsDemoUser;
@@ -66,6 +64,7 @@ class ConfigurationController extends Controller
* @param ImportJob $job
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
*
* @throws FireflyException
*/
public function index(ImportJob $job)
@@ -95,6 +94,7 @@ class ConfigurationController extends Controller
* @param ImportJob $job
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*
* @throws FireflyException
*/
public function post(Request $request, ImportJob $job)
@@ -141,4 +141,4 @@ class ConfigurationController extends Controller
return $configurator;
}
}
}

View File

@@ -18,16 +18,13 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Import;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Import\Routine\ImportRoutine;
use FireflyIII\Import\Routine\RoutineInterface;
use FireflyIII\Models\ImportJob;
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
@@ -61,7 +58,7 @@ class IndexController extends Controller
}
);
$this->middleware(IsDemoUser::class)->except(['create','index']);
$this->middleware(IsDemoUser::class)->except(['create', 'index']);
}
/**
@@ -70,11 +67,12 @@ class IndexController extends Controller
* @param string $bank
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*
* @throws FireflyException
*/
public function create(string $bank)
{
if (!(config(sprintf('import.enabled.%s', $bank))) === true) {
if (true === !(config(sprintf('import.enabled.%s', $bank)))) {
throw new FireflyException(sprintf('Cannot import from "%s" at this time.', $bank));
}
@@ -82,7 +80,6 @@ class IndexController extends Controller
// from here, always go to configure step.
return redirect(route('import.configure', [$importJob->key]));
}
/**
@@ -139,11 +136,11 @@ class IndexController extends Controller
* @param ImportJob $job
*
* @return \Illuminate\Http\JsonResponse
*
* @throws FireflyException
*/
public function start(ImportJob $job)
{
$type = $job->file_type;
$key = sprintf('import.routine.%s', $type);
$className = config($key);
@@ -162,5 +159,4 @@ class IndexController extends Controller
throw new FireflyException('Job did not complete successfully. Please review the log files.');
}
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Import;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Import\Prerequisites\PrerequisitesInterface;
@@ -43,11 +41,12 @@ class PrerequisitesController extends Controller
* @param string $bank
*
* @return \Illuminate\Http\RedirectResponse|null
*
* @throws FireflyException
*/
public function index(string $bank)
{
if (!(config(sprintf('import.enabled.%s', $bank))) === true) {
if (true === !(config(sprintf('import.enabled.%s', $bank)))) {
throw new FireflyException(sprintf('Cannot import from "%s" at this time.', $bank));
}
$class = strval(config(sprintf('import.prerequisites.%s', $bank)));
@@ -83,6 +82,7 @@ class PrerequisitesController extends Controller
* @param string $bank
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*
* @throws FireflyException
*/
public function post(Request $request, string $bank)
@@ -112,6 +112,4 @@ class PrerequisitesController extends Controller
return redirect(route('import.create-job', [$bank]));
}
}
}

View File

@@ -18,12 +18,10 @@
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Import;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\ImportJob;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
@@ -34,7 +32,6 @@ use Response;
*/
class StatusController extends Controller
{
/**
*
*/
@@ -115,5 +112,4 @@ class StatusController extends Controller
return Response::json($result);
}
}
}