svn: /web/doc-editor/trunk/ error_type.php php/ToolsError.php
[email protected] (Yannick Torres)
| Newsgroups | php.doc.web |
|---|---|
| Message-ID | <[email protected]> |
yannick Tue, 23 Mar 2010 15:06:19 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=296677
Log:
Add a new check for ToolsError : missingInitializer. Only Available for EN documentation.
Changed paths:
U web/doc-editor/trunk/error_type.php
U web/doc-editor/trunk/php/ToolsError.php
Modified: web/doc-editor/trunk/error_type.php
===================================================================
--- web/doc-editor/trunk/error_type.php 2010-03-23 14:47:07 UTC (rev 296676)
+++ web/doc-editor/trunk/error_type.php 2010-03-23 15:06:19 UTC (rev 296677)
@@ -262,6 +262,9 @@
$error['tabCharacterInDocument']['head'] = 'Tab character in the document';
$error['tabCharacterInDocument']['desc'] = 'A tab character have been found in the document We must change it to spaces.';
+$error['missingInitializer']['head'] = 'Missing <initializer> tag';
+$error['missingInitializer']['desc'] = 'A missing <initializer> tag was found.';
+
$to_display = array();
// If $error_to_display is an empty array, we add it all errors (default page)
Modified: web/doc-editor/trunk/php/ToolsError.php
===================================================================
--- web/doc-editor/trunk/php/ToolsError.php 2010-03-23 14:47:07 UTC (rev 296676)
+++ web/doc-editor/trunk/php/ToolsError.php 2010-03-23 15:06:19 UTC (rev 296677)
@@ -324,6 +324,7 @@
if( $this->lang == 'en' )
{
$this->checkAcronym();
+ $this->missingInitializer();
$this->spaceOrPeriodRefpurposeTag($this->lang);
$this->tabCharacterInDocument($this->lang);
}
@@ -1127,6 +1128,34 @@
}
/**
+ * Check for missing <initializer> tag
+ * Add an entry into the error's stack if a missing <initializer> tag was found
+ *
+ * This is the convertion of the following script :
+ * http://svn.php.net/viewvc/phpdoc/doc-base/trunk/scripts/check-missing-initializers.php?view=markup
+ *
+ * This method is only available for EN files.
+ */
+ function missingInitializer()
+ {
+ $matches = array();
+ preg_match_all('@<methodparam choice="opt"><type>(.*)</type><parameter>(.*)</parameter>(.*)</methodparam>@', $this->en_content, $matches);
+
+ if ( !empty($matches))
+ {
+ foreach ($matches[3] as $match) {
+ if (empty($match) || (false === strpos($match, '<initializer>'))) {
+ $this->addError(array(
+ 'value_en' => 'N/A',
+ 'value_lang' => 'N/A',
+ 'type' => 'missingInitializer'
+ ));
+ }
+ }
+ }
+ }
+
+ /**
* Check for tabs into the document
* Add an entry into the error's stack if a tab is found in the document
*