mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Code reordering and reformatting. I should really start employing style CI.
This commit is contained in:
@@ -32,6 +32,30 @@ use Log;
|
||||
*/
|
||||
trait ConvertsDataTypes
|
||||
{
|
||||
/**
|
||||
* Return integer value.
|
||||
*
|
||||
* @param string $field
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function integer(string $field): int
|
||||
{
|
||||
return (int)$this->get($field);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return string value.
|
||||
*
|
||||
* @param string $field
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function string(string $field): string
|
||||
{
|
||||
return $this->clearString((string)($this->get($field) ?? ''), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $string
|
||||
* @param bool $keepNewlines
|
||||
@@ -40,7 +64,7 @@ trait ConvertsDataTypes
|
||||
*/
|
||||
public function clearString(?string $string, bool $keepNewlines = true): ?string
|
||||
{
|
||||
if(null === $string) {
|
||||
if (null === $string) {
|
||||
return null;
|
||||
}
|
||||
$search = [
|
||||
@@ -98,30 +122,6 @@ trait ConvertsDataTypes
|
||||
return trim($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return integer value.
|
||||
*
|
||||
* @param string $field
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function integer(string $field): int
|
||||
{
|
||||
return (int)$this->get($field);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return string value.
|
||||
*
|
||||
* @param string $field
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function string(string $field): string
|
||||
{
|
||||
return $this->clearString((string)($this->get($field) ?? ''), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return string value with newlines.
|
||||
*
|
||||
|
Reference in New Issue
Block a user