/** * @param array $descriptor * @return Entity */ public static function fromDescriptor(array $descriptor) { Assert::count($descriptor, 2); switch ($descriptor[1]) { case 'sp': return new Entity(new EntityId($descriptor[0]), EntityType::SP()); case 'idp': return new Entity(new EntityId($descriptor[0]), EntityType::IdP()); default: throw new LogicException('Entity descriptor type neither "sp" nor "idp"'); } }