1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 23:22:52 +01:00
invoiceninja/app/Models/Presenters/ClientContactPresenter.php
Benjamin Beganović 603f7baa58 apply php-cs-fixeR
2021-01-04 13:38:00 +01:00

43 lines
887 B
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Models\Presenters;
/**
* Class ClientContactPresenter.
*/
class ClientContactPresenter extends EntityPresenter
{
/**
* @return string
*/
public function name()
{
$contact_name = $this->entity->first_name.' '.$this->entity->last_name;
if (strlen($contact_name) > 1) {
return $contact_name;
}
return $this->entity->client->present()->name();
}
public function first_name()
{
return $this->entity->first_name ?: '';
}
public function last_name()
{
return $this->entity->last_name ?: '';
}
}