Пример #1
0
 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];
 }
Пример #2
0
 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);
         }
     }
 }
 /**
  * {@inheritDoc}
  */
 public function getCountry()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getCountry', array());
     return parent::getCountry();
 }