firefly-iii/app/Helpers/Collector/JournalCollectorInterface.php

331 lines
7.7 KiB
PHP
Raw Normal View History

2016-11-08 13:36:09 -06:00
<?php
/**
* JournalCollectorInterface.php
2017-10-21 01:40:00 -05:00
* Copyright (c) 2017 thegrumpydictator@gmail.com
2016-11-08 13:36:09 -06:00
*
2017-10-21 01:40:00 -05:00
* This file is part of Firefly III.
2016-11-08 13:36:09 -06:00
*
2017-10-21 01:40:00 -05:00
* Firefly III is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Firefly III is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2017-12-17 07:41:58 -06:00
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
2016-11-08 13:36:09 -06:00
*/
declare(strict_types=1);
2016-11-08 13:36:09 -06:00
namespace FireflyIII\Helpers\Collector;
2016-11-08 13:36:09 -06:00
use Carbon\Carbon;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\Tag;
2017-01-30 09:57:00 -06:00
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
2016-11-08 13:36:09 -06:00
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
/**
2017-11-15 05:25:49 -06:00
* Interface JournalCollectorInterface.
2016-11-08 13:36:09 -06:00
*/
interface JournalCollectorInterface
{
2016-11-08 13:36:09 -06:00
/**
* Add a specific filter.
*
2017-04-28 13:08:04 -05:00
* @param string $filter
*
2016-12-03 13:38:13 -06:00
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function addFilter(string $filter): JournalCollectorInterface;
2016-12-03 13:38:13 -06:00
2017-10-30 11:28:43 -05:00
/**
* Get transactions with a specific amount.
*
2017-10-30 11:28:43 -05:00
* @param string $amount
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function amountIs(string $amount): JournalCollectorInterface;
2017-10-30 11:28:43 -05:00
/**
* Get transactions where the amount is less than.
*
2017-10-30 11:28:43 -05:00
* @param string $amount
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function amountLess(string $amount): JournalCollectorInterface;
2017-10-30 11:28:43 -05:00
/**
* Get transactions where the amount is more than.
*
2017-10-30 11:28:43 -05:00
* @param string $amount
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function amountMore(string $amount): JournalCollectorInterface;
2017-10-30 11:28:43 -05:00
2016-12-03 13:38:13 -06:00
/**
* Count the result.
*
2017-04-28 13:08:04 -05:00
* @return int
2016-12-03 13:38:13 -06:00
*/
2017-04-28 13:08:04 -05:00
public function count(): int;
2016-12-03 13:38:13 -06:00
2016-11-08 13:36:09 -06:00
/**
* Get all journals.
* TODO rename me.
*
2016-11-08 13:36:09 -06:00
* @return Collection
*/
public function getJournals(): Collection;
/**
* Get a paginated result.
*
2016-11-08 13:36:09 -06:00
* @return LengthAwarePaginator
*/
2016-12-03 13:38:13 -06:00
public function getPaginatedJournals(): LengthAwarePaginator;
2016-11-08 13:36:09 -06:00
/**
* Get the query.
*
* @return EloquentBuilder
*/
public function getQuery(): EloquentBuilder;
2018-06-02 12:23:46 -05:00
/**
* Set to ignore the cache.
*
2018-06-02 12:23:46 -05:00
* @return JournalCollectorInterface
*/
public function ignoreCache(): JournalCollectorInterface;
2017-04-28 13:08:04 -05:00
/**
* Remove a filter.
*
2017-04-28 13:08:04 -05:00
* @param string $filter
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function removeFilter(string $filter): JournalCollectorInterface;
2017-04-28 13:08:04 -05:00
2016-11-08 13:36:09 -06:00
/**
* Set the accounts to collect from.
*
2016-11-08 13:36:09 -06:00
* @param Collection $accounts
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setAccounts(Collection $accounts): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
2017-10-30 11:28:43 -05:00
/**
* Collect journals after a specific date.
*
2017-10-30 11:28:43 -05:00
* @param Carbon $after
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setAfter(Carbon $after): JournalCollectorInterface;
2017-10-30 11:28:43 -05:00
2016-11-08 13:36:09 -06:00
/**
* Include all asset accounts.
*
2016-11-08 13:36:09 -06:00
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setAllAssetAccounts(): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
2017-10-30 11:28:43 -05:00
/**
* Collect journals before a specific date.
*
2017-10-30 11:28:43 -05:00
* @param Carbon $before
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setBefore(Carbon $before): JournalCollectorInterface;
2017-10-30 11:28:43 -05:00
2016-11-08 13:36:09 -06:00
/**
* Set the bills to filter on.
*
2016-11-08 13:36:09 -06:00
* @param Collection $bills
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setBills(Collection $bills): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
/**
* Set the budget to filter on.
*
2016-11-08 13:36:09 -06:00
* @param Budget $budget
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setBudget(Budget $budget): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
/**
* Set the budgets to filter on.
*
* @param Collection $budgets
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setBudgets(Collection $budgets): JournalCollectorInterface;
/**
* Set the categories to filter on.
*
* @param Collection $categories
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setCategories(Collection $categories): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
/**
* Set the category to filter on.
*
2016-11-08 13:36:09 -06:00
* @param Category $category
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setCategory(Category $category): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
2018-03-10 15:38:20 -06:00
/**
* Set the journals to filter on.
*
2018-03-10 15:38:20 -06:00
* @param Collection $journals
*
* @return JournalCollectorInterface
*/
public function setJournals(Collection $journals): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
/**
* Set the page limit.
*
2016-11-08 13:36:09 -06:00
* @param int $limit
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setLimit(int $limit): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
/**
* Set the offset.
*
2016-11-08 13:36:09 -06:00
* @param int $offset
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setOffset(int $offset): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
2017-12-22 11:32:43 -06:00
/**
* Set the opposing accounts to collect from.
*
2017-12-22 11:32:43 -06:00
* @param Collection $accounts
*
* @return JournalCollectorInterface
*/
public function setOpposingAccounts(Collection $accounts): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
/**
* Set the page to get.
*
2016-11-08 13:36:09 -06:00
* @param int $page
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setPage(int $page): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
/**
* Set the date range.
*
2016-11-08 13:36:09 -06:00
* @param Carbon $start
* @param Carbon $end
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setRange(Carbon $start, Carbon $end): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
/**
* Set the tag to collect from.
*
2016-11-08 13:36:09 -06:00
* @param Tag $tag
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setTag(Tag $tag): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
2017-02-24 13:01:35 -06:00
/**
* Set the tags to collect from.
*
2017-02-24 13:01:35 -06:00
* @param Collection $tags
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setTags(Collection $tags): JournalCollectorInterface;
2017-02-24 13:01:35 -06:00
2016-11-08 13:36:09 -06:00
/**
* Set the types to collect.
*
2016-11-08 13:36:09 -06:00
* @param array $types
*
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function setTypes(array $types): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
2017-12-17 07:30:53 -06:00
/**
* Set the user.
*
2017-12-17 07:30:53 -06:00
* @param User $user
*
* @return mixed
*/
2017-01-30 09:57:00 -06:00
public function setUser(User $user);
/**
* Start the query.
*/
public function startQuery();
2016-11-20 11:31:29 -06:00
/**
* Include budget information.
*
2016-11-20 11:31:29 -06:00
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function withBudgetInformation(): JournalCollectorInterface;
2016-11-20 11:31:29 -06:00
/**
* Include category information.
*
2016-11-20 11:31:29 -06:00
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function withCategoryInformation(): JournalCollectorInterface;
2016-11-20 11:31:29 -06:00
2016-11-20 04:43:19 -06:00
/**
* Include opposing account information.
*
2016-11-20 04:43:19 -06:00
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function withOpposingAccount(): JournalCollectorInterface;
2016-11-20 04:43:19 -06:00
2016-11-08 13:36:09 -06:00
/**
* Include tranactions without a budget.
*
2016-11-08 13:36:09 -06:00
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function withoutBudget(): JournalCollectorInterface;
2016-11-08 13:36:09 -06:00
/**
* Include tranactions without a category.
*
2016-11-08 13:36:09 -06:00
* @return JournalCollectorInterface
*/
2017-11-15 05:53:55 -06:00
public function withoutCategory(): JournalCollectorInterface;
}