コード例 #1
0
 /**
  * @param string $locale
  * @return string
  */
 public function getLocaleAwareEntityName($locale)
 {
     Assert::string($locale);
     if ($this->displayName->hasFilledTranslationForLocale($locale)) {
         return $this->displayName->getTranslation($locale);
     }
     return $this->entity->getEntityId()->getEntityId();
 }
コード例 #2
0
 /**
  * @test
  * @group Entity
  * @group Value
  */
 public function two_entities_with_the_same_entity_id_and_entity_type_are_equal()
 {
     $entityIdOne = new EntityId('one');
     $entityIdTwo = new EntityId('two');
     $sp = EntityType::SP();
     $idp = EntityType::IdP();
     $base = new Entity($entityIdOne, $sp);
     $theSame = new Entity($entityIdOne, $sp);
     $differentType = new Entity($entityIdOne, $idp);
     $differentId = new Entity($entityIdTwo, $sp);
     $differentIdAndType = new Entity($entityIdTwo, $idp);
     $this->assertTrue($base->equals($theSame));
     $this->assertFalse($base->equals($differentType));
     $this->assertFalse($base->equals($differentId));
     $this->assertFalse($base->equals($differentIdAndType));
 }