Code clean up.

This commit is contained in:
James Cole 2017-11-15 10:50:23 +01:00
parent 845d7d701f
commit aee17221eb
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
46 changed files with 47 additions and 93 deletions

View File

@ -34,7 +34,6 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Console\Command;
use Storage;
/**
* Class CreateExport
*

View File

@ -58,7 +58,6 @@ class DecryptAttachment extends Command
public function __construct()
{
parent::__construct();
}
/**

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands;
use DB;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountMeta;
@ -93,8 +92,6 @@ class UpgradeDatabase extends Command
$this->info('Firefly III database is up to date.');
return;
}
/**
@ -314,7 +311,6 @@ class UpgradeDatabase extends Command
$note->save();
Log::debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
$meta->delete();
}
}
@ -334,7 +330,10 @@ class UpgradeDatabase extends Command
if (!(intval($currency->id) === intval($journal->transaction_currency_id))) {
$this->line(
sprintf(
'Transfer #%d ("%s") has been updated to use %s instead of %s.', $journal->id, $journal->description, $currency->code,
'Transfer #%d ("%s") has been updated to use %s instead of %s.',
$journal->id,
$journal->description,
$currency->code,
$journal->transactionCurrency->code
)
);
@ -423,8 +422,11 @@ class UpgradeDatabase extends Command
if ($transaction->transaction_currency_id !== $currency->id && is_null($transaction->foreign_amount)) {
Log::debug(
sprintf(
'Transaction #%d has a currency setting (#%d) that should be #%d. Amount remains %s, currency is changed.', $transaction->id,
$transaction->transaction_currency_id, $currency->id, $transaction->amount
'Transaction #%d has a currency setting (#%d) that should be #%d. Amount remains %s, currency is changed.',
$transaction->id,
$transaction->transaction_currency_id,
$currency->id,
$transaction->amount
)
);
$transaction->transaction_currency_id = $currency->id;
@ -483,7 +485,6 @@ class UpgradeDatabase extends Command
// when both are zero, try to grab it from journal:
if (is_null($opposing->foreign_amount) && is_null($transaction->foreign_amount)) {
$foreignAmount = $journal->getMeta('foreign_amount');
if (is_null($foreignAmount)) {
Log::debug(sprintf('Journal #%d has missing foreign currency data, forced to do 1:1 conversion :(.', $transaction->transaction_journal_id));
@ -497,7 +498,9 @@ class UpgradeDatabase extends Command
$foreignPositive = app('steam')->positive(strval($foreignAmount));
Log::debug(
sprintf(
'Journal #%d has missing foreign currency info, try to restore from meta-data ("%s").', $transaction->transaction_journal_id, $foreignAmount
'Journal #%d has missing foreign currency info, try to restore from meta-data ("%s").',
$transaction->transaction_journal_id,
$foreignAmount
)
);
$transaction->foreign_amount = bcmul($foreignPositive, '-1');

View File

@ -59,7 +59,6 @@ class UpgradeFireflyInstructions extends Command
*/
public function handle()
{
if ($this->argument('task') === 'update') {
$this->updateInstructions();
}
@ -109,12 +108,10 @@ class UpgradeFireflyInstructions extends Command
if (substr($version, 0, $len) === $compare) {
$text = $config[$compare];
}
}
$this->showLine();
$this->boxed('');
if (is_null($text)) {
$this->boxed(sprintf('Thank you for installing Firefly III, v%s!', $version));
$this->boxedInfo('There are no extra installation instructions.');
$this->boxed('Firefly III should be ready for use.');
@ -141,7 +138,6 @@ class UpgradeFireflyInstructions extends Command
}
$line .= '+';
$this->line($line);
}
/**
@ -159,12 +155,10 @@ class UpgradeFireflyInstructions extends Command
if (substr($version, 0, $len) === $compare) {
$text = $config[$compare];
}
}
$this->showLine();
$this->boxed('');
if (is_null($text)) {
$this->boxed(sprintf('Thank you for updating to Firefly III, v%s', $version));
$this->boxedInfo('There are no extra upgrade instructions.');
$this->boxed('Firefly III should be ready for use.');

View File

@ -77,5 +77,4 @@ trait VerifiesAccessToken
return true;
}
}

View File

@ -96,7 +96,6 @@ class VerifyDatabase extends Command
$this->repairPiggyBanks();
$this->createLinkTypes();
$this->createAccessTokens();
}
/**
@ -208,7 +207,10 @@ class VerifyDatabase extends Command
foreach ($set as $entry) {
$line = sprintf(
'User #%d (%s) has budget #%d ("%s") which has no budget limits.',
$entry->user_id, $entry->email, $entry->id, $entry->name
$entry->user_id,
$entry->email,
$entry->id,
$entry->name
);
$this->line($line);
}
@ -327,7 +329,6 @@ class VerifyDatabase extends Command
'Error: Journal #' . $entry->id . ' has zero transactions. Open table "transaction_journals" and delete the entry with id #' . $entry->id
);
}
}
/**
@ -349,7 +350,6 @@ class VerifyDatabase extends Command
/** @var stdClass $entry */
foreach ($set as $entry) {
$objName = $entry->name;
try {
$objName = Crypt::decrypt($objName);
@ -359,7 +359,11 @@ class VerifyDatabase extends Command
$line = sprintf(
'User #%d (%s) has %s #%d ("%s") which has no transactions.',
$entry->user_id, $entry->email, $name, $entry->id, $objName
$entry->user_id,
$entry->email,
$name,
$entry->id,
$objName
);
$this->line($line);
}
@ -419,11 +423,10 @@ class VerifyDatabase extends Command
$this->error(
sprintf(
'Error: Transaction journal #%d is a %s, but has a budget. Edit it without changing anything, so the budget will be removed.',
$entry->id, $entry->transactionType->type
$entry->id,
$entry->transactionType->type
)
);
}
}
}

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Events;
use FireflyIII\User;
use Illuminate\Queue\SerializesModels;
use Log;

View File

@ -52,5 +52,4 @@ class RequestedNewPassword extends Event
$this->token = $token;
$this->ipAddress = $ipAddress;
}
}

View File

@ -33,7 +33,6 @@ use Illuminate\Queue\SerializesModels;
*/
class StoredTransactionJournal extends Event
{
use SerializesModels;
/** @var TransactionJournal */
@ -52,7 +51,5 @@ class StoredTransactionJournal extends Event
//
$this->journal = $journal;
$this->piggyBankId = $piggyBankId;
}
}

View File

@ -33,7 +33,6 @@ use Illuminate\Queue\SerializesModels;
*/
class UpdatedTransactionJournal extends Event
{
use SerializesModels;
/** @var TransactionJournal */
@ -49,5 +48,4 @@ class UpdatedTransactionJournal extends Event
//
$this->journal = $journal;
}
}

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Exceptions;
/**
* Class FireflyException
*
@ -31,5 +30,4 @@ namespace FireflyIII\Exceptions;
*/
class FireflyException extends \Exception
{
}
}

View File

@ -39,7 +39,6 @@ use FireflyIII\Jobs\MailError;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Request;
class Handler extends ExceptionHandler
{
/**
@ -73,7 +72,6 @@ class Handler extends ExceptionHandler
public function render($request, Exception $exception)
{
if ($exception instanceof FireflyException || $exception instanceof ErrorException) {
$isDebug = env('APP_DEBUG', false);
return response()->view('errors.FireflyException', ['exception' => $exception, 'debug' => $isDebug], 500);

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Exceptions;
/**
* Class NotImplementedException
*
@ -31,5 +30,4 @@ namespace FireflyIII\Exceptions;
*/
class NotImplementedException extends \Exception
{
}
}

View File

@ -30,5 +30,4 @@ namespace FireflyIII\Exceptions;
*/
class ValidationException extends \Exception
{
}
}

View File

@ -104,11 +104,9 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
$exportFile = $this->exportFileName($attachment);
$this->exportDisk->put($exportFile, $decrypted);
$this->getEntries()->push($exportFile);
} catch (DecryptException $e) {
Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage());
}
}
return true;
@ -123,7 +121,6 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
*/
private function exportFileName($attachment): string
{
return sprintf('%s-Attachment nr. %s - %s', $this->job->key, strval($attachment->id), $attachment->filename);
}

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Export\Collector;
use FireflyIII\Models\ExportJob;
use FireflyIII\User;
use Illuminate\Support\Collection;
@ -82,6 +81,4 @@ class BasicCollector
{
$this->user = $user;
}
}

View File

@ -57,5 +57,4 @@ interface CollectorInterface
* @return mixed
*/
public function setJob(ExportJob $job);
}

View File

@ -116,5 +116,4 @@ class UploadCollector extends BasicCollector implements CollectorInterface
return true;
}
}

View File

@ -122,7 +122,8 @@ final class Entry
? null
: strval(
round(
$transaction->transaction_foreign_amount, $transaction->foreignCurrency->decimal_places
$transaction->transaction_foreign_amount,
$transaction->foreignCurrency->decimal_places
)
);
@ -166,6 +167,4 @@ final class Entry
return $entry;
}
}

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Export;
use Crypt;
use DB;
use FireflyIII\Exceptions\FireflyException;
@ -136,7 +135,6 @@ class ExpandedProcessor implements ProcessorInterface
$transaction->opposing_account_number = $ibans[$opposingId]['accountNumber'] ?? '';
$transaction->opposing_account_bic = $ibans[$opposingId]['BIC'] ?? '';
$transaction->opposing_currency_code = $currencies[$opposingCurrencyId] ?? '';
}
);

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Export\Exporter;
use FireflyIII\Models\ExportJob;
use Illuminate\Support\Collection;
@ -70,6 +69,4 @@ class BasicExporter
{
$this->job = $job;
}
}

View File

@ -60,5 +60,4 @@ interface ExporterInterface
* @param ExportJob $job
*/
public function setJob(ExportJob $job);
}

View File

@ -88,5 +88,4 @@ interface GeneratorInterface
* @return array
*/
public function singleSet(string $setLabel, array $data): array;
}

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Audit;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@ -52,8 +51,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
*/
public function generate(): string
{
$auditData = [];
$dayBefore = clone $this->start;
$dayBefore->subDay();
@ -81,7 +78,6 @@ class MonthReportGenerator implements ReportGeneratorInterface
return view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))
->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts)
->render();
}
/**

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Audit;
/**
* Class MultiYearReportGenerator
*

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Audit;
/**
* Class YearReportGenerator
*

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Budget;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Generator\Report\Support;

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Budget;
/**
* Class MultiYearReportGenerator
*

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Budget;
/**
* Class YearReportGenerator
*

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Category;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Generator\Report\Support;
@ -88,7 +87,15 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
return view(
'reports.category.month',
compact(
'accountIds', 'categoryIds', 'topIncome', 'reportType', 'accountSummary', 'categorySummary', 'averageExpenses', 'averageIncome', 'topExpenses'
'accountIds',
'categoryIds',
'topIncome',
'reportType',
'accountSummary',
'categorySummary',
'averageExpenses',
'averageIncome',
'topExpenses'
)
)
->with('start', $this->start)->with('end', $this->end)

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Category;
/**
* Class MultiYearReportGenerator
*

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Category;
/**
* Class YearReportGenerator
*

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report;
use Carbon\Carbon;
use Illuminate\Support\Collection;
@ -80,5 +79,4 @@ interface ReportGeneratorInterface
* @return ReportGeneratorInterface
*/
public function setTags(Collection $tags): ReportGeneratorInterface;
}

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Standard;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Helpers\Report\ReportHelperInterface;

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Standard;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use Illuminate\Support\Collection;

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Standard;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use Illuminate\Support\Collection;

View File

@ -26,7 +26,6 @@ namespace FireflyIII\Generator\Report;
use FireflyIII\Models\Transaction;
use Illuminate\Support\Collection;
/**
* Class Support
*
@ -153,5 +152,4 @@ class Support
return $result;
}
}

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Tag;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Generator\Report\Support;
@ -88,8 +87,16 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
// render!
return view(
'reports.tag.month', compact(
'accountIds', 'tagTags', 'reportType', 'accountSummary', 'tagSummary', 'averageExpenses', 'averageIncome', 'topIncome',
'reports.tag.month',
compact(
'accountIds',
'tagTags',
'reportType',
'accountSummary',
'tagSummary',
'averageExpenses',
'averageIncome',
'topIncome',
'topExpenses'
)
)->with('start', $this->start)->with('end', $this->end)->with('tags', $this->tags)->with('accounts', $this->accounts)->render();

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Tag;
/**
* Class MultiYearReportGenerator
*

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Generator\Report\Tag;
/**
* Class YearReportGenerator
*

View File

@ -44,7 +44,6 @@ class AdminEventHandler
*/
public function sendTestMessage(AdminRequestedTestMessage $event): bool
{
$email = $event->user->email;
$ipAddress = $event->ipAddress;

View File

@ -137,7 +137,6 @@ class StoredJournalEventHandler
$rules = $this->ruleGroupRepository->getActiveStoreRules($group);
/** @var Rule $rule */
foreach ($rules as $rule) {
$processor = Processor::make($rule);
$processor->handleTransactionJournal($journal);

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Handlers\Events;
use FireflyIII\Events\UpdatedTransactionJournal;
use FireflyIII\Models\Rule;
use FireflyIII\Models\RuleGroup;
@ -77,7 +76,6 @@ class UpdatedJournalEventHandler
if ($rule->stop_processing) {
break;
}
}
}

View File

@ -152,7 +152,6 @@ class UserEventHandler
*/
public function sendRegistrationMail(RegisteredUser $event)
{
$sendMail = env('SEND_REGISTRATION_MAIL', true);
if (!$sendMail) {
return true; // @codeCoverageIgnore

View File

@ -66,5 +66,4 @@ interface AttachmentHelperInterface
* @return bool
*/
public function saveAttachmentsForModel(Model $model, ?array $files): bool;
}

View File

@ -52,5 +52,4 @@ interface FiscalHelperInterface
* @return Carbon date object
*/
public function startOfFiscalYear(Carbon $date): Carbon;
}