Skip to content

Commit ae601fb

Browse files
committed
Refactor assertions
1 parent 1f9c5af commit ae601fb

17 files changed

+33
-17
lines changed

src/Assert/Assert.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SimpleSAML\XMLSecurity\Assert;
6+
7+
use SimpleSAML\XML\Assert\Assert as BaseAssert;
8+
9+
/**
10+
* SimpleSAML\XMLSecurity\Assert\Assert wrapper class
11+
*
12+
* @package simplesamlphp/xml-security
13+
*/
14+
class Assert extends BaseAssert
15+
{
16+
}

src/CryptoEncoding/PEMBundle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Countable;
99
use IteratorAggregate;
1010
use LogicException;
11-
use SimpleSAML\Assert\Assert;
11+
use SimpleSAML\XMLSecurity\Assert\Assert;
1212
use SimpleSAML\XMLSecurity\Exception\IOException;
1313
use UnexpectedValueException;
1414

@@ -77,7 +77,7 @@ public static function fromString(string $str): self
7777
$pems = array_map(
7878
function ($match) {
7979
$payload = preg_replace('/\s+/', '', $match[2]);
80-
Assert::stringPlausibleBase64($payload);
80+
Assert::validBase64($payload);
8181

8282
$data = base64_decode($payload, true);
8383
if (empty($data)) {

src/XML/ds/AbstractKeyInfoType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
namespace SimpleSAML\XMLSecurity\XML\ds;
66

77
use DOMElement;
8-
use SimpleSAML\Assert\Assert;
98
use SimpleSAML\XML\Exception\SchemaViolationException;
109
use SimpleSAML\XML\ExtendableElementTrait;
1110
use SimpleSAML\XML\SerializableElementInterface;
1211
use SimpleSAML\XML\XsNamespace as NS;
12+
use SimpleSAML\XMLSecurity\Assert\Assert;
1313
use SimpleSAML\XMLSecurity\Constants as C;
1414
use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException;
1515
use SimpleSAML\XMLSecurity\XML\ds\AbstractDsElement;

src/XML/ds/DsObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
namespace SimpleSAML\XMLSecurity\XML\ds;
66

77
use DOMElement;
8-
use SimpleSAML\Assert\Assert;
98
use SimpleSAML\XML\Exception\InvalidDOMElementException;
109
use SimpleSAML\XML\ExtendableElementTrait;
1110
use SimpleSAML\XML\SchemaValidatableElementInterface;
1211
use SimpleSAML\XML\SchemaValidatableElementTrait;
1312
use SimpleSAML\XML\XsNamespace as NS;
13+
use SimpleSAML\XMLSecurity\Assert\Assert;
1414

1515
/**
1616
* Class representing a ds:Object element.

src/XML/ds/Manifest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
namespace SimpleSAML\XMLSecurity\XML\ds;
66

77
use DOMElement;
8-
use SimpleSAML\Assert\Assert;
98
use SimpleSAML\XML\Constants as C;
109
use SimpleSAML\XML\Exception\InvalidDOMElementException;
1110
use SimpleSAML\XML\Exception\MissingElementException;
1211
use SimpleSAML\XML\SchemaValidatableElementInterface;
1312
use SimpleSAML\XML\SchemaValidatableElementTrait;
13+
use SimpleSAML\XMLSecurity\Assert\Assert;
1414

1515
/**
1616
* Class representing a ds:Manifest element.

src/XML/ds/Reference.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
namespace SimpleSAML\XMLSecurity\XML\ds;
66

77
use DOMElement;
8-
use SimpleSAML\Assert\Assert;
98
use SimpleSAML\XML\Exception\InvalidDOMElementException;
109
use SimpleSAML\XML\Exception\MissingElementException;
1110
use SimpleSAML\XML\Exception\TooManyElementsException;
1211
use SimpleSAML\XML\SchemaValidatableElementInterface;
1312
use SimpleSAML\XML\SchemaValidatableElementTrait;
13+
use SimpleSAML\XMLSecurity\Assert\Assert;
1414

1515
use function array_pop;
1616

src/XML/ds/Signature.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
namespace SimpleSAML\XMLSecurity\XML\ds;
66

77
use DOMElement;
8-
use SimpleSAML\Assert\Assert;
98
use SimpleSAML\XML\Exception\InvalidDOMElementException;
109
use SimpleSAML\XML\Exception\MissingElementException;
1110
use SimpleSAML\XML\Exception\TooManyElementsException;
1211
use SimpleSAML\XML\SchemaValidatableElementInterface;
1312
use SimpleSAML\XML\SchemaValidatableElementTrait;
13+
use SimpleSAML\XMLSecurity\Assert\Assert;
1414
use SimpleSAML\XMLSecurity\Constants as C;
1515

1616
use function array_pop;

src/XML/ds/SignatureProperties.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
namespace SimpleSAML\XMLSecurity\XML\ds;
66

77
use DOMElement;
8-
use SimpleSAML\Assert\Assert;
98
use SimpleSAML\XML\Constants as C;
109
use SimpleSAML\XML\Exception\InvalidDOMElementException;
1110
use SimpleSAML\XML\Exception\MissingElementException;
1211
use SimpleSAML\XML\Exception\SchemaViolationException;
1312
use SimpleSAML\XML\SchemaValidatableElementInterface;
1413
use SimpleSAML\XML\SchemaValidatableElementTrait;
14+
use SimpleSAML\XMLSecurity\Assert\Assert;
1515

1616
/**
1717
* Class representing a ds:SignatureProperties element.

src/XML/ds/SignatureProperty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
namespace SimpleSAML\XMLSecurity\XML\ds;
66

77
use DOMElement;
8-
use SimpleSAML\Assert\Assert;
98
use SimpleSAML\XML\Exception\InvalidDOMElementException;
109
use SimpleSAML\XML\Exception\MissingElementException;
1110
use SimpleSAML\XML\Exception\SchemaViolationException;
1211
use SimpleSAML\XML\ExtendableElementTrait;
1312
use SimpleSAML\XML\SchemaValidatableElementInterface;
1413
use SimpleSAML\XML\SchemaValidatableElementTrait;
1514
use SimpleSAML\XML\XsNamespace as NS;
15+
use SimpleSAML\XMLSecurity\Assert\Assert;
1616

1717
/**
1818
* Class representing a ds:SignatureProperty element.

src/XML/ds/SignatureValue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
namespace SimpleSAML\XMLSecurity\XML\ds;
66

77
use DOMElement;
8-
use SimpleSAML\Assert\Assert;
98
use SimpleSAML\XML\Base64ElementTrait;
109
use SimpleSAML\XML\Exception\InvalidDOMElementException;
1110
use SimpleSAML\XML\SchemaValidatableElementInterface;
1211
use SimpleSAML\XML\SchemaValidatableElementTrait;
12+
use SimpleSAML\XMLSecurity\Assert\Assert;
1313

1414
/**
1515
* Class representing a ds:SignatureValue element.

0 commit comments

Comments
 (0)