/** * @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); }
/** ** @param string $format one of the valid NameID formats */ public function __construct($format) { Assertion::inArray($format, self::$validFormats); $this->format = $format; }
/** * @param string $binding * @return bool */ public function isOfType($binding) { $message = 'BindingType must be one of Binding::HTTP_POST, Binding::HTTP_REDIRECT, Binding::HTTP_ARTIFACT ' . 'Binding::SOAP or Binding::HOK_SSO'; Assertion::inArray($binding, self::$validBindings, $message); return $this->binding === $binding; }
/** ** @param string $type one of the ContactType::TYPE_* constants */ public function __construct($type) { $validMessage = 'one of "ContactType::' . implode(', ContactType::', self::$validTypes) . '"'; Assertion::inArray($type, self::$validTypes, $validMessage); $this->contactType = $type; }
/** * @param string $type */ public function __construct($type) { Assertion::inArray($type, array(self::TYPE_SP, self::TYPE_IDP), 'EntityType must be one of EntityType::TYPE_SP or EntityType::TYPE_IDP'); $this->type = $type; }