protected function stringifyUser(User $user) { return $user->getFullName() ? sprintf('%s (%s)', $user->getFullName(), $user->getUsername()) : $user->getUsername(); }
/** * @param User $user * * @return array */ public static function userToArray(User $user) { return array('id' => $user->getId(), 'name' => $user->getFullName(), 'email' => $user->getEmail(), 'username' => $user->getUsername()); }