-
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
1 parent
70fb2c4
commit 19e24d4
Showing
20 changed files
with
216 additions
and
80 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,14 @@ | ||
<?php | ||
|
||
namespace CryptoScythe\Http\Generator; | ||
|
||
final class ConstantNormalizer | ||
{ | ||
public static function normalize(string $constant): string | ||
{ | ||
return trim( | ||
strtoupper(preg_replace('/[^0-9A-z]/', '_', $constant)), | ||
'_', | ||
); | ||
} | ||
} |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
<?php | ||
|
||
namespace CryptoScythe\Http\Generator\Renderer; | ||
|
||
use CryptoScythe\Http\Generator\ConstantNormalizer; | ||
use CryptoScythe\Http\Generator\WebConcept\Value; | ||
|
||
abstract class AbstractRenderer implements RendererInterface | ||
{ | ||
/** @var string */ | ||
protected const HEADLINE_INTRO = ''; | ||
|
||
public function renderHeadline(Value $value): string | ||
{ | ||
return trim(sprintf('%s %s', static::HEADLINE_INTRO, $value->value)); | ||
} | ||
|
||
public function renderConstWithContent(Value $value): string | ||
{ | ||
return sprintf( | ||
"public const %s = '%s';", | ||
ConstantNormalizer::normalize($value->value), | ||
$value->value, | ||
); | ||
} | ||
} |
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,8 @@ | ||
<?php | ||
|
||
namespace CryptoScythe\Http\Generator\Renderer; | ||
|
||
class AuthenticationSchemesRenderer extends AbstractRenderer | ||
{ | ||
protected const HEADLINE_INTRO = 'Authentication scheme'; | ||
} |
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,8 @@ | ||
<?php | ||
|
||
namespace CryptoScythe\Http\Generator\Renderer; | ||
|
||
final class CacheDirectivesRenderer extends AbstractRenderer | ||
{ | ||
protected const HEADLINE_INTRO = 'Cache directive'; | ||
} |
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,8 @@ | ||
<?php | ||
|
||
namespace CryptoScythe\Http\Generator\Renderer; | ||
|
||
class ContentCodingsRenderer extends AbstractRenderer | ||
{ | ||
protected const HEADLINE_INTRO = 'Content coding'; | ||
} |
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,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CryptoScythe\Http\Generator\Renderer; | ||
|
||
final class HeaderFieldsRenderer extends AbstractRenderer | ||
{ | ||
protected const HEADLINE_INTRO = 'Header field'; | ||
} |
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,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CryptoScythe\Http\Generator\Renderer; | ||
|
||
final class MediaTypesRenderer extends AbstractRenderer | ||
{ | ||
protected const HEADLINE_INTRO = 'Media type'; | ||
} |
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,8 @@ | ||
<?php | ||
|
||
namespace CryptoScythe\Http\Generator\Renderer; | ||
|
||
final class RequestMethodsRenderer extends AbstractRenderer | ||
{ | ||
protected const HEADLINE_INTRO = 'Request method'; | ||
} |
Oops, something went wrong.