mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
First part of a large code cleanup commit.
This commit is contained in:
@@ -26,9 +26,7 @@ namespace FireflyIII\Transformers;
|
||||
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
use Log;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
/**
|
||||
* Class AttachmentTransformer
|
||||
@@ -67,7 +65,7 @@ class AttachmentTransformer extends AbstractTransformer
|
||||
'created_at' => $attachment->created_at->toAtomString(),
|
||||
'updated_at' => $attachment->updated_at->toAtomString(),
|
||||
'attachable_id' => $attachment->attachable_id,
|
||||
'attachable_type' => str_replace('FireflyIII\\Models\\','',$attachment->attachable_type),
|
||||
'attachable_type' => str_replace('FireflyIII\\Models\\', '', $attachment->attachable_type),
|
||||
'md5' => $attachment->md5,
|
||||
'filename' => $attachment->filename,
|
||||
'download_uri' => route('api.v1.attachments.download', [$attachment->id]),
|
||||
|
@@ -86,7 +86,7 @@ class AvailableBudgetTransformer extends AbstractTransformer
|
||||
$end = $this->parameters->get('end');
|
||||
if (null !== $start && null !== $end) {
|
||||
$data['spent_in_budgets'] = $this->getSpentInBudgets();
|
||||
$data['spent_no_budget'] = $this->spentOutsideBudgets();
|
||||
$data['spent_no_budget'] = $this->spentOutsideBudgets();
|
||||
}
|
||||
|
||||
return $data;
|
||||
@@ -98,6 +98,7 @@ class AvailableBudgetTransformer extends AbstractTransformer
|
||||
private function getSpentInBudgets(): array
|
||||
{
|
||||
$allActive = $this->repository->getActiveBudgets();
|
||||
|
||||
return $this->repository->spentInPeriodMc(
|
||||
$allActive, new Collection, $this->parameters->get('start'), $this->parameters->get('end')
|
||||
);
|
||||
@@ -109,7 +110,7 @@ class AvailableBudgetTransformer extends AbstractTransformer
|
||||
*/
|
||||
private function spentOutsideBudgets(): array
|
||||
{
|
||||
return $this->repository->spentInPeriodWoBudgetMc(new Collection,$this->parameters->get('start'), $this->parameters->get('end'));
|
||||
return $this->repository->spentInPeriodWoBudgetMc(new Collection, $this->parameters->get('start'), $this->parameters->get('end'));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -24,9 +24,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Transformers;
|
||||
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
use Log;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
/**
|
||||
* Class CurrencyTransformer
|
||||
|
@@ -25,9 +25,7 @@ namespace FireflyIII\Transformers;
|
||||
|
||||
|
||||
use FireflyIII\Models\ImportJob;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
use Log;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
/**
|
||||
* Class ImportJobTransformer
|
||||
@@ -56,11 +54,11 @@ class ImportJobTransformer extends AbstractTransformer
|
||||
*/
|
||||
public function transform(ImportJob $importJob): array
|
||||
{
|
||||
$tag= $importJob->tag;
|
||||
$tagId = null;
|
||||
$tag = $importJob->tag;
|
||||
$tagId = null;
|
||||
$tagTag = null;
|
||||
if(null !== $tag) {
|
||||
$tagId = $tag->id;
|
||||
if (null !== $tag) {
|
||||
$tagId = $tag->id;
|
||||
$tagTag = $tag->tag;
|
||||
}
|
||||
$data = [
|
||||
@@ -79,7 +77,7 @@ class ImportJobTransformer extends AbstractTransformer
|
||||
'transactions' => json_encode($importJob->transactions),
|
||||
'errors' => json_encode($importJob->errors),
|
||||
|
||||
'links' => [
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/import/' . $importJob->key,
|
||||
|
@@ -25,9 +25,7 @@ namespace FireflyIII\Transformers;
|
||||
|
||||
|
||||
use FireflyIII\Models\LinkType;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
use Log;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -25,9 +25,7 @@ namespace FireflyIII\Transformers;
|
||||
|
||||
|
||||
use FireflyIII\Models\Preference;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
use Log;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
/**
|
||||
* Class PreferenceTransformer
|
||||
|
@@ -127,7 +127,6 @@ class RecurrenceTransformer extends AbstractTransformer
|
||||
* @param Recurrence $recurrence
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function getMeta(Recurrence $recurrence): array
|
||||
{
|
||||
@@ -211,7 +210,6 @@ class RecurrenceTransformer extends AbstractTransformer
|
||||
* @param RecurrenceTransaction $transaction
|
||||
*
|
||||
* @return array
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function getTransactionMeta(RecurrenceTransaction $transaction): array
|
||||
{
|
||||
|
@@ -24,9 +24,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Transformers;
|
||||
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
use Log;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
/**
|
||||
* Class RuleGroupTransformer
|
||||
|
@@ -24,13 +24,8 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Transformers;
|
||||
|
||||
|
||||
use FireflyIII\Helpers\Collector\TransactionCollectorInterface;
|
||||
use FireflyIII\Models\Tag;
|
||||
use League\Fractal\Resource\Collection as FractalCollection;
|
||||
use League\Fractal\Resource\Item;
|
||||
use League\Fractal\TransformerAbstract;
|
||||
use Log;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
/**
|
||||
* Class TagTransformer
|
||||
@@ -69,7 +64,7 @@ class TagTransformer extends AbstractTransformer
|
||||
'date' => $date,
|
||||
'description' => '' === $tag->description ? null : $tag->description,
|
||||
'latitude' => null === $tag->latitude ? null : (float)$tag->latitude,
|
||||
'longitude' => null === $tag->longitude? null : (float)$tag->longitude,
|
||||
'longitude' => null === $tag->longitude ? null : (float)$tag->longitude,
|
||||
'zoom_level' => null === $tag->zoomLevel ? null : (int)$tag->zoomLevel,
|
||||
'links' => [
|
||||
[
|
||||
|
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Transformers;
|
||||
|
||||
|
||||
use FireflyIII\Models\Role;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Log;
|
||||
@@ -36,6 +35,7 @@ class UserTransformer extends AbstractTransformer
|
||||
{
|
||||
/** @var UserRepositoryInterface */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* UserTransformer constructor.
|
||||
*
|
||||
|
Reference in New Issue
Block a user