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. * Create a new command instance.
* *
* @return void
*/ */
public function __construct() public function __construct()
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -30,8 +30,6 @@ class InstallationTokenRequest extends BunqRequest
private $installationToken; private $installationToken;
/** @var string */ /** @var string */
private $publicKey = ''; private $publicKey = '';
/** @var ServerPublicKey */
private $serverPublicKey;
/** /**
* *
@@ -87,22 +85,6 @@ class InstallationTokenRequest extends BunqRequest
$this->publicKey = $publicKey; $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 * @param array $response
* *

View File

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

View File

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

View File

@@ -8,7 +8,7 @@
* See the LICENSE file for details. * 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() { function drawSpentBar() {
"use strict"; "use strict";

View File

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