1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 12:42:36 +01:00
invoiceninja/app/Ninja/Presenters/UserPresenter.php
2019-01-30 22:25:37 +11:00

44 lines
939 B
PHP

<?php
namespace App\Ninja\Presenters;
class UserPresenter extends EntityPresenter
{
public function email()
{
return htmlentities(sprintf('%s <%s>', $this->fullName(), $this->entity->email));
}
public function fullName()
{
return $this->entity->first_name . ' ' . $this->entity->last_name;
}
public function statusCode()
{
$status = '';
$user = $this->entity;
$account = $user->account;
if ($user->confirmed) {
$status .= 'C';
} elseif ($user->registered) {
$status .= 'R';
} else {
$status .= 'N';
}
if ($account->isTrial()) {
$status .= 'T';
} elseif ($account->isEnterprise()) {
$status .= 'E';
} elseif ($account->isPro()) {
$status .= 'P';
} else {
$status .= 'H';
}
return $status;
}
}