Some code cleanup

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole 2016-03-14 20:53:56 +01:00
parent 114dd5fc2a
commit ababdacf89
33 changed files with 73 additions and 71 deletions

View File

@ -21,11 +21,10 @@ use Illuminate\Support\Collection;
*/
class BasicCollector
{
/** @var Collection */
private $files;
/** @var ExportJob */
protected $job;
/** @var Collection */
private $files;
/**
* BasicCollector constructor.

View File

@ -9,6 +9,7 @@ declare(strict_types = 1);
*/
namespace FireflyIII\Export\Collector;
use Illuminate\Support\Collection;
/**
@ -18,16 +19,16 @@ use Illuminate\Support\Collection;
*/
interface CollectorInterface
{
/**
* @return bool
*/
public function run();
/**
* @return Collection
*/
public function getFiles();
/**
* @return bool
*/
public function run();
/**
* @param Collection $files
*

View File

@ -21,10 +21,9 @@ use Illuminate\Support\Collection;
*/
class BasicExporter
{
private $entries;
/** @var ExportJob */
protected $job;
private $entries;
/**
* BasicExporter constructor.
@ -34,7 +33,7 @@ class BasicExporter
public function __construct(ExportJob $job)
{
$this->entries = new Collection;
$this->job = $job;
$this->job = $job;
}
/**
@ -54,5 +53,4 @@ class BasicExporter
}
}

View File

@ -9,6 +9,7 @@ declare(strict_types = 1);
*/
namespace FireflyIII\Export\Exporter;
use Illuminate\Support\Collection;
/**
@ -23,6 +24,11 @@ interface ExporterInterface
*/
public function getEntries();
/**
* @return string
*/
public function getFileName();
/**
*
*/
@ -34,9 +40,4 @@ interface ExporterInterface
*/
public function setEntries(Collection $entries);
/**
* @return string
*/
public function getFileName();
}

View File

@ -95,7 +95,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
],
];
foreach ($entries as $entry) {
$data['labels'][] = trim($entry['date']->formatLocalized($format));
$data['labels'][] = trim($entry['date']->formatLocalized($format));
$data['datasets'][0]['data'][] = floatval($entry['net-worth']);
}

View File

@ -63,6 +63,7 @@ class FireRulesForStore
}
}
return true;
}
}

View File

@ -62,6 +62,7 @@ class FireRulesForUpdate
}
}
return true;
}
}

View File

@ -33,6 +33,7 @@ class ScanForBillsAfterStore
{
$journal = $event->journal;
BillScanner::scan($journal);
return true;
}

View File

@ -32,6 +32,7 @@ class ScanForBillsAfterUpdate
{
$journal = $event->journal;
BillScanner::scan($journal);
return true;
}

View File

@ -245,7 +245,7 @@ class AssetAccount implements PostProcessorInterface
}
// create new if not exists and return that one:
/** @var \FireflyIII\Repositories\Account\AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
$accountData = [
'name' => $accountNumber,
'accountType' => 'asset',
@ -260,7 +260,7 @@ class AssetAccount implements PostProcessorInterface
'openingBalanceDate' => new Carbon,
'openingBalanceCurrency' => 1, // hard coded.
];
$account = $repository->store($accountData);
$account = $repository->store($accountData);
return $account;
}

View File

@ -15,8 +15,8 @@ use FireflyIII\Helpers\Collection\Balance;
use FireflyIII\Helpers\Collection\BalanceEntry;
use FireflyIII\Helpers\Collection\BalanceHeader;
use FireflyIII\Helpers\Collection\BalanceLine;
use FireflyIII\Models\Budget as BudgetModel;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Budget as BudgetModel;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;

View File

@ -4,7 +4,6 @@ use Auth;
use Carbon\Carbon;
use Config;
use FireflyIII\Http\Requests\NewUserFormRequest;
use FireflyIII\Models\AccountMeta;
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
use Preferences;
use Session;

View File

@ -161,7 +161,7 @@ class TransactionController extends Controller
'tags' => join(',', $journal->tags->pluck('tag')->toArray()),
];
$category = $journal->categories()->first();
$category = $journal->categories()->first();
if (!is_null($category)) {
$preFilled['category'] = $category->name;
}

View File

@ -7,6 +7,7 @@ use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Session;
/**
* Class Authenticate
*

View File

@ -4,7 +4,6 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Requests;
use Auth;
use Input;
/**
* Class TokenFormRequest
@ -30,8 +29,8 @@ class TokenFormRequest extends Request
{
$rules = [
'secret' => 'required',
'code' => 'required|2faCode:secret',
'secret' => 'required',
'code' => 'required|2faCode:secret',
];
return $rules;

View File

@ -11,12 +11,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
* Class Role
*
* @package FireflyIII\Models
* @property integer $id
* @property string $name
* @property string $display_name
* @property string $description
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $id
* @property string $name
* @property string $display_name
* @property string $description
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\User[] $users
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Role whereName($value)

View File

@ -17,12 +17,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
*
* @package FireflyIII\Models
* @property-read \FireflyIII\Models\TransactionJournal $transactionjournal
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $transaction_journal_id
* @property string $name
* @property string $data
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $transaction_journal_id
* @property string $name
* @property string $data
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereUpdatedAt($value)

View File

@ -19,7 +19,6 @@ use Illuminate\Support\ServiceProvider;
use Twig;
use TwigBridge\Extension\Loader\Functions;
use Validator;
use Auth;
/**
* Class FireflyServiceProvider

View File

@ -169,8 +169,8 @@ interface BudgetRepositoryInterface
/**
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
* @param Carbon $start
* @param Carbon $end
*
* @return string
*/

View File

@ -24,17 +24,17 @@ use FireflyIII\Models\TransactionJournal;
class AddTag implements ActionInterface
{
/** @var RuleAction */
/** @var RuleAction */
private $action;
/**
* TriggerInterface constructor.
*
* @param RuleAction $action
* @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
$this->action = $action;
$this->action = $action;
}
/**

View File

@ -27,11 +27,11 @@ class AppendDescription implements ActionInterface
/**
* TriggerInterface constructor.
*
* @param RuleAction $action
* @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
$this->action = $action;
$this->action = $action;
}
/**

View File

@ -28,11 +28,11 @@ class ClearBudget implements ActionInterface
/**
* TriggerInterface constructor.
*
* @param RuleAction $action
* @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
$this->action = $action;
$this->action = $action;
}
/**

View File

@ -28,11 +28,11 @@ class ClearCategory implements ActionInterface
/**
* TriggerInterface constructor.
*
* @param RuleAction $action
* @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
$this->action = $action;
$this->action = $action;
}
/**

View File

@ -27,11 +27,11 @@ class PrependDescription implements ActionInterface
/**
* TriggerInterface constructor.
*
* @param RuleAction $action
* @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
$this->action = $action;
$this->action = $action;
}
/**

View File

@ -27,11 +27,11 @@ class RemoveAllTags implements ActionInterface
/**
* TriggerInterface constructor.
*
* @param RuleAction $action
* @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
$this->action = $action;
$this->action = $action;
}
/**

View File

@ -30,11 +30,11 @@ class RemoveTag implements ActionInterface
/**
* TriggerInterface constructor.
*
* @param RuleAction $action
* @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
$this->action = $action;
$this->action = $action;
}
/**

View File

@ -31,11 +31,11 @@ class SetBudget implements ActionInterface
/**
* TriggerInterface constructor.
*
* @param RuleAction $action
* @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
$this->action = $action;
$this->action = $action;
}
/**

View File

@ -31,11 +31,11 @@ class SetCategory implements ActionInterface
/**
* TriggerInterface constructor.
*
* @param RuleAction $action
* @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
$this->action = $action;
$this->action = $action;
}
/**

View File

@ -27,11 +27,11 @@ class SetDescription implements ActionInterface
/**
* TriggerInterface constructor.
*
* @param RuleAction $action
* @param RuleAction $action
*/
public function __construct(RuleAction $action)
{
$this->action = $action;
$this->action = $action;
}
/**

View File

@ -51,6 +51,7 @@ class AbstractTrigger
$self = new static;
$self->triggerValue = $triggerValue;
$self->stopProcessing = $stopProcessing;
return $self;
}

View File

@ -54,7 +54,7 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac
public function triggered(TransactionJournal $journal)
{
$name = $journal->source_account_name ?? strtolower(TransactionJournal::sourceAccount($journal)->name);
$search = strtolower($this->triggerValue);
$search = strtolower($this->triggerValue);
$part = substr($name, 0, strlen($search));

View File

@ -40,9 +40,11 @@ class Steam
bcscale(2);
$balance = strval($account->transactions()->leftJoin(
'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
)->where('transaction_journals.date', '<=', $date->format('Y-m-d'))->sum('transactions.amount'));
$balance = strval(
$account->transactions()->leftJoin(
'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
)->where('transaction_journals.date', '<=', $date->format('Y-m-d'))->sum('transactions.amount')
);
if (!$ignoreVirtualBalance) {
$balance = bcadd($balance, $account->virtual_balance);

View File

@ -16,13 +16,11 @@ use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Rules\Triggers\TriggerInterface;
use FireflyIII\User;
use Input;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Validation\Validator;
use Input;
use Log;
use PragmaRX\Google2FA\Contracts\Google2FA;
use Symfony\Component\Translation\TranslatorInterface;
use Session;
/**
* Class FireflyValidator
@ -59,13 +57,13 @@ class FireflyValidator extends Validator
{
if (!is_string($value) || is_null($value) || strlen($value) <> 6) {
return false;
}
}
// Retrieve the secret from our hidden form field.
$secret = Input::get($parameters[0]);
$google2fa = app('PragmaRX\Google2FA\Google2FA');
return $google2fa->verifyKey($secret, $value);
}