-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\SAML11\XML; | ||
|
||
/** | ||
* Interface for several extension points objects. | ||
* | ||
* @package simplesamlphp/saml11 | ||
*/ | ||
interface ExtensionPointInterface | ||
{ | ||
/** | ||
* Get the local name for the element's xsi:type. | ||
* | ||
* @return string | ||
*/ | ||
public static function getXsiTypeName(): string; | ||
|
||
|
||
/** | ||
* Get the namespace for the element's xsi:type. | ||
* | ||
* @return string | ||
*/ | ||
public static function getXsiTypeNamespaceURI(): string; | ||
|
||
|
||
/** | ||
* Get the namespace-prefix for the element's xsi:type. | ||
* | ||
* @return string | ||
*/ | ||
public static function getXsiTypePrefix(): string; | ||
|
||
|
||
/** | ||
* Return the xsi:type value corresponding this element. | ||
* | ||
* @return string | ||
*/ | ||
public function getXsiType(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\SAML11\XML; | ||
|
||
use RuntimeException; | ||
use SimpleSAML\Assert\Assert; | ||
use SimpleSAML\XML\Exception\SchemaViolationException; | ||
|
||
/** | ||
* Trait for several extension points objects. | ||
* | ||
* @package simplesamlphp/saml11 | ||
*/ | ||
trait ExtensionPointTrait | ||
{ | ||
/** | ||
* Get the local name for the element's xsi:type. | ||
* | ||
* @return string | ||
*/ | ||
public static function getXsiTypeName(): string | ||
{ | ||
Assert::true( | ||
defined('static::XSI_TYPE_NAME'), | ||
self::getClassName(static::class) | ||
. '::XSI_TYPE_NAME constant must be defined and set to unprefixed type for the xsi:type it represents.', | ||
RuntimeException::class, | ||
); | ||
|
||
Assert::validNCName(static::XSI_TYPE_NAME, SchemaViolationException::class); | ||
return static::XSI_TYPE_NAME; | ||
} | ||
|
||
|
||
/** | ||
* Get the namespace for the element's xsi:type. | ||
* | ||
* @return string | ||
*/ | ||
public static function getXsiTypeNamespaceURI(): string | ||
{ | ||
Assert::true( | ||
defined('static::XSI_TYPE_NAMESPACE'), | ||
self::getClassName(static::class) | ||
. '::XSI_TYPE_NAMESPACE constant must be defined and set to the namespace for the xsi:type it represents.', | ||
RuntimeException::class, | ||
); | ||
|
||
Assert::validURI(static::XSI_TYPE_NAMESPACE, SchemaViolationException::class); | ||
return static::XSI_TYPE_NAMESPACE; | ||
} | ||
|
||
|
||
/** | ||
* Get the namespace-prefix for the element's xsi:type. | ||
* | ||
* @return string | ||
*/ | ||
public static function getXsiTypePrefix(): string | ||
{ | ||
Assert::true( | ||
defined('static::XSI_TYPE_PREFIX'), | ||
sprintf( | ||
'%s::XSI_TYPE_PREFIX constant must be defined and set to the namespace for the xsi:type it represents.', | ||
self::getClassName(static::class), | ||
), | ||
RuntimeException::class, | ||
); | ||
|
||
Assert::validNCName(static::XSI_TYPE_PREFIX, SchemaViolationException::class); | ||
return static::XSI_TYPE_PREFIX; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters