-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PI processing support for common phrases
- Loading branch information
Showing
4 changed files
with
117 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,25 @@ | ||
<?php | ||
|
||
if (!defined('VALUE_ERROR_BETWEEN_ERROR_SECTION')) { | ||
define('VALUE_ERROR_BETWEEN_ERROR_SECTION', <<<'CONTENT' | ||
<simpara xmlns="http://docbook.org/ns/docbook"> | ||
Throws a <exceptionname>ValueError</exceptionname> if <parameter>PARAMETER_NAME</parameter> | ||
is less than MIN_TAG or greater than MAX_TAG. | ||
</simpara> | ||
CONTENT | ||
); | ||
} | ||
|
||
if (!defined('VALUE_ERROR_BETWEEN_CHANGELOG')) { | ||
define('VALUE_ERROR_BETWEEN_CHANGELOG', <<<'CONTENT' | ||
<row xmlns="http://docbook.org/ns/docbook"> | ||
<entry>VERSION</entry> | ||
<entry> | ||
A <exceptionname>ValueError</exceptionname> is now thrown if | ||
<parameter>PARAMETER_NAME</parameter> is less than MIN_TAG | ||
or greater than MAX_TAG | ||
</entry> | ||
</row> | ||
CONTENT | ||
); | ||
} |
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 | ||
|
||
const VALUE_ERROR_BETWEEN_ERROR_SECTION = <<<'CONTENT' | ||
<simpara> | ||
Lance une <exceptionname>ValueError</exceptionname> si <parameter>PARAMETER_NAME</parameter> | ||
est moins que MIN_TAG ou plus grand que MAX_TAG. | ||
</simpara> | ||
CONTENT; | ||
|
||
const VALUE_ERROR_BETWEEN_CHANGELOG = <<<'CONTENT' | ||
<row> | ||
<entry>VERSION</entry> | ||
<entry> | ||
Une <exceptionname>ValueError</exceptionname> est désormais lancé si | ||
<parameter>PARAMETER_NAME</parameter> est moins que MIN_TAG ou plus grand que MAX_TAG | ||
</entry> | ||
</row> | ||
CONTENT; |
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,46 @@ | ||
<?php | ||
|
||
function error_section_value_error_between( | ||
DOMDocument $dom, | ||
string $parameter, | ||
string $min, | ||
string $max | ||
): DOMElement { | ||
$min_tag_name = is_numeric($min) ? 'literal' : 'constant'; | ||
$max_tag_name = is_numeric($max) ? 'literal' : 'constant'; | ||
|
||
$min_tag = '<' . $min_tag_name . '>' . $min . '</' . $min_tag_name . '>'; | ||
$max_tag = '<' . $max_tag_name . '>' . $max . '</' . $max_tag_name . '>'; | ||
|
||
$xml = str_replace( | ||
['PARAMETER_NAME', 'MIN_TAG', 'MAX_TAG'], | ||
[$parameter, $min_tag, $max_tag], | ||
VALUE_ERROR_BETWEEN_ERROR_SECTION, | ||
); | ||
$localDom = new DOMDocument(); | ||
$localDom->loadXML($xml); | ||
return $dom->importNode($localDom->documentElement, true); | ||
} | ||
|
||
function error_section_value_error_between_changelog( | ||
DOMDocument $dom, | ||
string $version, | ||
string $parameter, | ||
string $min, | ||
string $max | ||
): DOMElement { | ||
$min_tag_name = is_numeric($min) ? 'literal' : 'constant'; | ||
$max_tag_name = is_numeric($max) ? 'literal' : 'constant'; | ||
|
||
$min_tag = '<' . $min_tag_name . '>' . $min . '</' . $min_tag_name . '>'; | ||
$max_tag = '<' . $max_tag_name . '>' . $max . '</' . $max_tag_name . '>'; | ||
|
||
$xml = str_replace( | ||
['VERSION', 'PARAMETER_NAME', 'MIN_TAG', 'MAX_TAG'], | ||
[$version, $parameter, $min_tag, $max_tag], | ||
VALUE_ERROR_BETWEEN_CHANGELOG, | ||
); | ||
$localDom = new DOMDocument(); | ||
$localDom->loadXML($xml); | ||
return $dom->importNode($localDom->documentElement, true); | ||
} |