Various code cleanup

This commit is contained in:
James Cole
2017-09-16 07:17:58 +02:00
parent bbab89d884
commit b1135cee60
18 changed files with 37 additions and 40 deletions

View File

@@ -54,7 +54,6 @@ class CreateExport extends Command
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{

View File

@@ -18,6 +18,13 @@ use Preferences;
trait VerifiesAccessToken
{
/**
* @param null $key
*
* @return mixed
*/
abstract public function option($key = null);
/**
* @return bool
*/

View File

@@ -49,7 +49,5 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}
}

View File

@@ -34,10 +34,11 @@ class ForgotPasswordController extends Controller
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
$this->middleware('guest');
}
}

View File

@@ -46,7 +46,6 @@ class LoginController extends Controller
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{

View File

@@ -41,10 +41,10 @@ class ResetPasswordController extends Controller
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
$this->middleware('guest');
}
}

View File

@@ -239,6 +239,7 @@ class CategoryController extends Controller
if ($moment === 'all') {
$subTitle = trans('firefly.all_journals_for_category', ['name' => $category->name]);
$first = $repository->firstUseDate($category);
/** @var Carbon $start */
$start = is_null($first) ? new Carbon : $first;
$end = new Carbon;
}
@@ -257,7 +258,9 @@ class CategoryController extends Controller
// prep for current period
if (strlen($moment) === 0) {
/** @var Carbon $start */
$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));
/** @var Carbon $end */
$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));
$periods = $this->getPeriodOverview($category);
$subTitle = trans(

View File

@@ -79,7 +79,6 @@ class BankController extends Controller
return redirect(route('import.bank.form', [$bank]));
}
$remoteAccounts = array_keys($remoteAccounts);
$class = config(sprintf('firefly.import_pre.%s', $bank));
// get import file

View File

@@ -225,7 +225,9 @@ class TagController extends Controller
// prep for current period
if (strlen($moment) === 0) {
/** @var Carbon $start */
$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));
/** @var Carbon $end */
$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));
$periods = $this->getPeriodOverview($tag);
$sum = $repository->sumOfTag($tag, $start, $end);

View File

@@ -23,6 +23,7 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\ImportJob;
use FireflyIII\Models\Rule;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
@@ -39,6 +40,12 @@ trait ImportSupport
/** @var int */
protected $defaultCurrencyId = 1;
/** @var Collection */
protected $rules;
/** @var ImportJob */
protected $job;
/**
* @param TransactionJournal $journal
*

View File

@@ -29,7 +29,7 @@ use Watson\Validating\ValidatingTrait;
* @property-read string $transaction_foreign_amount
* @property-read string $transaction_type_type
*
* @property-read int $account_id
* @property int $account_id
* @property-read string $account_name
* @property string $account_iban
* @property string $account_number

View File

@@ -93,8 +93,9 @@ class MonetaryAccountBank extends BunqObject
foreach ($data['alias'] as $alias) {
$this->aliases[] = new Alias($alias);
}
/** @var array $filter */
foreach ($data['notification_filters'] as $filter) {
$this->notificationFilters = new NotificationFilter($filter);
$this->notificationFilters[] = new NotificationFilter($filter);
}
return;

View File

@@ -28,14 +28,14 @@ abstract class BunqRequest
{
/** @var string */
protected $secret = '';
/** @var ServerPublicKey */
protected $serverPublicKey;
/** @var string */
private $privateKey = '';
/** @var string */
private $server = '';
/** @var ServerPublicKey */
private $serverPublicKey;
private $upperCaseHeaders
= [
= [
'x-bunq-client-response-id' => 'X-Bunq-Client-Response-Id',
'x-bunq-client-request-id' => 'X-Bunq-Client-Request-Id',
];
@@ -203,7 +203,7 @@ abstract class BunqRequest
$body = $response->body;
$array = json_decode($body, true);
$responseHeaders = $response->headers->getAll();
$statusCode = $response->status_code;
$statusCode = intval($response->status_code);
$array['ResponseHeaders'] = $responseHeaders;
$array['ResponseStatusCode'] = $statusCode;
@@ -247,7 +247,7 @@ abstract class BunqRequest
$body = $response->body;
$array = json_decode($body, true);
$responseHeaders = $response->headers->getAll();
$statusCode = $response->status_code;
$statusCode = intval($response->status_code);
$array['ResponseHeaders'] = $responseHeaders;
$array['ResponseStatusCode'] = $statusCode;
@@ -285,7 +285,7 @@ abstract class BunqRequest
$body = $response->body;
$array = json_decode($body, true);
$responseHeaders = $response->headers->getAll();
$statusCode = $response->status_code;
$statusCode = intval($response->status_code);
$array['ResponseHeaders'] = $responseHeaders;
$array['ResponseStatusCode'] = $statusCode;

View File

@@ -30,8 +30,6 @@ class InstallationTokenRequest extends BunqRequest
private $installationToken;
/** @var string */
private $publicKey = '';
/** @var ServerPublicKey */
private $serverPublicKey;
/**
*
@@ -87,22 +85,6 @@ class InstallationTokenRequest extends BunqRequest
$this->publicKey = $publicKey;
}
/**
* @return ServerPublicKey
*/
public function getServerPublicKey(): ServerPublicKey
{
return $this->serverPublicKey;
}
/**
* @param bool $fake
*/
public function setFake(bool $fake)
{
$this->fake = $fake;
}
/**
* @param array $response
*

View File

@@ -119,9 +119,9 @@ class BunqPrerequisites implements PrerequisitesInterface
{
Log::debug('Generate new key pair for user.');
$keyConfig = [
"digest_alg" => "sha512",
"private_key_bits" => 2048,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
'digest_alg' => 'sha512',
'private_key_bits' => 2048,
'private_key_type' => OPENSSL_KEYTYPE_RSA,
];
// Create the private and public key
$res = openssl_pkey_new($keyConfig);

View File

@@ -278,11 +278,10 @@ class FireflyValidator extends Validator
/**
* @param $attribute
* @param $value
* @param $parameters
*
* @return bool
*/
public function validateSecurePassword($attribute, $value, $parameters): bool
public function validateSecurePassword($attribute, $value): bool
{
$verify = false;
if (isset($this->data['verify_password'])) {

View File

@@ -8,7 +8,7 @@
* See the LICENSE file for details.
*/
/** global: spent, budgeted, available, currencySymbol, budgetIndexURI, accounting */
/** global: spent, budgeted, available, currencySymbol, budgetIndexUri, updateIncomeUri, periodStart, periodEnd, budgetAmountUri, accounting */
function drawSpentBar() {
"use strict";

View File

@@ -104,7 +104,7 @@ function callExport() {
// show download
showDownload();
}).fail(function (jqXHR, textStatus, errorThrown) {
}).fail(function (jqXHR) {
// show error.
// show form again.
var response = jqXHR.responseJSON;