for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Anomaly\UsersModule\User;
use Anomaly\Streams\Platform\Entry\EntryPresenter;
use Anomaly\UsersModule\User\Contract\UserInterface;
/**
* Class UserPresenter
*
* @link http://pyrocms.com/
* @author PyroCMS, Inc. <[email protected]>
* @author Ryan Thompson <[email protected]>
*/
class UserPresenter extends EntryPresenter
{
* The decorated object.
* This is for IDE support.
* @var UserInterface
protected $object;
* Return the users name.
* @return string
public function name()
return implode(' ', array_filter([$this->object->getFirstName(), $this->object->getLastName()]));
}
* Return the user gravatar.
* @param array $parameters
public function gravatar($parameters = [])
return 'https://www.gravatar.com/avatar/' . md5($this->object->getEmail()) . '?' . http_build_query(
$parameters
);
* Return the user's status as a label.
* @param string $size
* @return null|string
public function statusLabel($size = 'sm')
$color = 'default';
$status = $this->status();
switch ($status) {
case 'active':
$color = 'success';
break;
case 'inactive':
case 'disabled':
$color = 'danger';
return '<span class="label label-' . $size . ' label-' . $color . '">' . trans(
'anomaly.module.users::field.status.option.' . $status
) . '</span>';
* Return the status key.
public function status()
if (!$this->object->isEnabled()) {
return 'disabled';
if ($this->object->isEnabled() && !$this->object->isActivated()) {
return 'inactive';
if ($this->object->isEnabled() && $this->object->isActivated()) {
return 'active';
return null;