コード例 #1
0
ファイル: Entity.php プロジェクト: OpenConext/SamlValueObject
 /**
  * @param array $descriptor array('entity-id', 'sp or idp')
  * @return Entity
  */
 public static function fromDescriptor(array $descriptor)
 {
     Assertion::count($descriptor, 2, 'EntityDescriptor must be an array with two elements (both a string), the first must be the EntityId, the ' . 'second the EntityType');
     Assertion::inArray($descriptor[1], array('sp', 'idp'), 'Entity descriptor type is neither "sp" nor "idp"');
     if ($descriptor[1] === 'sp') {
         $entityType = EntityType::SP();
     } else {
         $entityType = EntityType::IdP();
     }
     return new Entity(new EntityId($descriptor[0]), $entityType);
 }