Some cleaning up.

This commit is contained in:
James Cole 2015-12-29 22:48:55 +01:00
parent 95f4a83f41
commit 7cc47ca0b1
11 changed files with 114 additions and 114 deletions

View File

@ -29,6 +29,22 @@ class RabobankDescription
}
/**
* @param array $data
*/
public function setData($data)
{
$this->data = $data;
}
/**
* @param array $row
*/
public function setRow($row)
{
$this->row = $row;
}
/**
* Fixes Rabobank specific thing.
*/
@ -46,21 +62,5 @@ class RabobankDescription
}
/**
* @param array $data
*/
public function setData($data)
{
$this->data = $data;
}
/**
* @param array $row
*/
public function setRow($row)
{
$this->row = $row;
}
}

View File

@ -65,7 +65,7 @@ class ReportHelper implements ReportHelperInterface
/** @var \FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface $singleRepository */
$singleRepository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface');
$set = $repository->getCategories();
$set = $repository->getCategories();
foreach ($set as $category) {
$spent = $singleRepository->balanceInPeriod($category, $start, $end, $accounts);
$category->spent = $spent;

View File

@ -78,6 +78,7 @@ class PasswordController extends Controller
}
abort(404);
return '';
}

View File

@ -4,8 +4,8 @@ use Auth;
use Carbon\Carbon;
use FireflyIII\Http\Requests\CategoryFormRequest;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;
use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface as SCRI;
use FireflyIII\Support\CacheProperties;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
@ -69,12 +69,12 @@ class CategoryController extends Controller
}
/**
* @param SingleCategoryRepositoryInterface $repository
* @param Category $category
* @param SCRI $repository
* @param Category $category
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(SingleCategoryRepositoryInterface $repository, Category $category)
public function destroy(SCRI $repository, Category $category)
{
$name = $category->name;
@ -108,12 +108,12 @@ class CategoryController extends Controller
}
/**
* @param CategoryRepositoryInterface $repository
* @param SingleCategoryRepositoryInterface $singleRepository
* @param CRI $repository
* @param SCRI $singleRepository
*
* @return \Illuminate\View\View
*/
public function index(CategoryRepositoryInterface $repository, SingleCategoryRepositoryInterface $singleRepository)
public function index(CRI $repository, SCRI $singleRepository)
{
$categories = $repository->getCategories();
@ -127,11 +127,11 @@ class CategoryController extends Controller
}
/**
* @param CategoryRepositoryInterface $repository
* @param CRI $repository
*
* @return \Illuminate\View\View
*/
public function noCategory(CategoryRepositoryInterface $repository)
public function noCategory(CRI $repository)
{
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->startOfMonth());
@ -145,14 +145,14 @@ class CategoryController extends Controller
}
/**
* @param SingleCategoryRepositoryInterface $repository
* @param Category $category
* @param SCRI $repository
* @param Category $category
*
* @param $date
* @param $date
*
* @return \Illuminate\View\View
*/
public function showWithDate(SingleCategoryRepositoryInterface $repository, Category $category, $date)
public function showWithDate(SCRI $repository, Category $category, $date)
{
$carbon = new Carbon($date);
$range = Preferences::get('viewRange', '1M')->data;
@ -172,12 +172,12 @@ class CategoryController extends Controller
}
/**
* @param SingleCategoryRepositoryInterface $repository
* @param Category $category
* @param SCRI $repository
* @param Category $category
*
* @return \Illuminate\View\View
*/
public function show(SingleCategoryRepositoryInterface $repository, Category $category)
public function show(SCRI $repository, Category $category)
{
$hideCategory = true; // used in list.
$page = intval(Input::get('page'));
@ -227,12 +227,12 @@ class CategoryController extends Controller
}
/**
* @param CategoryFormRequest $request
* @param SingleCategoryRepositoryInterface $repository
* @param CategoryFormRequest $request
* @param SCRI $repository
*
* @return \Illuminate\Http\RedirectResponse
*/
public function store(CategoryFormRequest $request, SingleCategoryRepositoryInterface $repository)
public function store(CategoryFormRequest $request, SCRI $repository)
{
$categoryData = [
'name' => $request->input('name'),
@ -254,13 +254,13 @@ class CategoryController extends Controller
/**
* @param CategoryFormRequest $request
* @param SingleCategoryRepositoryInterface $repository
* @param Category $category
* @param CategoryFormRequest $request
* @param SCRI $repository
* @param Category $category
*
* @return \Illuminate\Http\RedirectResponse
*/
public function update(CategoryFormRequest $request, SingleCategoryRepositoryInterface $repository, Category $category)
public function update(CategoryFormRequest $request, SCRI $repository, Category $category)
{
$categoryData = [
'name' => $request->input('name'),

View File

@ -6,8 +6,8 @@ namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;
use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface as SCRI;
use FireflyIII\Support\CacheProperties;
use Illuminate\Support\Collection;
use Navigation;
@ -39,12 +39,12 @@ class CategoryController extends Controller
/**
* Show an overview for a category for all time, per month/week/year.
*
* @param SingleCategoryRepositoryInterface $repository
* @param Category $category
* @param SCRI $repository
* @param Category $category
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function all(SingleCategoryRepositoryInterface $repository, Category $category)
public function all(SCRI $repository, Category $category)
{
// oldest transaction in category:
$start = $repository->getFirstActivityDate($category);
@ -88,11 +88,11 @@ class CategoryController extends Controller
/**
* Show this month's category overview.
*
* @param CategoryRepositoryInterface $repository
* @param CRI $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function frontpage(CategoryRepositoryInterface $repository)
public function frontpage(CRI $repository)
{
$start = Session::get('start', Carbon::now()->startOfMonth());
@ -212,12 +212,12 @@ class CategoryController extends Controller
}
/**
* @param SingleCategoryRepositoryInterface $repository
* @param Category $category
* @param SCRI $repository
* @param Category $category
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function currentPeriod(SingleCategoryRepositoryInterface $repository, Category $category)
public function currentPeriod(SCRI $repository, Category $category)
{
$start = clone Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
@ -252,14 +252,14 @@ class CategoryController extends Controller
}
/**
* @param SingleCategoryRepositoryInterface $repository
* @param SCRI $repository
* @param Category $category
*
* @param $date
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function specificPeriod(SingleCategoryRepositoryInterface $repository, Category $category, $date)
public function specificPeriod(SCRI $repository, Category $category, $date)
{
$carbon = new Carbon($date);
$range = Preferences::get('viewRange', '1M')->data;
@ -300,7 +300,7 @@ class CategoryController extends Controller
* Returns a chart of what has been earned in this period in each category
* grouped by month.
*
* @param CategoryRepositoryInterface $repository
* @param CRI $repository
* @param $reportType
* @param Carbon $start
* @param Carbon $end
@ -308,7 +308,7 @@ class CategoryController extends Controller
*
* @return \Illuminate\Http\JsonResponse
*/
public function earnedInPeriod(CategoryRepositoryInterface $repository, $reportType, Carbon $start, Carbon $end, Collection $accounts)
public function earnedInPeriod(CRI $repository, $reportType, Carbon $start, Carbon $end, Collection $accounts)
{
$cache = new CacheProperties; // chart properties for cache:
$cache->addProperty($start);
@ -367,7 +367,7 @@ class CategoryController extends Controller
* Returns a chart of what has been spent in this period in each category
* grouped by month.
*
* @param CategoryRepositoryInterface $repository
* @param CRI $repository
* @param $reportType
* @param Carbon $start
* @param Carbon $end
@ -375,7 +375,7 @@ class CategoryController extends Controller
*
* @return \Illuminate\Http\JsonResponse
*/
public function spentInPeriod(CategoryRepositoryInterface $repository, $reportType, Carbon $start, Carbon $end, Collection $accounts)
public function spentInPeriod(CRI $repository, $reportType, Carbon $start, Carbon $end, Collection $accounts)
{
$cache = new CacheProperties; // chart properties for cache:
$cache->addProperty($start);

View File

@ -5,7 +5,7 @@ use Carbon\Carbon;
use FireflyIII\Helpers\Report\ReportQueryInterface;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface as CRI;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\Support\CacheProperties;
@ -60,7 +60,7 @@ class JsonController extends Controller
}
/**
* @param BillRepositoryInterface $repository
* @param BillRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
@ -173,11 +173,11 @@ class JsonController extends Controller
/**
* Returns a list of categories.
*
* @param CategoryRepositoryInterface $repository
* @param CRI $repository
*
* @return \Illuminate\Http\JsonResponse
*/
public function categories(CategoryRepositoryInterface $repository)
public function categories(CRI $repository)
{
$list = $repository->getCategories();
$return = [];

View File

@ -66,9 +66,9 @@ class ReportController extends Controller
return view(
'reports.index', compact(
'months', 'accounts', 'start', 'accountList',
'startOfMonth', 'endOfMonth', 'startOfYear', 'endOfYear'
)
'months', 'accounts', 'start', 'accountList',
'startOfMonth', 'endOfMonth', 'startOfYear', 'endOfYear'
)
);
}

View File

@ -13,7 +13,7 @@ use Illuminate\Database\Eloquent\Model;
* @property integer $transaction_journal_id
* @property \Carbon\Carbon $date
* @property float $amount
* @property \FireflyIII\Models\PiggyBank $piggyBank
* @property \FireflyIII\Models\PiggyBank $piggyBank
* @property-read \FireflyIII\Models\TransactionJournal $transactionJournal
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\PiggyBankEvent whereCreatedAt($value)

View File

@ -3,7 +3,6 @@
namespace FireflyIII\Repositories\Category;
use Carbon\Carbon;
use FireflyIII\Models\Category;
use Illuminate\Support\Collection;
/**
@ -27,6 +26,53 @@ interface CategoryRepositoryInterface
*/
public function earnedForAccounts(Collection $accounts, Carbon $start, Carbon $end);
/**
* Returns a collection of Categories appended with the amount of money that has been earned
* in these categories, based on the $accounts involved, in period X, grouped per month.
* The amount earned in category X in period X is saved in field "earned".
*
* @param $accounts
* @param $start
* @param $end
*
* @return Collection
*/
public function earnedForAccountsPerMonth(Collection $accounts, Carbon $start, Carbon $end);
/**
* Returns the amount earned without category by accounts in period.
*
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return string
*/
public function earnedNoCategoryForAccounts(Collection $accounts, Carbon $start, Carbon $end);
/**
* @return Collection
*/
public function getCategories();
/**
* Corrected for tags.
*
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function getCategoriesAndExpenses(Carbon $start, Carbon $end);
/**
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getWithoutCategory(Carbon $start, Carbon $end);
/**
* Returns a collection of Categories appended with the amount of money that has been spent
* in these categories, based on the $accounts involved, in period X.
@ -53,24 +99,6 @@ interface CategoryRepositoryInterface
*/
public function spentForAccountsPerMonth(Collection $accounts, Carbon $start, Carbon $end);
/**
* Returns a collection of Categories appended with the amount of money that has been earned
* in these categories, based on the $accounts involved, in period X, grouped per month.
* The amount earned in category X in period X is saved in field "earned".
*
* @param $accounts
* @param $start
* @param $end
*
* @return Collection
*/
public function earnedForAccountsPerMonth(Collection $accounts, Carbon $start, Carbon $end);
/**
* @return Collection
*/
public function getCategories();
/**
* Returns the amount spent without category by accounts in period.
*
@ -82,33 +110,4 @@ interface CategoryRepositoryInterface
*/
public function spentNoCategoryForAccounts(Collection $accounts, Carbon $start, Carbon $end);
/**
* Returns the amount earned without category by accounts in period.
*
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return string
*/
public function earnedNoCategoryForAccounts(Collection $accounts, Carbon $start, Carbon $end);
/**
* Corrected for tags.
*
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function getCategoriesAndExpenses(Carbon $start, Carbon $end);
/**
* @param Carbon $start
* @param Carbon $end
*
* @return Collection
*/
public function getWithoutCategory(Carbon $start, Carbon $end);
}

View File

@ -98,7 +98,6 @@ interface SingleCategoryRepositoryInterface
public function getJournals(Category $category, $page);
/**
* @param Category $category
* @param int $page

View File

@ -76,6 +76,7 @@ class Steam
* Gets the balance for the given account during the whole range, using this format:
*
* [yyyy-mm-dd] => 123,2
*
* @param Account $account
* @param Carbon $start
* @param Carbon $end