Reformat various code.

This commit is contained in:
James Cole
2022-03-29 14:59:58 +02:00
parent 29bed2547c
commit d1a09ff33b
115 changed files with 2700 additions and 2699 deletions

View File

@@ -41,7 +41,7 @@ trait ConvertsDataTypes
*/
public function integer(string $field): int
{
return (int)$this->get($field);
return (int) $this->get($field);
}
/**
@@ -53,7 +53,7 @@ trait ConvertsDataTypes
*/
public function string(string $field): string
{
return $this->clearString((string)($this->get($field) ?? ''), false);
return $this->clearString((string) ($this->get($field) ?? ''), false);
}
/**
@@ -131,7 +131,7 @@ trait ConvertsDataTypes
*/
public function stringWithNewlines(string $field): string
{
return $this->clearString((string)($this->get($field) ?? ''));
return $this->clearString((string) ($this->get($field) ?? ''));
}
/**
@@ -180,28 +180,6 @@ trait ConvertsDataTypes
return false;
}
/**
* Return date or NULL.
*
* @param string $field
*
* @return Carbon|null
*/
protected function getCarbonDate(string $field): ?Carbon
{
$result = null;
try {
$result = $this->get($field) ? new Carbon($this->get($field)) : null;
} catch (InvalidFormatException $e) {
// @ignoreException
}
if (null === $result) {
Log::debug(sprintf('Exception when parsing date "%s".', $this->get($field)));
}
return $result;
}
/**
* @param string|null $string
*
@@ -245,7 +223,7 @@ trait ConvertsDataTypes
return null;
}
return (float)$res;
return (float) $res;
}
/**
@@ -269,6 +247,28 @@ trait ConvertsDataTypes
return $return;
}
/**
* Return date or NULL.
*
* @param string $field
*
* @return Carbon|null
*/
protected function getCarbonDate(string $field): ?Carbon
{
$result = null;
try {
$result = $this->get($field) ? new Carbon($this->get($field)) : null;
} catch (InvalidFormatException $e) {
// @ignoreException
}
if (null === $result) {
Log::debug(sprintf('Exception when parsing date "%s".', $this->get($field)));
}
return $result;
}
/**
* Parse to integer
*
@@ -285,7 +285,7 @@ trait ConvertsDataTypes
return null;
}
return (int)$string;
return (int) $string;
}
/**
@@ -301,12 +301,12 @@ trait ConvertsDataTypes
return null;
}
$value = (string)$this->get($field);
$value = (string) $this->get($field);
if ('' === $value) {
return null;
}
return (int)$value;
return (int) $value;
}
}