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
* Copyright (c) 2018 thegrumpydictator@gmail.com
*
* This file is part of Firefly III.
*
* 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
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
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
}