update formatCustomField value to accept nullable client

This commit is contained in:
Benjamin Beganović 2020-12-25 12:12:56 +01:00
parent 2f18ab1eeb
commit 710c08cdef

View File

@ -41,15 +41,15 @@ class Helpers
/** /**
* A centralised way to format the custom fields content. * A centralised way to format the custom fields content.
* *
* @param mixed $custom_fields * @param mixed $custom_fields
* @param mixed $field * @param mixed $field
* @param mixed $value * @param mixed $value
* @param null|\App\Models\Client $client * @param \App\Models\Client|null $client
* *
* @return null|string * @return null|string
*/ */
public function formatCustomFieldValue($custom_fields, $field, $value, ?Client $client): ?string public function formatCustomFieldValue($custom_fields, $field, $value, Client $client = null): ?string
{ {
$custom_field = ''; $custom_field = '';
@ -64,7 +64,7 @@ class Helpers
switch ($custom_field) { switch ($custom_field) {
case 'date': case 'date':
return $this->formatDate($value, $client->date_format()); return is_null($client) ? $value : $this->formatDate($value, $client->date_format());
break; break;
case 'switch': case 'switch':