Files
firefly-iii/app/Support/Http/Controllers/BasicDataSupport.php

51 lines
1.3 KiB
PHP
Raw Normal View History

2018-08-09 16:16:27 +02:00
<?php
/**
* BasicDataSupport.php
2020-02-16 13:56:52 +01:00
* Copyright (c) 2019 james@firefly-iii.org
2018-08-09 16:16:27 +02:00
*
* This file is part of Firefly III (https://github.com/firefly-iii).
2018-08-09 16:16:27 +02:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
2018-08-09 16:16:27 +02:00
*
* This program is distributed in the hope that it will be useful,
2018-08-09 16:16:27 +02:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
2018-08-09 16:16:27 +02:00
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2018-08-09 16:16:27 +02:00
*/
declare(strict_types=1);
namespace FireflyIII\Support\Http\Controllers;
/**
* Trait BasicDataSupport
*
*/
trait BasicDataSupport
{
2018-08-09 16:16:27 +02:00
/**
2018-08-10 17:05:37 +02:00
* Find the ID in a given array. Return '0' of not there (amount).
2018-08-09 16:16:27 +02:00
*
* @param array $array
2018-08-10 17:05:37 +02:00
* @param int $entryId
2018-08-09 16:16:27 +02:00
*
2018-08-10 17:05:37 +02:00
* @return null|mixed
2018-08-09 16:16:27 +02:00
*/
2018-08-10 17:05:37 +02:00
protected function isInArray(array $array, int $entryId) // helper for data (math, calculations)
2018-08-09 16:16:27 +02:00
{
$result = $array[$entryId] ?? '0';
2018-08-09 16:16:27 +02:00
2018-08-10 17:05:37 +02:00
return $result;
2018-08-09 16:16:27 +02:00
}
2018-12-31 08:11:57 +01:00
2018-12-31 07:48:23 +01:00
}