Various PSR12 code cleanup

This commit is contained in:
James Cole
2022-12-29 19:41:57 +01:00
parent 0022009dd5
commit dbf3e76ecc
340 changed files with 4079 additions and 3816 deletions

View File

@@ -1,4 +1,5 @@
<?php
/**
* ChartJsGenerator.php
* Copyright (c) 2019 james@firefly-iii.org
@@ -34,7 +35,7 @@ class ChartJsGenerator implements GeneratorInterface
*
* key => [value => x, 'currency_symbol' => 'x']
*
* @param array $data
* @param array $data
*
* @return array
*/
@@ -50,7 +51,7 @@ class ChartJsGenerator implements GeneratorInterface
$amounts = array_column($data, 'amount');
$next = next($amounts);
$sortFlag = SORT_ASC;
if (!is_bool($next) && 1 === bccomp((string) $next, '0')) {
if (!is_bool($next) && 1 === bccomp((string)$next, '0')) {
$sortFlag = SORT_DESC;
}
array_multisort($amounts, $sortFlag, $data);
@@ -59,7 +60,7 @@ class ChartJsGenerator implements GeneratorInterface
$index = 0;
foreach ($data as $key => $valueArray) {
// make larger than 0
$chartData['datasets'][0]['data'][] = app('steam')->positive((string) $valueArray['amount']);
$chartData['datasets'][0]['data'][] = app('steam')->positive((string)$valueArray['amount']);
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
$chartData['datasets'][0]['currency_symbol'][] = $valueArray['currency_symbol'];
$chartData['labels'][] = $key;
@@ -99,7 +100,7 @@ class ChartJsGenerator implements GeneratorInterface
*
* // it's five.
*
* @param array $data
* @param array $data
*
* @return array
*/
@@ -148,7 +149,7 @@ class ChartJsGenerator implements GeneratorInterface
*
* key => value
*
* @param array $data
* @param array $data
*
* @return array
*/
@@ -165,7 +166,7 @@ class ChartJsGenerator implements GeneratorInterface
// different sort when values are positive and when they're negative.
asort($data);
$next = next($data);
if (!is_bool($next) && 1 === bccomp((string) $next, '0')) {
if (!is_bool($next) && 1 === bccomp((string)$next, '0')) {
// next is positive, sort other way around.
arsort($data);
}
@@ -174,7 +175,7 @@ class ChartJsGenerator implements GeneratorInterface
$index = 0;
foreach ($data as $key => $value) {
// make larger than 0
$chartData['datasets'][0]['data'][] = app('steam')->positive((string) $value);
$chartData['datasets'][0]['data'][] = app('steam')->positive((string)$value);
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
$chartData['labels'][] = $key;
@@ -189,8 +190,8 @@ class ChartJsGenerator implements GeneratorInterface
*
* 'label-of-entry' => value
*
* @param string $setLabel
* @param array $data
* @param string $setLabel
* @param array $data
*
* @return array
*/

View File

@@ -1,4 +1,5 @@
<?php
/**
* GeneratorInterface.php
* Copyright (c) 2019 james@firefly-iii.org
@@ -28,7 +29,7 @@ namespace FireflyIII\Generator\Chart\Basic;
interface GeneratorInterface
{
/**
* @param array $data
* @param array $data
*
* @return array
*/
@@ -62,7 +63,7 @@ interface GeneratorInterface
*
* // it's five.
*
* @param array $data
* @param array $data
*
* @return array
*/
@@ -73,7 +74,7 @@ interface GeneratorInterface
*
* key => value
*
* @param array $data
* @param array $data
*
* @return array
*/
@@ -84,8 +85,8 @@ interface GeneratorInterface
*
* 'label-of-entry' => value
*
* @param string $setLabel
* @param array $data
* @param string $setLabel
* @param array $data
*
* @return array
*/