mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Remove unnecessary setters.
This commit is contained in:
		| @@ -97,7 +97,6 @@ class ShowController extends Controller | ||||
|         $admin       = auth()->user(); | ||||
|         $enrichment  = new AccountEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $accounts    = $enrichment->enrich($accounts); | ||||
| 
 | ||||
|         // make paginator:
 | ||||
| @@ -132,7 +131,6 @@ class ShowController extends Controller | ||||
|         $admin       = auth()->user(); | ||||
|         $enrichment  = new AccountEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $account     = $enrichment->enrichSingle($account); | ||||
| 
 | ||||
| 
 | ||||
|   | ||||
| @@ -76,7 +76,6 @@ class StoreController extends Controller | ||||
|         $admin       = auth()->user(); | ||||
|         $enrichment  = new AccountEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $account     = $enrichment->enrichSingle($account); | ||||
| 
 | ||||
|         /** @var AccountTransformer $transformer */ | ||||
|   | ||||
| @@ -81,7 +81,6 @@ class UpdateController extends Controller | ||||
|         $admin        = auth()->user(); | ||||
|         $enrichment   = new AccountEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $account      = $enrichment->enrichSingle($account); | ||||
| 
 | ||||
|         /** @var AccountTransformer $transformer */ | ||||
|   | ||||
| @@ -83,8 +83,6 @@ class ShowController extends Controller | ||||
|         $admin       = auth()->user(); | ||||
|         $enrichment  = new SubscriptionEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setConvertToPrimary($this->convertToPrimary); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $enrichment->setStart($this->parameters->get('start')); | ||||
|         $enrichment->setEnd($this->parameters->get('end')); | ||||
|         $bills       = $enrichment->enrich($bills); | ||||
| @@ -114,8 +112,6 @@ class ShowController extends Controller | ||||
|         $admin       = auth()->user(); | ||||
|         $enrichment  = new SubscriptionEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setConvertToPrimary($this->convertToPrimary); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $enrichment->setStart($this->parameters->get('start')); | ||||
|         $enrichment->setEnd($this->parameters->get('end')); | ||||
|         $bill        = $enrichment->enrichSingle($bill); | ||||
|   | ||||
| @@ -79,8 +79,6 @@ class StoreController extends Controller | ||||
|         $admin       = auth()->user(); | ||||
|         $enrichment  = new SubscriptionEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setConvertToPrimary($this->convertToPrimary); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $enrichment->setStart($this->parameters->get('start')); | ||||
|         $enrichment->setEnd($this->parameters->get('end')); | ||||
|         $bill        = $enrichment->enrichSingle($bill); | ||||
|   | ||||
| @@ -74,8 +74,6 @@ class UpdateController extends Controller | ||||
|         $admin       = auth()->user(); | ||||
|         $enrichment  = new SubscriptionEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setConvertToPrimary($this->convertToPrimary); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $enrichment->setStart($this->parameters->get('start')); | ||||
|         $enrichment->setEnd($this->parameters->get('end')); | ||||
|         $bill        = $enrichment->enrichSingle($bill); | ||||
|   | ||||
| @@ -85,8 +85,6 @@ class ListController extends Controller | ||||
|         $admin       = auth()->user(); | ||||
|         $enrichment  = new SubscriptionEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setConvertToPrimary($this->convertToPrimary); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $enrichment->setStart($this->parameters->get('start')); | ||||
|         $enrichment->setEnd($this->parameters->get('end')); | ||||
|         $bills       = $enrichment->enrich($bills); | ||||
|   | ||||
| @@ -84,7 +84,6 @@ class ListController extends Controller | ||||
|         $admin       = auth()->user(); | ||||
|         $enrichment  = new AccountEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $accounts    = $enrichment->enrich($accounts); | ||||
| 
 | ||||
|         // make paginator:
 | ||||
|   | ||||
| @@ -108,7 +108,6 @@ class ListController extends Controller | ||||
|         $admin             = auth()->user(); | ||||
|         $enrichment        = new AccountEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $accounts          = $enrichment->enrich($accounts); | ||||
| 
 | ||||
|         // make paginator:
 | ||||
| @@ -188,8 +187,6 @@ class ListController extends Controller | ||||
|         $admin       = auth()->user(); | ||||
|         $enrichment  = new SubscriptionEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setConvertToPrimary($this->convertToPrimary); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $enrichment->setStart($this->parameters->get('start')); | ||||
|         $enrichment->setEnd($this->parameters->get('end')); | ||||
|         $bills       = $enrichment->enrichSingle($bills); | ||||
|   | ||||
| @@ -89,7 +89,6 @@ class AccountController extends Controller | ||||
|         $admin       = auth()->user(); | ||||
|         $enrichment  = new AccountEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $accounts    = $enrichment->enrich($accounts); | ||||
| 
 | ||||
|         /** @var AccountTransformer $transformer */ | ||||
|   | ||||
| @@ -177,7 +177,6 @@ class StandardMessageGenerator implements MessageGeneratorInterface | ||||
|                 $accounts                = $this->collectAccounts($model); | ||||
|                 $enrichment              = new AccountEnrichment(); | ||||
|                 $enrichment->setUser($model->user); | ||||
|                 $enrichment->setPrimaryCurrency(Amount::getPrimaryCurrencyByUserGroup($model->userGroup)); | ||||
|                 $accounts                = $enrichment->enrich($accounts); | ||||
|                 foreach ($accounts as $account) { | ||||
|                     $transformer               = new AccountTransformer(); | ||||
|   | ||||
| @@ -91,8 +91,6 @@ class IndexController extends Controller | ||||
|         $admin       = auth()->user(); | ||||
|         $enrichment  = new SubscriptionEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setConvertToPrimary($this->convertToPrimary); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $enrichment->setStart($tempStart); | ||||
|         $enrichment->setEnd($end); | ||||
|         $collection  = $enrichment->enrich($collection); | ||||
|   | ||||
| @@ -149,8 +149,6 @@ class ShowController extends Controller | ||||
|         $admin                      = auth()->user(); | ||||
|         $enrichment                 = new SubscriptionEnrichment(); | ||||
|         $enrichment->setUser($admin); | ||||
|         $enrichment->setConvertToPrimary($this->convertToPrimary); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $enrichment->setStart($start); | ||||
|         $enrichment->setEnd($end); | ||||
|         $bill                       = $enrichment->enrichSingle($bill); | ||||
|   | ||||
| @@ -148,7 +148,6 @@ class IndexController extends Controller | ||||
|         // enrich each account.
 | ||||
|         $enrichment         = new AccountEnrichment(); | ||||
|         $enrichment->setUser(auth()->user()); | ||||
|         $enrichment->setPrimaryCurrency($this->primaryCurrency); | ||||
|         $return             = []; | ||||
| 
 | ||||
|         /** @var PiggyBank $piggy */ | ||||
|   | ||||
| @@ -34,6 +34,7 @@ use FireflyIII\Models\Location; | ||||
| use FireflyIII\Models\Note; | ||||
| use FireflyIII\Models\TransactionCurrency; | ||||
| use FireflyIII\Models\UserGroup; | ||||
| use FireflyIII\Support\Facades\Amount; | ||||
| use FireflyIII\Support\Facades\Steam; | ||||
| use FireflyIII\User; | ||||
| use Illuminate\Database\Eloquent\Model; | ||||
| @@ -76,6 +77,7 @@ class AccountEnrichment implements EnrichmentInterface | ||||
|         $this->notes           = []; | ||||
|         $this->lastActivities  = []; | ||||
|         $this->locations       = []; | ||||
|         $this->primaryCurrency = Amount::getPrimaryCurrency(); | ||||
|         //        $this->repository         = app(AccountRepositoryInterface::class);
 | ||||
|         //        $this->currencyRepository = app(CurrencyRepositoryInterface::class);
 | ||||
|         //        $this->start              = null;
 | ||||
| @@ -281,11 +283,6 @@ class AccountEnrichment implements EnrichmentInterface | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     public function setPrimaryCurrency(TransactionCurrency $primary): void | ||||
|     { | ||||
|         $this->primaryCurrency = $primary; | ||||
|     } | ||||
| 
 | ||||
|     private function collectLastActivities(): void | ||||
|     { | ||||
|         $this->lastActivities = Steam::getLastActivities($this->accountIds); | ||||
|   | ||||
| @@ -12,6 +12,7 @@ use FireflyIII\Models\ObjectGroup; | ||||
| use FireflyIII\Models\TransactionCurrency; | ||||
| use FireflyIII\Models\TransactionJournal; | ||||
| use FireflyIII\Models\UserGroup; | ||||
| use FireflyIII\Support\Facades\Amount; | ||||
| use FireflyIII\Support\Facades\Steam; | ||||
| use FireflyIII\Support\Http\Api\ExchangeRateConverter; | ||||
| use FireflyIII\Support\Models\BillDateCalculator; | ||||
| @@ -38,6 +39,12 @@ class SubscriptionEnrichment implements EnrichmentInterface | ||||
|     private TransactionCurrency $primaryCurrency; | ||||
|     private BillDateCalculator  $calculator; | ||||
| 
 | ||||
|     public function __construct() | ||||
|     { | ||||
|         $this->convertToPrimary = Amount::convertToPrimary(); | ||||
|         $this->primaryCurrency  = Amount::getPrimaryCurrency(); | ||||
|     } | ||||
| 
 | ||||
|     public function enrich(Collection $collection): Collection | ||||
|     { | ||||
|         Log::debug(sprintf('%s(%s item(s))', __METHOD__, $collection->count())); | ||||
| @@ -140,16 +147,6 @@ class SubscriptionEnrichment implements EnrichmentInterface | ||||
|         $this->userGroup = $userGroup; | ||||
|     } | ||||
| 
 | ||||
|     public function setConvertToPrimary(bool $convertToPrimary): void | ||||
|     { | ||||
|         $this->convertToPrimary = $convertToPrimary; | ||||
|     } | ||||
| 
 | ||||
|     public function setPrimaryCurrency(TransactionCurrency $primaryCurrency): void | ||||
|     { | ||||
|         $this->primaryCurrency = $primaryCurrency; | ||||
|     } | ||||
| 
 | ||||
|     private function collectSubscriptionIds(): void | ||||
|     { | ||||
|         /** @var Bill $bill */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user