Code clean up and reformat.

This commit is contained in:
James Cole
2014-11-12 22:37:09 +01:00
parent 258d6a1688
commit 4aa9a04516
33 changed files with 1543 additions and 1611 deletions

View File

@@ -4,12 +4,12 @@ namespace FireflyIII\Database;
use Carbon\Carbon;
use FireflyIII\Exception\NotImplementedException;
use Illuminate\Support\Collection;
use LaravelBook\Ardent\Ardent;
use FireflyIII\Database\Ifaces\CommonDatabaseCalls;
use FireflyIII\Database\Ifaces\CUD;
use FireflyIII\Database\Ifaces\RecurringInterface;
use FireflyIII\Exception\NotImplementedException;
use Illuminate\Support\Collection;
use LaravelBook\Ardent\Ardent;
/**
* Class Recurring
@@ -28,30 +28,6 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
$this->setUser(\Auth::user());
}
/**
* @param \RecurringTransaction $recurring
* @param Carbon $start
* @param Carbon $end
*
* @return \TransactionJournal|null
*/
public function getJournalForRecurringInRange(\RecurringTransaction $recurring, Carbon $start, Carbon $end)
{
return $this->getUser()->transactionjournals()->where('recurring_transaction_id', $recurring->id)->after($start)->before($end)->first();
}
/**
* Returns all objects.
*
* @return Collection
*/
public function get()
{
return $this->getUser()->recurringtransactions()->get();
}
/**
* @param Ardent $model
*
@@ -64,16 +40,25 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
}
/**
* Validates a model. Returns an array containing MessageBags
* errors/warnings/successes.
* @param array $data
*
* @param Ardent $model
*
* @return array
* @return Ardent
*/
public function validateObject(Ardent $model)
public function store(array $data)
{
// TODO: Implement validateObject() method.
// TODO: Implement store() method.
throw new NotImplementedException;
}
/**
* @param Ardent $model
* @param array $data
*
* @return bool
*/
public function update(Ardent $model, array $data)
{
// TODO: Implement update() method.
throw new NotImplementedException;
}
@@ -92,25 +77,16 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
}
/**
* @param array $data
* Validates a model. Returns an array containing MessageBags
* errors/warnings/successes.
*
* @return Ardent
*/
public function store(array $data)
{
// TODO: Implement store() method.
throw new NotImplementedException;
}
/**
* @param Ardent $model
* @param array $data
*
* @return bool
* @return array
*/
public function update(Ardent $model, array $data)
public function validateObject(Ardent $model)
{
// TODO: Implement update() method.
// TODO: Implement validateObject() method.
throw new NotImplementedException;
}
@@ -127,17 +103,6 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
throw new NotImplementedException;
}
/**
* @param array $ids
*
* @return Collection
*/
public function getByIds(array $ids)
{
// TODO: Implement getByIds() method.
throw new NotImplementedException;
}
/**
* Finds an account type using one of the "$what"'s: expense, asset, revenue, opening, etc.
*
@@ -150,4 +115,38 @@ class Recurring implements CUD, CommonDatabaseCalls, RecurringInterface
// TODO: Implement findByWhat() method.
throw new NotImplementedException;
}
/**
* Returns all objects.
*
* @return Collection
*/
public function get()
{
return $this->getUser()->recurringtransactions()->get();
}
/**
* @param array $ids
*
* @return Collection
*/
public function getByIds(array $ids)
{
// TODO: Implement getByIds() method.
throw new NotImplementedException;
}
/**
* @param \RecurringTransaction $recurring
* @param Carbon $start
* @param Carbon $end
*
* @return \TransactionJournal|null
*/
public function getJournalForRecurringInRange(\RecurringTransaction $recurring, Carbon $start, Carbon $end)
{
return $this->getUser()->transactionjournals()->where('recurring_transaction_id', $recurring->id)->after($start)->before($end)->first();
}
}