chore: reformat code.

This commit is contained in:
James Cole
2023-06-21 12:34:58 +02:00
parent 8d87abde64
commit 3dcb35710b
799 changed files with 23319 additions and 22173 deletions

View File

@@ -30,16 +30,6 @@ use Illuminate\Support\Facades\Log;
*/
trait AppendsLocationData
{
/**
* Abstract method stolen from "InteractsWithInput".
*
* @param null $key
* @param bool $default
*
* @return mixed
*/
abstract public function boolean($key = null, $default = false);
/**
* Abstract method.
*
@@ -49,28 +39,12 @@ trait AppendsLocationData
*/
abstract public function has($key);
/**
* Abstract method.
*
* @return string
*/
abstract public function method();
/**
* Abstract method.
*
* @param mixed ...$patterns
*
* @return mixed
*/
abstract public function routeIs(...$patterns);
/**
* Read the submitted Request data and add new or updated Location data to the array.
*
* @param array $data
* @param array $data
*
* @param string|null $prefix
* @param string|null $prefix
*
* @return array
*/
@@ -126,8 +100,8 @@ trait AppendsLocationData
}
/**
* @param string|null $prefix
* @param string $key
* @param string|null $prefix
* @param string $key
*
* @return string
*/
@@ -141,28 +115,7 @@ trait AppendsLocationData
}
/**
* @param string|null $prefix
*
* @return bool
*/
private function isValidEmptyPUT(?string $prefix): bool
{
$longitudeKey = $this->getLocationKey($prefix, 'longitude');
$latitudeKey = $this->getLocationKey($prefix, 'latitude');
$zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level');
return (
null === $this->get($longitudeKey)
&& null === $this->get($latitudeKey)
&& null === $this->get($zoomLevelKey))
&& (
'PUT' === $this->method()
|| ('POST' === $this->method() && $this->routeIs('*.update'))
);
}
/**
* @param string|null $prefix
* @param string|null $prefix
*
* @return bool
*/
@@ -205,7 +158,33 @@ trait AppendsLocationData
}
/**
* @param string|null $prefix
* Abstract method.
*
* @return string
*/
abstract public function method();
/**
* Abstract method.
*
* @param mixed ...$patterns
*
* @return mixed
*/
abstract public function routeIs(...$patterns);
/**
* Abstract method stolen from "InteractsWithInput".
*
* @param null $key
* @param bool $default
*
* @return mixed
*/
abstract public function boolean($key = null, $default = false);
/**
* @param string|null $prefix
*
* @return bool
*/
@@ -248,4 +227,25 @@ trait AppendsLocationData
return false;
}
/**
* @param string|null $prefix
*
* @return bool
*/
private function isValidEmptyPUT(?string $prefix): bool
{
$longitudeKey = $this->getLocationKey($prefix, 'longitude');
$latitudeKey = $this->getLocationKey($prefix, 'latitude');
$zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level');
return (
null === $this->get($longitudeKey)
&& null === $this->get($latitudeKey)
&& null === $this->get($zoomLevelKey))
&& (
'PUT' === $this->method()
|| ('POST' === $this->method() && $this->routeIs('*.update'))
);
}
}

View File

@@ -34,8 +34,46 @@ use Illuminate\Support\Facades\Log;
trait ConvertsDataTypes
{
/**
* @param string|null $string
* @param bool $keepNewlines
* Return integer value.
*
* @param string $field
*
* @return int
*/
public function convertInteger(string $field): int
{
return (int)$this->get($field);
}
/**
* Abstract method that always exists in the Request classes that use this
* trait, OR a stub needs to be added by any other class that uses this train.
*
* @param string $key
* @param mixed|null $default
* @return mixed
*/
abstract public function get(string $key, mixed $default = null): mixed;
/**
* Return string value.
*
* @param string $field
*
* @return string
*/
public function convertString(string $field): string
{
$entry = $this->get($field);
if (!is_scalar($entry)) {
return '';
}
return $this->clearString((string)$entry, false);
}
/**
* @param string|null $string
* @param bool $keepNewlines
*
* @return string|null
*/
@@ -114,57 +152,10 @@ trait ConvertsDataTypes
return trim($string);
}
/**
* Return integer value.
*
* @param string $field
*
* @return int
*/
public function convertInteger(string $field): int
{
return (int)$this->get($field);
}
/**
* Return string value.
*
* @param string $field
*
* @return string
*/
public function convertString(string $field): string
{
$entry = $this->get($field);
if (!is_scalar($entry)) {
return '';
}
return $this->clearString((string)$entry, false);
}
/**
* Abstract method that always exists in the Request classes that use this
* trait, OR a stub needs to be added by any other class that uses this train.
*
* @param string $key
* @param mixed|null $default
* @return mixed
*/
abstract public function get(string $key, mixed $default = null): mixed;
/**
* Abstract method that always exists in the Request classes that use this
* trait, OR a stub needs to be added by any other class that uses this train.
*
* @param mixed $key
* @return mixed
*/
abstract public function has($key);
/**
* Return string value with newlines.
*
* @param string $field
* @param string $field
*
* @return string
*/
@@ -174,7 +165,7 @@ trait ConvertsDataTypes
}
/**
* @param mixed $array
* @param mixed $array
*
* @return array|null
*/
@@ -194,7 +185,7 @@ trait ConvertsDataTypes
}
/**
* @param string|null $value
* @param string|null $value
*
* @return bool
*/
@@ -260,7 +251,7 @@ trait ConvertsDataTypes
/**
* Return floating value.
*
* @param string $field
* @param string $field
*
* @return float|null
*/
@@ -275,7 +266,7 @@ trait ConvertsDataTypes
}
/**
* @param string|null $string
* @param string|null $string
*
* @return Carbon|null
*/
@@ -307,7 +298,7 @@ trait ConvertsDataTypes
* Returns all data in the request, or omits the field if not set,
* according to the config from the request. This is the way.
*
* @param array $fields
* @param array $fields
*
* @return array
*/
@@ -324,10 +315,19 @@ trait ConvertsDataTypes
return $return;
}
/**
* Abstract method that always exists in the Request classes that use this
* trait, OR a stub needs to be added by any other class that uses this train.
*
* @param mixed $key
* @return mixed
*/
abstract public function has($key);
/**
* Return date or NULL.
*
* @param string $field
* @param string $field
*
* @return Carbon|null
*/
@@ -349,7 +349,7 @@ trait ConvertsDataTypes
/**
* Parse to integer
*
* @param string|null $string
* @param string|null $string
*
* @return int|null
*/
@@ -368,7 +368,7 @@ trait ConvertsDataTypes
/**
* Return integer value, or NULL when it's not set.
*
* @param string $field
* @param string $field
*
* @return int|null
*/

View File

@@ -29,7 +29,7 @@ namespace FireflyIII\Support\Request;
trait GetRecurrenceData
{
/**
* @param array $transaction
* @param array $transaction
*
* @return array
*/