-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RFC 8941 structured field parsing
- Loading branch information
Showing
12 changed files
with
799 additions
and
0 deletions.
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
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,18 @@ | ||
<?php | ||
|
||
namespace Amp\Http\StructuredFields; | ||
|
||
/** | ||
* @psalm-import-type Rfc8941Parameters from \Amp\Http\StructuredFields\Rfc8941 | ||
* @template-extends Item<bool> | ||
*/ | ||
class Boolean extends Item | ||
{ | ||
/** | ||
* @psalm-param Rfc8941Parameters $parameters | ||
*/ | ||
public function __construct(bool $item, array $parameters) | ||
{ | ||
parent::__construct($item, $parameters); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace Amp\Http\StructuredFields; | ||
|
||
/** | ||
* @psalm-import-type Rfc8941Parameters from \Amp\Http\StructuredFields\Rfc8941 | ||
* @template-extends Item<string> | ||
*/ | ||
class Bytes extends Item | ||
{ | ||
/** | ||
* @psalm-param Rfc8941Parameters $parameters | ||
*/ | ||
public function __construct(string $item, array $parameters) | ||
{ | ||
parent::__construct($item, $parameters); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace Amp\Http\StructuredFields; | ||
|
||
/** | ||
* @psalm-import-type Rfc8941Parameters from \Amp\Http\StructuredFields\Rfc8941 | ||
* @template-extends Item<int> | ||
*/ | ||
class Date extends Item | ||
{ | ||
/** | ||
* @psalm-param Rfc8941Parameters $parameters | ||
*/ | ||
public function __construct(int $item, array $parameters) | ||
{ | ||
parent::__construct($item, $parameters); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace Amp\Http\StructuredFields; | ||
|
||
/** | ||
* @psalm-import-type Rfc8941Parameters from \Amp\Http\StructuredFields\Rfc8941 | ||
* @template-extends Item<string> | ||
*/ | ||
class DisplayString extends Item | ||
{ | ||
/** | ||
* @psalm-param Rfc8941Parameters $parameters | ||
*/ | ||
public function __construct(string $item, array $parameters) | ||
{ | ||
parent::__construct($item, $parameters); | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
namespace Amp\Http\StructuredFields; | ||
|
||
/** | ||
* @psalm-import-type Rfc8941Parameters from \Amp\Http\StructuredFields\Rfc8941 | ||
* @psalm-import-type Rfc8941BareItem from \Amp\Http\StructuredFields\Rfc8941 | ||
* @template-extends Item<list<Item<Rfc8941BareItem>>> | ||
*/ | ||
class InnerList extends Item | ||
{ | ||
/** | ||
* @psalm-param list<Item<Rfc8941BareItem>> $item | ||
* @psalm-param Rfc8941Parameters $parameters | ||
*/ | ||
public function __construct(array $item, array $parameters) | ||
{ | ||
parent::__construct($item, $parameters); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace Amp\Http\StructuredFields; | ||
|
||
/** | ||
* @template-covariant Inner | ||
* @psalm-import-type Rfc8941Parameters from \Amp\Http\StructuredFields\Rfc8941 | ||
*/ | ||
class Item | ||
{ | ||
/** | ||
* @psalm-param Inner $item | ||
* @psalm-param Rfc8941Parameters $parameters | ||
*/ | ||
protected function __construct(public readonly int|float|string|bool|array $item, public readonly array $parameters) | ||
{ | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace Amp\Http\StructuredFields; | ||
|
||
/** | ||
* @psalm-import-type Rfc8941Parameters from \Amp\Http\StructuredFields\Rfc8941 | ||
* @template-extends Item<int|float> | ||
*/ | ||
class Number extends Item | ||
{ | ||
/** | ||
* @psalm-param Rfc8941Parameters $parameters | ||
*/ | ||
public function __construct(int|float $item, array $parameters) | ||
{ | ||
parent::__construct($item, $parameters); | ||
} | ||
} |
Oops, something went wrong.