/** * {@inheritdoc} */ public function getMessage() { if (!$this->registeredUser) { throw new LogicException('You must set a user before calling getMessage'); } return $this->app->trans('admin::register: un utilisateur a fait une demande d\'inscription') . "\n\n" . sprintf('%s %s', $this->registeredUser->getFirstName(), $this->registeredUser->getLastName()) . "\n\n" . sprintf('%s %s', $this->registeredUser->getJob(), $this->registeredUser->getCompany()); }
protected function evaluateGoodUserItem($data, User $user) { foreach (['@entity@' => V1Controller::OBJECT_TYPE_USER, 'id' => $user->getId(), 'email' => $user->getEmail() ?: null, 'login' => $user->getLogin() ?: null, 'first_name' => $user->getFirstName() ?: null, 'last_name' => $user->getLastName() ?: null, 'display_name' => $user->getDisplayName() ?: null, 'address' => $user->getAddress() ?: null, 'zip_code' => $user->getZipCode() ?: null, 'city' => $user->getCity() ?: null, 'country' => $user->getCountry() ?: null, 'phone' => $user->getPhone() ?: null, 'fax' => $user->getFax() ?: null, 'job' => $user->getJob() ?: null, 'position' => $user->getActivity() ?: null, 'company' => $user->getCompany() ?: null, 'geoname_id' => $user->getGeonameId() ?: null, 'last_connection' => $user->getLastConnection() ? $user->getLastConnection()->format(DATE_ATOM) : null, 'created_on' => $user->getCreated() ? $user->getCreated()->format(DATE_ATOM) : null, 'updated_on' => $user->getUpdated() ? $user->getUpdated()->format(DATE_ATOM) : null, 'locale' => $user->getLocale() ?: null] as $key => $value) { $this->assertArrayHasKey($key, $data, 'Assert key is present ' . $key); if ($value) { $this->assertEquals($value, $data[$key], 'Check key ' . $key); } } }
private function formatUser(User $user) { $subtitle = array_filter([$user->getJob(), $user->getCompany()]); return ['type' => 'USER', 'usr_id' => $user->getId(), 'firstname' => $user->getFirstName(), 'lastname' => $user->getLastName(), 'email' => $user->getEmail(), 'display_name' => $user->getDisplayName(), 'subtitle' => implode(', ', $subtitle)]; }
private function list_user(User $user) { switch ($user->getGender()) { case User::GENDER_MR: $gender = 'Mr'; break; case User::GENDER_MRS: $gender = 'Mrs'; break; case User::GENDER_MISS: $gender = 'Miss'; break; } return ['@entity@' => self::OBJECT_TYPE_USER, 'id' => $user->getId(), 'email' => $user->getEmail() ?: null, 'login' => $user->getLogin() ?: null, 'first_name' => $user->getFirstName() ?: null, 'last_name' => $user->getLastName() ?: null, 'display_name' => $user->getDisplayName() ?: null, 'gender' => $gender, 'address' => $user->getAddress() ?: null, 'zip_code' => $user->getZipCode() ?: null, 'city' => $user->getCity() ?: null, 'country' => $user->getCountry() ?: null, 'phone' => $user->getPhone() ?: null, 'fax' => $user->getFax() ?: null, 'job' => $user->getJob() ?: null, 'position' => $user->getActivity() ?: null, 'company' => $user->getCompany() ?: null, 'geoname_id' => $user->getGeonameId() ?: null, 'last_connection' => $user->getLastConnection() ? $user->getLastConnection()->format(DATE_ATOM) : null, 'created_on' => $user->getCreated() ? $user->getCreated()->format(DATE_ATOM) : null, 'updated_on' => $user->getUpdated() ? $user->getUpdated()->format(DATE_ATOM) : null, 'locale' => $user->getLocale() ?: null]; }
/** * {@inheritDoc} */ public function getJob() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getJob', array()); return parent::getJob(); }