Some dependency clean up.

This commit is contained in:
James Cole 2015-07-07 19:09:45 +02:00
parent 3de57c668f
commit c00bcd78cc
23 changed files with 46 additions and 64 deletions

View File

@ -83,7 +83,8 @@ class GoogleBillChartGenerator implements BillChartGenerator
clone $result->date,
floatval($bill->amount_max),
floatval($bill->amount_min),
floatval($result->amount));
floatval($result->amount)
);
}
$chart->generate();

View File

@ -1,6 +1,5 @@
<?php namespace FireflyIII\Handlers\Events;
use App;
use FireflyIII\Events\JournalSaved;
use Log;
@ -36,7 +35,7 @@ class RescanJournal
Log::debug('Triggered saved event for journal #' . $journal->id . ' (' . $journal->description . ')');
/** @var \FireflyIII\Repositories\Bill\BillRepositoryInterface $repository */
$repository = App::make('FireflyIII\Repositories\Bill\BillRepositoryInterface');
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
$list = $journal->user->bills()->where('active', 1)->where('automatch', 1)->get();
Log::debug('Found ' . $list->count() . ' bills to check.');

View File

@ -2,7 +2,6 @@
namespace FireflyIII\Helpers\Csv;
use App;
use Auth;
use Config;
use FireflyIII\Exceptions\FireflyException;
@ -125,7 +124,7 @@ class Importer
$field = Config::get('csv.roles.' . $role . '.field');
/** @var ConverterInterface $converter */
$converter = App::make('FireflyIII\Helpers\Csv\Converter\\' . $class);
$converter = app('FireflyIII\Helpers\Csv\Converter\\' . $class);
$converter->setData($data); // the complete array so far.
$converter->setField($field);
$converter->setIndex($index);
@ -186,7 +185,7 @@ class Importer
foreach ($this->getSpecifix() as $className) {
/** @var SpecifixInterface $specifix */
$specifix = App::make('FireflyIII\Helpers\Csv\Specifix\\' . $className);
$specifix = app('FireflyIII\Helpers\Csv\Specifix\\' . $className);
$specifix->setData($this->importData);
$specifix->setRow($this->importRow);
$this->importData = $specifix->fix();
@ -196,7 +195,7 @@ class Importer
$set = Config::get('csv.post_processors');
foreach ($set as $className) {
/** @var PostProcessorInterface $postProcessor */
$postProcessor = App::make('FireflyIII\Helpers\Csv\PostProcessing\\' . $className);
$postProcessor = app('FireflyIII\Helpers\Csv\PostProcessing\\' . $className);
$postProcessor->setData($this->importData);
$this->importData = $postProcessor->process();
}

View File

@ -1,7 +1,6 @@
<?php
namespace FireflyIII\Helpers\Csv;
use App;
use Auth;
use Config;
use Crypt;
@ -137,7 +136,7 @@ class Wizard implements WizardInterface
$class = 'FireflyIII\Helpers\Csv\Mapper\\' . $mapper;
try {
/** @var MapperInterface $mapObject */
$mapObject = App::make($class);
$mapObject = app($class);
} catch (ReflectionException $e) {
throw new FireflyException('Column "' . $columnRole . '" cannot be mapped because class ' . $mapper . ' does not exist.');
}

View File

@ -2,7 +2,6 @@
namespace FireflyIII\Helpers\Report;
use App;
use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Account as AccountCollection;
use FireflyIII\Helpers\Collection\Balance;
@ -115,8 +114,8 @@ class ReportHelper implements ReportHelperInterface
*/
public function getBalanceReport(Carbon $start, Carbon $end, $shared)
{
$repository = App::make('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
$tagRepository = App::make('FireflyIII\Repositories\Tag\TagRepositoryInterface');
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
$tagRepository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
$balance = new Balance;
// build a balance header:
@ -200,15 +199,15 @@ class ReportHelper implements ReportHelperInterface
* This method generates a full report for the given period on all
* the users bills and their payments.
*
* @param Carbon $start
* @param Carbon $end
* @param Carbon $start
* @param Carbon $end
*
* @return BillCollection
*/
public function getBillReport(Carbon $start, Carbon $end)
{
/** @var \FireflyIII\Repositories\Bill\BillRepositoryInterface $repository */
$repository = App::make('FireflyIII\Repositories\Bill\BillRepositoryInterface');
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
$bills = $repository->getBills();
$collection = new BillCollection;
@ -253,7 +252,7 @@ class ReportHelper implements ReportHelperInterface
{
$object = new BudgetCollection;
/** @var \FireflyIII\Repositories\Budget\BudgetRepositoryInterface $repository */
$repository = App::make('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
$set = $repository->getBudgets();
foreach ($set as $budget) {
@ -323,7 +322,7 @@ class ReportHelper implements ReportHelperInterface
* GET CATEGORIES:
*/
/** @var \FireflyIII\Repositories\Category\CategoryRepositoryInterface $repository */
$repository = App::make('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$repository = app('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$set = $repository->getCategories();
foreach ($set as $category) {
$spent = $repository->spentInPeriodCorrected($category, $start, $end, $shared);

View File

@ -35,8 +35,8 @@ interface ReportHelperInterface
* This method generates a full report for the given period on all
* the users bills and their payments.
*
* @param Carbon $start
* @param Carbon $end
* @param Carbon $start
* @param Carbon $end
*
* @return BillCollection
*/

View File

@ -1,6 +1,5 @@
<?php namespace FireflyIII\Http\Controllers\Auth;
use App;
use Auth;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Role;
@ -109,7 +108,7 @@ class AuthController extends Controller
return redirect($this->redirectPath());
}
// @codeCoverageIgnoreStart
App::abort(500, 'Not a user!');
abort(500, 'Not a user!');
return redirect('/');
// @codeCoverageIgnoreEnd

View File

@ -2,7 +2,6 @@
namespace FireflyIII\Http\Controllers\Chart;
use App;
use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Account;
@ -31,7 +30,7 @@ class AccountController extends Controller
{
parent::__construct();
// create chart generator:
$this->generator = App::make('FireflyIII\Generator\Chart\Account\AccountChartGenerator');
$this->generator = app('FireflyIII\Generator\Chart\Account\AccountChartGenerator');
}

View File

@ -2,7 +2,6 @@
namespace FireflyIII\Http\Controllers\Chart;
use App;
use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Bill;
@ -33,7 +32,7 @@ class BillController extends Controller
{
parent::__construct();
// create chart generator:
$this->generator = App::make('FireflyIII\Generator\Chart\Bill\BillChartGenerator');
$this->generator = app('FireflyIII\Generator\Chart\Bill\BillChartGenerator');
}
/**

View File

@ -2,7 +2,6 @@
namespace FireflyIII\Http\Controllers\Chart;
use App;
use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Budget;
@ -33,7 +32,7 @@ class BudgetController extends Controller
{
parent::__construct();
// create chart generator:
$this->generator = App::make('FireflyIII\Generator\Chart\Budget\BudgetChartGenerator');
$this->generator = app('FireflyIII\Generator\Chart\Budget\BudgetChartGenerator');
}
/**

View File

@ -3,7 +3,6 @@
namespace FireflyIII\Http\Controllers\Chart;
use App;
use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Category;
@ -32,7 +31,7 @@ class CategoryController extends Controller
{
parent::__construct();
// create chart generator:
$this->generator = App::make('FireflyIII\Generator\Chart\Category\CategoryChartGenerator');
$this->generator = app('FireflyIII\Generator\Chart\Category\CategoryChartGenerator');
}

View File

@ -2,7 +2,6 @@
namespace FireflyIII\Http\Controllers\Chart;
use App;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
@ -29,7 +28,7 @@ class PiggyBankController extends Controller
{
parent::__construct();
// create chart generator:
$this->generator = App::make('FireflyIII\Generator\Chart\PiggyBank\PiggyBankChartGenerator');
$this->generator = app('FireflyIII\Generator\Chart\PiggyBank\PiggyBankChartGenerator');
}
/**

View File

@ -3,7 +3,6 @@
namespace FireflyIII\Http\Controllers\Chart;
use App;
use Carbon\Carbon;
use FireflyIII\Helpers\Report\ReportQueryInterface;
use FireflyIII\Http\Controllers\Controller;
@ -29,7 +28,7 @@ class ReportController extends Controller
{
parent::__construct();
// create chart generator:
$this->generator = App::make('FireflyIII\Generator\Chart\Report\ReportChartGenerator');
$this->generator = app('FireflyIII\Generator\Chart\Report\ReportChartGenerator');
}

View File

@ -2,7 +2,6 @@
namespace FireflyIII\Http\Controllers;
use App;
use Config;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Csv\Data;
@ -41,8 +40,8 @@ class CsvController extends Controller
throw new FireflyException('CSV Import is not enabled.');
}
$this->wizard = App::make('FireflyIII\Helpers\Csv\WizardInterface');
$this->data = App::make('FireflyIII\Helpers\Csv\Data');
$this->wizard = app('FireflyIII\Helpers\Csv\WizardInterface');
$this->data = app('FireflyIII\Helpers\Csv\Data');
}

View File

@ -72,7 +72,6 @@ class HomeController extends Controller
$count = $repository->countAccounts($types);
bcscale(2);
if ($count == 0) {
return redirect(route('new-user.index'));
}

View File

@ -133,7 +133,7 @@ class JsonController extends Controller
/** @var Bill $entry */
foreach ($unpaid as $entry) {
$current = ($entry[0]->amount_max + $entry[0]->amount_min) / 2;
$amount = bcadd($amount, $current);
$amount = bcadd($amount, $current);
}
$data = ['box' => 'bills-unpaid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];

View File

@ -3,7 +3,6 @@
namespace FireflyIII\Http\Middleware;
use App;
use Carbon\Carbon;
use Closure;
use Illuminate\Contracts\Auth\Guard;
@ -65,7 +64,7 @@ class Range
}
if (!Session::has('first')) {
/** @var \FireflyIII\Repositories\Journal\JournalRepositoryInterface $repository */
$repository = App::make('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
$repository = app('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
$journal = $repository->first();
if ($journal) {
Session::put('first', $journal->date);

View File

@ -2,7 +2,6 @@
namespace FireflyIII\Http\Requests;
use App;
use Auth;
use Carbon\Carbon;
use Exception;
@ -85,7 +84,7 @@ class JournalFormRequest extends Request
$rules['category'] = 'between:1,255';
break;
default:
App::abort(500, 'Cannot handle ' . $what);
abort(500, 'Cannot handle ' . $what);
break;
}

View File

@ -2,7 +2,6 @@
namespace FireflyIII\Providers;
use App;
use FireflyIII\Support\Amount;
use FireflyIII\Support\ExpandedForm;
use FireflyIII\Support\Navigation;
@ -38,7 +37,7 @@ class FireflyServiceProvider extends ServiceProvider
* Default Twig configuration:
*/
$config = App::make('config');
$config = app('config');
Twig::addExtension(new Functions($config));
Twig::addExtension(new PiggyBank);
Twig::addExtension(new General);

View File

@ -2,7 +2,6 @@
namespace FireflyIII\Repositories\Account;
use App;
use Auth;
use Carbon\Carbon;
use Config;
@ -505,7 +504,7 @@ class AccountRepository implements AccountRepositoryInterface
$existingAccount = Account::firstOrNullEncrypted($searchData);
if (!$existingAccount) {
Log::error('Account create error: ' . $newAccount->getErrors()->toJson());
App::abort(500);
abort(500);
// @codeCoverageIgnoreStart
}
// @codeCoverageIgnoreEnd

View File

@ -2,7 +2,6 @@
namespace FireflyIII\Repositories\Journal;
use App;
use Auth;
use Carbon\Carbon;
use DB;
@ -138,7 +137,7 @@ class JournalRepository implements JournalRepositoryInterface
public function saveTags(TransactionJournal $journal, array $array)
{
/** @var \FireflyIII\Repositories\Tag\TagRepositoryInterface $tagRepository */
$tagRepository = App::make('FireflyIII\Repositories\Tag\TagRepositoryInterface');
$tagRepository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
foreach ($array as $name) {
if (strlen(trim($name)) > 0) {
@ -287,7 +286,7 @@ class JournalRepository implements JournalRepositoryInterface
{
// create tag repository
/** @var \FireflyIII\Repositories\Tag\TagRepositoryInterface $tagRepository */
$tagRepository = App::make('FireflyIII\Repositories\Tag\TagRepositoryInterface');
$tagRepository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
// find or create all tags:
@ -344,14 +343,15 @@ class JournalRepository implements JournalRepositoryInterface
if (is_null($toAccount)) {
Log::error('"to"-account is null, so we cannot continue!');
App::abort(500, '"to"-account is null, so we cannot continue!');
abort(500, '"to"-account is null, so we cannot continue!');
// @codeCoverageIgnoreStart
}
// @codeCoverageIgnoreEnd
if (is_null($fromAccount)) {
Log::error('"from"-account is null, so we cannot continue!');
App::abort(500, '"from"-account is null, so we cannot continue!');
abort(500, '"from"-account is null, so we cannot continue!');
// @codeCoverageIgnoreStart
}

View File

@ -2,7 +2,6 @@
namespace FireflyIII\Support\Twig;
use App;
use Carbon\Carbon;
use Config;
use FireflyIII\Models\Account;
@ -74,7 +73,7 @@ class General extends Twig_Extension
{
return new Twig_SimpleFilter(
'formatAmount', function ($string) {
return App::make('amount')->format($string);
return app('amount')->format($string);
}, ['is_safe' => ['html']]
);
}
@ -86,7 +85,7 @@ class General extends Twig_Extension
{
return new Twig_SimpleFilter(
'formatTransaction', function (Transaction $transaction) {
return App::make('amount')->formatTransaction($transaction);
return app('amount')->formatTransaction($transaction);
}, ['is_safe' => ['html']]
);
}
@ -98,7 +97,7 @@ class General extends Twig_Extension
{
return new Twig_SimpleFilter(
'formatAmountPlain', function ($string) {
return App::make('amount')->format($string, false);
return app('amount')->format($string, false);
}, ['is_safe' => ['html']]
);
}
@ -110,7 +109,7 @@ class General extends Twig_Extension
{
return new Twig_SimpleFilter(
'formatJournal', function ($journal) {
return App::make('amount')->formatJournal($journal);
return app('amount')->formatJournal($journal);
}, ['is_safe' => ['html']]
);
}
@ -127,7 +126,7 @@ class General extends Twig_Extension
}
$date = Session::get('end', Carbon::now()->endOfMonth());
return App::make('steam')->balance($account, $date);
return app('steam')->balance($account, $date);
}
);
}
@ -151,7 +150,7 @@ class General extends Twig_Extension
{
return new Twig_SimpleFunction(
'getCurrencyCode', function () {
return App::make('amount')->getCurrencyCode();
return app('amount')->getCurrencyCode();
}
);
}
@ -163,7 +162,7 @@ class General extends Twig_Extension
{
return new Twig_SimpleFunction(
'getCurrencySymbol', function () {
return App::make('amount')->getCurrencySymbol();
return app('amount')->getCurrencySymbol();
}
);
}

View File

@ -3,7 +3,6 @@
namespace FireflyIII\Support\Twig;
use App;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Support\CacheProperties;
@ -156,7 +155,7 @@ class Journal extends Twig_Extension
*/
protected function relevantTagsNoTags(TransactionJournal $journal)
{
return App::make('amount')->formatJournal($journal);
return app('amount')->formatJournal($journal);
}
/**
@ -182,7 +181,7 @@ class Journal extends Twig_Extension
if ($tag->tagMode == 'balancingAct') {
// return tag formatted for a "balancing act", even if other
// tags are present.
$amount = App::make('amount')->format($journal->actual_amount, false);
$amount = app('amount')->format($journal->actual_amount, false);
$string = '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount
. '"><i class="fa fa-fw fa-refresh"></i> ' . $tag->tag . '</a>';
@ -191,7 +190,7 @@ class Journal extends Twig_Extension
if ($tag->tagMode == 'advancePayment') {
if ($journal->transactionType->type == 'Deposit') {
$amount = App::make('amount')->formatJournal($journal, false);
$amount = app('amount')->formatJournal($journal, false);
$string = '<a href="' . route('tags.show', [$tag->id]) . '" class="label label-success" title="' . $amount
. '"><i class="fa fa-fw fa-sort-numeric-desc"></i> ' . $tag->tag . '</a>';
@ -203,7 +202,7 @@ class Journal extends Twig_Extension
* the tag. The TransactionJournal should properly calculate the amount.
*/
if ($journal->transactionType->type == 'Withdrawal') {
$amount = App::make('amount')->formatJournal($journal);
$amount = app('amount')->formatJournal($journal);
$string = '<a href="' . route('tags.show', [$tag->id]) . '">' . $amount . '</a>';