diff --git a/package-pman.php b/package-pman.php index b8871299..2cf2ed3b 100644 --- a/package-pman.php +++ b/package-pman.php @@ -5,7 +5,7 @@ PEAR::setErrorHandling(PEAR_ERROR_DIE); -$packagexml = new PEAR_PackageFileManager2; +$packagexml = new PEAR_PackageFileManager2(); $packagexml->setOptions(array( "outputdirectory" => ".", "filelistgenerator" => "file", diff --git a/phpdotnet/phd/Config.php b/phpdotnet/phd/Config.php index 8c561c63..18af42e2 100644 --- a/phpdotnet/phd/Config.php +++ b/phpdotnet/phd/Config.php @@ -149,7 +149,7 @@ public function setColorOutput(bool $colorOutput): void { * the manual docbook file are compared. If the index is older than * the docbook file, indexing will be done. * - * @return boolean True if indexing is required. + * @return bool True if indexing is required. */ public function requiresIndexing(): bool { if (! $this->indexCache) { diff --git a/phpdotnet/phd/Format.php b/phpdotnet/phd/Format.php index 2ac1d99d..27241f3c 100644 --- a/phpdotnet/phd/Format.php +++ b/phpdotnet/phd/Format.php @@ -7,19 +7,19 @@ abstract class Format extends ObjectStorage * Represents a short description. * Used in createLink() * - * @var integer + * @var int * @usedby createLink() */ - const SDESC = 1; + public const SDESC = 1; /** * Represents a long description. * Used in createLink() * - * @var integer + * @var int * @usedby createLink() */ - const LDESC = 2; + public const LDESC = 2; protected Config $config; protected OutputHandler $outputHandler; @@ -86,7 +86,7 @@ abstract public function CDATA($value); * * @param string $for Chunk ID * @param string &$desc Description of link, to be filled if neccessary - * @param integer $type Format of description, Format::SDESC or + * @param int $type Format of description, Format::SDESC or * Format::LDESC * * @return string|null|void Relative or absolute URI to access $for @@ -121,7 +121,7 @@ abstract public function appendData($data); * Called when a new chunk is opened or closed. * Value is either Render::OPEN or Render::CLOSE * - * @param integer $event Event flag (see Render class) + * @param int $event Event flag (see Render class) * @param mixed $value Additional value flag. Depends * on $event type * @@ -129,13 +129,13 @@ abstract public function appendData($data); */ abstract public function update($event, $value = null); - public final function parsePI($target, $data) { + final public function parsePI($target, $data) { if (isset($this->pihandlers[$target])) { return $this->pihandlers[$target]->parse($target, $data); } } - public final function registerPIHandlers($pihandlers) { + final public function registerPIHandlers($pihandlers) { foreach ($pihandlers as $target => $classname) { $class = __NAMESPACE__ . "\\" . $classname; $this->pihandlers[$target] = new $class($this); @@ -172,7 +172,7 @@ public function SQLiteIndex($context, $index, $id, $filename, $parent, $sdesc, $ /** * Calls update(). * - * @param integer $event Event flag. See Render class for constants + * @param int $event Event flag. See Render class for constants * like Render::INIT and Render::CHUNK * @param mixed $val Value; depends on $event flag * @@ -421,7 +421,7 @@ final public function getChildren($id) * * @param string $id XML ID to get chunk status for * - * @return boolean True if it is to be chunked + * @return bool True if it is to be chunked */ final public function isChunkID($id) { diff --git a/phpdotnet/phd/Format/Factory.php b/phpdotnet/phd/Format/Factory.php index e2046451..d8466e8c 100644 --- a/phpdotnet/phd/Format/Factory.php +++ b/phpdotnet/phd/Format/Factory.php @@ -7,39 +7,39 @@ abstract class Format_Factory { private $optionsHandler = null; private $pversion = "unknown"; - public final function getPackageVersion() { + final public function getPackageVersion() { return $this->pversion; } - public final function setPackageVersion($version) { + final public function setPackageVersion($version) { $this->pversion = $version; } - public final function getOutputFormats() { + final public function getOutputFormats() { return array_keys($this->formats); } - public final function registerOutputFormats($formats) { + final public function registerOutputFormats($formats) { $this->formats = $formats; } - public final function getOptionsHandler() { + final public function getOptionsHandler() { return $this->optionsHandler; } - public final function registerOptionsHandler(Options_Interface $optionsHandler) { + final public function registerOptionsHandler(Options_Interface $optionsHandler) { $this->optionsHandler = $optionsHandler; } - protected final function setPackageName($name) { + final protected function setPackageName($name) { if (!is_string($name)) { throw new \Exception("Package names must be strings.."); } $this->packageName = $name; } - public final function getPackageName() { + final public function getPackageName() { return $this->packageName; } - public final function createFormat($format, ...$formatParams) { + final public function createFormat($format, ...$formatParams) { if (isset($this->formats[$format]) && $this->formats[$format]) { $classname = __NAMESPACE__ . "\\" . $this->formats[$format]; @@ -52,7 +52,7 @@ public final function createFormat($format, ...$formatParams) { trigger_error("This format is not supported by this package", E_USER_ERROR); } - public static final function createFactory($package) { + final public static function createFactory($package) { static $factories = array(); if (!is_string($package)) { @@ -71,7 +71,7 @@ public static final function createFactory($package) { return $factories[$package]; } - public final function __toString() { + final public function __toString() { return $this->getPackageName(); } } diff --git a/phpdotnet/phd/Highlighter.php b/phpdotnet/phd/Highlighter.php index c59c18e7..e55541fa 100644 --- a/phpdotnet/phd/Highlighter.php +++ b/phpdotnet/phd/Highlighter.php @@ -57,7 +57,7 @@ public function highlight($text, $role, $format) return "\n.PP\n.nf\n" . str_replace("\\", "\\\\", trim($text)) . "\n.fi"; - } else if ($format != 'xhtml') { + } elseif ($format != 'xhtml') { return $text; } diff --git a/phpdotnet/phd/Highlighter/GeSHi11x.php b/phpdotnet/phd/Highlighter/GeSHi11x.php index 7c5abd0a..023ea0ae 100644 --- a/phpdotnet/phd/Highlighter/GeSHi11x.php +++ b/phpdotnet/phd/Highlighter/GeSHi11x.php @@ -62,7 +62,7 @@ public static function factory($format) require_once GESHI_CLASSES_ROOT . 'renderers/class.' . strtolower($rendererclass) . '.php'; $rendererclass = '\\' . $rendererclass; - $renderer = new $rendererclass; + $renderer = new $rendererclass(); return new self($renderer); diff --git a/phpdotnet/phd/MediaManager.php b/phpdotnet/phd/MediaManager.php index b22ec2c9..7c7cec6c 100644 --- a/phpdotnet/phd/MediaManager.php +++ b/phpdotnet/phd/MediaManager.php @@ -36,7 +36,7 @@ class MediaManager /** * If the image media directory exists * - * @var boolean + * @var bool */ protected $media_dir_exists = false; @@ -109,7 +109,7 @@ protected function copyOver($filename, $newpath) * based upon a specific language, then fallback to the English translation. * * @param string $filename Original filename - * @param boolean $allowfallback If the required file cannot be found then fallback to English + * @param bool $allowfallback If the required file cannot be found then fallback to English * * @return string Exact location of the file referenced with $filename or False if file not found. */ diff --git a/phpdotnet/phd/PIHandler.php b/phpdotnet/phd/PIHandler.php index 92b33b42..3bc887bd 100644 --- a/phpdotnet/phd/PIHandler.php +++ b/phpdotnet/phd/PIHandler.php @@ -11,7 +11,7 @@ public function __construct($format) { $this->format = $format; } - public abstract function parse($target, $data); + abstract public function parse($target, $data); } diff --git a/phpdotnet/phd/Package/Generic/ChunkedXHTML.php b/phpdotnet/phd/Package/Generic/ChunkedXHTML.php index 83e0481d..720fb547 100644 --- a/phpdotnet/phd/Package/Generic/ChunkedXHTML.php +++ b/phpdotnet/phd/Package/Generic/ChunkedXHTML.php @@ -79,10 +79,8 @@ public function update($event, $value = null) { if (!is_dir($this->getOutputDir())) { trigger_error("Output directory is a file?", E_USER_ERROR); } - } else { - if (!mkdir($this->getOutputDir(), 0777, true)) { - trigger_error("Can't create output directory", E_USER_ERROR); - } + } elseif (!mkdir($this->getOutputDir(), 0777, true)) { + trigger_error("Can't create output directory", E_USER_ERROR); } if ($this->config->css) { $this->fetchStylesheet(); diff --git a/phpdotnet/phd/Package/Generic/Manpage.php b/phpdotnet/phd/Package/Generic/Manpage.php index 7357f802..8efb9f02 100644 --- a/phpdotnet/phd/Package/Generic/Manpage.php +++ b/phpdotnet/phd/Package/Generic/Manpage.php @@ -2,8 +2,8 @@ namespace phpdotnet\phd; class Package_Generic_Manpage extends Format_Abstract_Manpage { - const OPEN_CHUNK = 0x01; - const CLOSE_CHUNK = 0x02; + public const OPEN_CHUNK = 0x01; + public const CLOSE_CHUNK = 0x02; private $elementmap = array( /* {{{ */ 'acronym' => 'format_suppressed_tags', @@ -318,10 +318,8 @@ public function update($event, $value = null) { if (!is_dir($this->getOutputDir())) { trigger_error("Output directory is a file?", E_USER_ERROR); } - } else { - if (!mkdir($this->getOutputDir(), 0777, true)) { - trigger_error("Can't create output directory", E_USER_ERROR); - } + } elseif (!mkdir($this->getOutputDir(), 0777, true)) { + trigger_error("Can't create output directory", E_USER_ERROR); } break; case Render::VERBOSE: diff --git a/phpdotnet/phd/Package/Generic/TocFeed.php b/phpdotnet/phd/Package/Generic/TocFeed.php index 0365b007..572b7143 100644 --- a/phpdotnet/phd/Package/Generic/TocFeed.php +++ b/phpdotnet/phd/Package/Generic/TocFeed.php @@ -200,7 +200,7 @@ public function close() * Called when a new chunk is opened or closed. * Value is either Render::OPEN or Render::CLOSE * - * @param integer $event Event flag (see Render class) + * @param int $event Event flag (see Render class) * @param mixed $value Additional value flag. Depends * on $event type * @@ -226,10 +226,8 @@ public function update($event, $value = null) if (!is_dir($dir)) { trigger_error("Output directory is a file?", E_USER_ERROR); } - } else { - if (!mkdir($dir, 0777, true)) { - trigger_error("Can't create output directory", E_USER_ERROR); - } + } elseif (!mkdir($dir, 0777, true)) { + trigger_error("Can't create output directory", E_USER_ERROR); } break; @@ -267,7 +265,7 @@ public function appendData($data) * header and footer * @param string $content XML Atom content to save * - * @return boolean True if the file has been written, false if not. + * @return bool True if the file has been written, false if not. * * @uses Format::getFilename() * @uses header() @@ -297,7 +295,7 @@ public function writeChunk($id, $content) /** * Format a chunked element * - * @param boolean $open If the tag is opened or closed + * @param bool $open If the tag is opened or closed * @param string $name Name of the tag * @param array $attrs XML tag attributes * @param array $props FIXME @@ -493,7 +491,7 @@ public function CDATA($value) * @param string $for Chunk ID * @param string &$desc Description of link, to be filled if neccessary. * Not used here. - * @param integer $type Format of description, Format::SDESC or + * @param int $type Format of description, Format::SDESC or * Format::LDESC. * Not used here. * diff --git a/phpdotnet/phd/Package/Generic/XHTML.php b/phpdotnet/phd/Package/Generic/XHTML.php index 8c419e42..fa395658 100644 --- a/phpdotnet/phd/Package/Generic/XHTML.php +++ b/phpdotnet/phd/Package/Generic/XHTML.php @@ -1,480 +1,531 @@ 'div', /* Docbook-xsl prints "abstract"... */ - 'abbrev' => 'abbr', - 'acronym' => 'acronym', - 'affiliation' => 'format_suppressed_tags', - 'alt' => 'format_suppressed_tags', - 'arg' => 'format_suppressed_tags', - 'article' => 'format_container_chunk_top', - 'author' => array( - /* DEFAULT */ 'format_author', - 'authorgroup' => 'format_authorgroup_author', + 'abstract' => 'div', /* Docbook-xsl prints "abstract"... */ + 'abbrev' => 'abbr', + 'acronym' => 'acronym', + 'affiliation' => 'format_suppressed_tags', + 'alt' => 'format_suppressed_tags', + 'arg' => 'format_suppressed_tags', + 'article' => 'format_container_chunk_top', + 'author' => array( + /* DEFAULT */ + 'format_author', + 'authorgroup' => 'format_authorgroup_author', ), - 'authorgroup' => 'div', - 'authorinitials' => 'format_entry', - 'appendix' => 'format_container_chunk_top', - 'application' => 'span', - 'blockquote' => 'blockquote', - 'bibliography' => array( - /* DEFAULT */ 'format_div', - 'article' => 'format_chunk', - 'book' => 'format_chunk', - 'part' => 'format_chunk', + 'authorgroup' => 'div', + 'authorinitials' => 'format_entry', + 'appendix' => 'format_container_chunk_top', + 'application' => 'span', + 'blockquote' => 'blockquote', + 'bibliography' => array( + /* DEFAULT */ + 'format_div', + 'article' => 'format_chunk', + 'book' => 'format_chunk', + 'part' => 'format_chunk', ), - 'book' => 'format_container_chunk_top', - 'caption' => 'format_caption', - 'chapter' => 'format_container_chunk_top', - 'citetitle' => 'em', - 'cmdsynopsis' => 'format_cmdsynopsis', - 'co' => 'format_co', - 'colophon' => 'format_chunk', - 'copyright' => 'format_copyright', - 'date' => array( - /* DEFAULT */ 'p', - 'revision' => 'format_entry', + 'book' => 'format_container_chunk_top', + 'caption' => 'format_caption', + 'chapter' => 'format_container_chunk_top', + 'citetitle' => 'em', + 'cmdsynopsis' => 'format_cmdsynopsis', + 'co' => 'format_co', + 'colophon' => 'format_chunk', + 'copyright' => 'format_copyright', + 'date' => array( + /* DEFAULT */ + 'p', + 'revision' => 'format_entry', ), - 'editor' => 'format_editor', - 'edition' => 'format_suppressed_tags', - 'email' => 'format_suppressed_tags', - 'errortext' => 'code', - 'firstname' => 'format_name', - 'footnote' => 'format_footnote', - 'footnoteref' => 'format_footnoteref', - 'funcdef' => 'format_suppressed_tags', - 'funcsynopsis' => 'div', - 'funcsynopsisinfo' => 'pre', - 'function' => 'span', - 'funcprototype' => 'code', - 'surname' => 'format_name', - 'othername' => 'format_name', - 'optional' => 'span', - 'honorific' => 'span', - 'glossary' => array( - /* DEFAULT */ 'format_div', - 'article' => 'format_chunk', - 'book' => 'format_chunk', - 'part' => 'format_chunk', + 'editor' => 'format_editor', + 'edition' => 'format_suppressed_tags', + 'email' => 'format_suppressed_tags', + 'errortext' => 'code', + 'firstname' => 'format_name', + 'footnote' => 'format_footnote', + 'footnoteref' => 'format_footnoteref', + 'funcdef' => 'format_suppressed_tags', + 'funcsynopsis' => 'div', + 'funcsynopsisinfo' => 'pre', + 'function' => 'span', + 'funcprototype' => 'code', + 'surname' => 'format_name', + 'othername' => 'format_name', + 'optional' => 'span', + 'honorific' => 'span', + 'glossary' => array( + /* DEFAULT */ + 'format_div', + 'article' => 'format_chunk', + 'book' => 'format_chunk', + 'part' => 'format_chunk', ), - 'calloutlist' => 'format_calloutlist', - 'callout' => 'format_callout', - 'caution' => 'format_admonition', - 'citation' => 'format_citation', - 'citerefentry' => 'span', - 'code' => 'code', - 'collab' => 'span', - 'collabname' => 'span', - 'contrib' => 'format_suppressed_tags', - 'colspec' => 'format_colspec', - 'command' => 'strong', - 'computeroutput' => 'span', + 'calloutlist' => 'format_calloutlist', + 'callout' => 'format_callout', + 'caution' => 'format_admonition', + 'citation' => 'format_citation', + 'citerefentry' => 'span', + 'code' => 'code', + 'collab' => 'span', + 'collabname' => 'span', + 'contrib' => 'format_suppressed_tags', + 'colspec' => 'format_colspec', + 'command' => 'strong', + 'computeroutput' => 'span', /* FIXME: This is one crazy stupid workaround for footnotes */ - 'constant' => array( - /* DEFAULT */ 'format_constant', - 'para' => array( - /* DEFAULT */ 'format_constant', - 'footnote' => 'format_footnote_constant', + 'constant' => array( + /* DEFAULT */ + 'format_constant', + 'para' => array( + /* DEFAULT */ + 'format_constant', + 'footnote' => 'format_footnote_constant', ), ), - 'constructorsynopsis' => 'format_methodsynopsis', - 'destructorsynopsis' => 'format_methodsynopsis', - 'emphasis' => 'format_emphasis', - 'entry' => array ( - /* DEFAULT */ 'format_entry', - 'row' => array( - /* DEFAULT */ 'format_entry', - 'thead' => 'format_th_entry', - 'tfoot' => 'format_th_entry', - 'tbody' => 'format_entry', + 'constructorsynopsis' => 'format_methodsynopsis', + 'destructorsynopsis' => 'format_methodsynopsis', + 'emphasis' => 'format_emphasis', + 'entry' => array( + /* DEFAULT */ + 'format_entry', + 'row' => array( + /* DEFAULT */ + 'format_entry', + 'thead' => 'format_th_entry', + 'tfoot' => 'format_th_entry', + 'tbody' => 'format_entry', ), ), - 'envar' => 'var', - 'errortype' => 'span', - 'errorcode' => 'span', - 'example' => 'format_example', - 'formalpara' => 'p', - 'fieldsynopsis' => array( - /* DEFAULT */ 'format_fieldsynopsis', - 'entry' => 'format_div', + 'envar' => 'var', + 'errortype' => 'span', + 'errorcode' => 'span', + 'example' => 'format_example', + 'formalpara' => 'p', + 'fieldsynopsis' => array( + /* DEFAULT */ + 'format_fieldsynopsis', + 'entry' => 'format_div', ), - 'figure' => 'div', - 'filename' => 'var', - 'glossentry' => 'li', - 'glossdef' => 'p', - 'glosslist' => 'format_itemizedlist', - 'glossterm' => 'span', - 'holder' => 'span', - 'imageobject' => 'format_div', - 'imagedata' => 'format_imagedata', - 'important' => 'format_admonition', - 'index' => array( - /* DEFAULT */ 'format_div', - 'article' => 'format_chunk', - 'book' => 'format_chunk', - 'part' => 'format_chunk', + 'figure' => 'div', + 'filename' => 'var', + 'glossentry' => 'li', + 'glossdef' => 'p', + 'glosslist' => 'format_itemizedlist', + 'glossterm' => 'span', + 'holder' => 'span', + 'imageobject' => 'format_div', + 'imagedata' => 'format_imagedata', + 'important' => 'format_admonition', + 'index' => array( + /* DEFAULT */ + 'format_div', + 'article' => 'format_chunk', + 'book' => 'format_chunk', + 'part' => 'format_chunk', ), - 'info' => array( - /* DEFAULT */ 'format_div', - 'note' => 'span', + 'info' => array( + /* DEFAULT */ + 'format_div', + 'note' => 'span', ), - 'informalexample' => 'format_div', - 'informaltable' => 'format_table', - 'indexdiv' => 'format_dl', - 'indexentry' => 'dd', - 'initializer' => 'format_initializer', - 'itemizedlist' => 'format_itemizedlist', - 'keycap' => 'format_keycap', - 'keycombo' => 'format_keycombo', - 'legalnotice' => 'format_chunk', - 'listitem' => array( - /* DEFAULT */ 'li', - 'varlistentry' => 'format_varlistentry_listitem', + 'informalexample' => 'format_div', + 'informaltable' => 'format_table', + 'indexdiv' => 'format_dl', + 'indexentry' => 'dd', + 'initializer' => 'format_initializer', + 'itemizedlist' => 'format_itemizedlist', + 'keycap' => 'format_keycap', + 'keycombo' => 'format_keycombo', + 'legalnotice' => 'format_chunk', + 'listitem' => array( + /* DEFAULT */ + 'li', + 'varlistentry' => 'format_varlistentry_listitem', ), - 'literal' => 'format_literal', - 'literallayout' => 'pre', - 'link' => 'format_link', - 'manvolnum' => 'format_manvolnum', - 'inlinemediaobject' => 'format_mediaobject', - 'mediaobject' => 'format_mediaobject', - 'methodparam' => 'format_methodparam', - 'methodsynopsis' => 'format_methodsynopsis', - 'methodname' => 'format_methodname', - 'member' => 'format_member', - 'modifier' => array( - /* DEFAULT */ 'format_modifier', - 'methodparam' => 'format_methodparam_modifier', + 'literal' => 'format_literal', + 'literallayout' => 'pre', + 'link' => 'format_link', + 'manvolnum' => 'format_manvolnum', + 'inlinemediaobject' => 'format_mediaobject', + 'mediaobject' => 'format_mediaobject', + 'methodparam' => 'format_methodparam', + 'methodsynopsis' => 'format_methodsynopsis', + 'methodname' => 'format_methodname', + 'member' => 'format_member', + 'modifier' => array( + /* DEFAULT */ + 'format_modifier', + 'methodparam' => 'format_methodparam_modifier', ), - 'note' => 'format_note', - 'orgname' => 'span', - 'othercredit' => 'format_div', + 'note' => 'format_note', + 'orgname' => 'span', + 'othercredit' => 'format_div', /** Class Synopsis related tags */ - 'classsynopsis' => 'format_classsynopsis', - 'classsynopsisinfo' => 'format_classsynopsisinfo', - 'ooclass' => array( - /* DEFAULT */ 'span', - 'classsynopsis' => 'format_classsynopsis_generic_oo_tag', + 'classsynopsis' => 'format_classsynopsis', + 'classsynopsisinfo' => 'format_classsynopsisinfo', + 'ooclass' => array( + /* DEFAULT */ + 'span', + 'classsynopsis' => 'format_classsynopsis_generic_oo_tag', ), - 'ooexception' => [ - /* DEFAULT */ 'span', - 'classsynopsis' => 'format_classsynopsis_generic_oo_tag', + 'ooexception' => [ + /* DEFAULT */ + 'span', + 'classsynopsis' => 'format_classsynopsis_generic_oo_tag', ], - 'oointerface' => array( - /* DEFAULT */ 'span', - 'classsynopsis' => 'format_classsynopsis_generic_oo_tag', + 'oointerface' => array( + /* DEFAULT */ + 'span', + 'classsynopsis' => 'format_classsynopsis_generic_oo_tag', 'classsynopsisinfo' => 'format_classsynopsisinfo_oointerface', ), - 'classname' => [ - /* DEFAULT */ 'span', - 'ooclass' => [ - /* DEFAULT */ 'span', - 'classsynopsis' => 'format_classsynopsis_ooclass_classname', + 'classname' => [ + /* DEFAULT */ + 'span', + 'ooclass' => [ + /* DEFAULT */ + 'span', + 'classsynopsis' => 'format_classsynopsis_ooclass_classname', 'classsynopsisinfo' => 'format_classsynopsisinfo_ooclass_classname', ], ], - 'exceptionname' => [ - /* DEFAULT */ 'span', - 'ooexception' => [ - /* DEFAULT */ 'span', - 'classsynopsis' => 'format_classsynopsis_ooclass_classname', + 'exceptionname' => [ + /* DEFAULT */ + 'span', + 'ooexception' => [ + /* DEFAULT */ + 'span', + 'classsynopsis' => 'format_classsynopsis_ooclass_classname', ], ], - 'interfacename' => array( - /* DEFAULT */ 'span', - 'oointerface' => array( - /* DEFAULT */ 'span', + 'interfacename' => array( + /* DEFAULT */ + 'span', + 'oointerface' => array( + /* DEFAULT */ + 'span', 'classsynopsis' => 'format_classsynopsis_oointerface_interfacename', 'classsynopsisinfo' => 'format_classsynopsisinfo_oointerface_interfacename', ), ), /** Enum synopsis related */ 'enumsynopsis' => 'format_enumsynopsis', - 'enumname' => [ - /* DEFAULT */ 'span', - 'enumsynopsis' => 'format_enumsynopsis_enumname' + 'enumname' => [ + /* DEFAULT */ + 'span', + 'enumsynopsis' => 'format_enumsynopsis_enumname' ], - 'enumitem' => 'format_enumitem', - 'enumidentifier' => 'format_enumidentifier', - 'enumvalue' => 'format_enumvalue', - 'enumitemdescription' => 'format_enumitemdescription', - 'option' => 'format_option', - 'orderedlist' => 'format_orderedlist', - 'para' => array( - /* DEFAULT */ 'p', - 'example' => 'format_example_content', - 'footnote' => 'format_footnote_para', - 'refsect1' => 'format_refsect1_para', - 'question' => 'format_suppressed_tags', + 'enumitem' => 'format_enumitem', + 'enumidentifier' => 'format_enumidentifier', + 'enumvalue' => 'format_enumvalue', + 'enumitemdescription' => 'format_enumitemdescription', + 'option' => 'format_option', + 'orderedlist' => 'format_orderedlist', + 'para' => array( + /* DEFAULT */ + 'p', + 'example' => 'format_example_content', + 'footnote' => 'format_footnote_para', + 'refsect1' => 'format_refsect1_para', + 'question' => 'format_suppressed_tags', ), - 'paramdef' => 'format_suppressed_tags', - 'parameter' => array( - /* DEFAULT */ 'format_parameter', - 'methodparam' => 'format_methodparam_parameter', + 'paramdef' => 'format_suppressed_tags', + 'parameter' => array( + /* DEFAULT */ + 'format_parameter', + 'methodparam' => 'format_methodparam_parameter', ), - 'part' => 'format_container_chunk_top', - 'partintro' => 'format_div', - 'personname' => 'format_personname', - 'personblurb' => 'format_div', - 'phrase' => 'span', - 'preface' => 'format_chunk', - 'printhistory' => 'format_div', - 'primaryie' => 'format_suppressed_tags', - 'procedure' => 'format_procedure', - 'productname' => 'span', - 'programlisting' => 'format_programlisting', - 'prompt' => 'span', - 'propname' => 'span', - 'property' => array( - /* DEFAULT */ 'span', + 'part' => 'format_container_chunk_top', + 'partintro' => 'format_div', + 'personname' => 'format_personname', + 'personblurb' => 'format_div', + 'phrase' => 'span', + 'preface' => 'format_chunk', + 'printhistory' => 'format_div', + 'primaryie' => 'format_suppressed_tags', + 'procedure' => 'format_procedure', + 'productname' => 'span', + 'programlisting' => 'format_programlisting', + 'prompt' => 'span', + 'propname' => 'span', + 'property' => array( + /* DEFAULT */ + 'span', 'classsynopsisinfo' => 'format_varname', ), - 'proptype' => 'span', - 'pubdate' => 'format_div', /* Docbook-XSL prints "published" */ - 'refentry' => 'format_chunk', - 'refentrytitle' => 'span', - 'refpurpose' => 'p', - 'reference' => 'format_container_chunk_below', - 'refsect1' => 'format_refsect', - 'refsect2' => 'format_refsect', - 'refsect3' => 'format_refsect', - 'refsynopsisdiv' => 'div', - 'refname' => 'h1', - 'refnamediv' => 'div', - 'releaseinfo' => 'div', - 'replaceable' => array( - /* DEFAULT */ 'span', - 'constant' => 'format_replaceable', + 'proptype' => 'span', + 'pubdate' => 'format_div', /* Docbook-XSL prints "published" */ + 'refentry' => 'format_chunk', + 'refentrytitle' => 'span', + 'refpurpose' => 'p', + 'reference' => 'format_container_chunk_below', + 'refsect1' => 'format_refsect', + 'refsect2' => 'format_refsect', + 'refsect3' => 'format_refsect', + 'refsynopsisdiv' => 'div', + 'refname' => 'h1', + 'refnamediv' => 'div', + 'releaseinfo' => 'div', + 'replaceable' => array( + /* DEFAULT */ + 'span', + 'constant' => 'format_replaceable', ), - 'revhistory' => 'format_table', - 'revision' => 'format_row', - 'revremark' => 'format_entry', - 'row' => 'format_row', - 'screen' => 'format_screen', - 'screenshot' => 'format_div', - 'sect1' => 'format_chunk', - 'sect2' => 'div', - 'sect3' => 'div', - 'sect4' => 'div', - 'sect5' => 'div', - 'section' => array( - /* DEFAULT */ 'div', - 'sect1' => 'format_section_chunk', - 'chapter' => 'format_section_chunk', - 'appendix' => 'format_section_chunk', - 'article' => 'format_section_chunk', - 'part' => 'format_section_chunk', - 'reference' => 'format_section_chunk', - 'refentry' => 'format_section_chunk', - 'index' => 'format_section_chunk', - 'bibliography' => 'format_section_chunk', - 'glossary' => 'format_section_chunk', - 'colopone' => 'format_section_chunk', - 'book' => 'format_section_chunk', - 'set' => 'format_section_chunk', - 'setindex' => 'format_section_chunk', - 'legalnotice' => 'format_section_chunk', + 'revhistory' => 'format_table', + 'revision' => 'format_row', + 'revremark' => 'format_entry', + 'row' => 'format_row', + 'screen' => 'format_screen', + 'screenshot' => 'format_div', + 'sect1' => 'format_chunk', + 'sect2' => 'div', + 'sect3' => 'div', + 'sect4' => 'div', + 'sect5' => 'div', + 'section' => array( + /* DEFAULT */ + 'div', + 'sect1' => 'format_section_chunk', + 'chapter' => 'format_section_chunk', + 'appendix' => 'format_section_chunk', + 'article' => 'format_section_chunk', + 'part' => 'format_section_chunk', + 'reference' => 'format_section_chunk', + 'refentry' => 'format_section_chunk', + 'index' => 'format_section_chunk', + 'bibliography' => 'format_section_chunk', + 'glossary' => 'format_section_chunk', + 'colopone' => 'format_section_chunk', + 'book' => 'format_section_chunk', + 'set' => 'format_section_chunk', + 'setindex' => 'format_section_chunk', + 'legalnotice' => 'format_section_chunk', ), - 'seg' => 'format_seg', - 'segmentedlist' => 'format_segmentedlist', - 'seglistitem' => 'format_seglistitem', - 'segtitle' => 'format_suppressed_tags', - 'set' => 'format_container_chunk_top', - 'setindex' => 'format_chunk', - 'shortaffil' => 'format_suppressed_tags', - 'sidebar' => 'format_note', - 'simplelist' => 'format_simplelist', - 'simplesect' => 'div', - 'simpara' => array( - /* DEFAULT */ 'p', - 'note' => 'span', - 'listitem' => 'span', - 'entry' => 'span', - 'example' => 'format_example_content', + 'seg' => 'format_seg', + 'segmentedlist' => 'format_segmentedlist', + 'seglistitem' => 'format_seglistitem', + 'segtitle' => 'format_suppressed_tags', + 'set' => 'format_container_chunk_top', + 'setindex' => 'format_chunk', + 'shortaffil' => 'format_suppressed_tags', + 'sidebar' => 'format_note', + 'simplelist' => 'format_simplelist', + 'simplesect' => 'div', + 'simpara' => array( + /* DEFAULT */ + 'p', + 'note' => 'span', + 'listitem' => 'span', + 'entry' => 'span', + 'example' => 'format_example_content', ), - 'spanspec' => 'format_suppressed_tags', - 'step' => 'format_step', - 'superscript' => 'sup', - 'subscript' => 'sub', - 'systemitem' => 'format_systemitem', - 'symbol' => 'span', - 'synopsis' => 'pre', - 'tag' => 'code', - 'table' => 'format_table', - 'firstterm' => 'format_term', - 'term' => array( - /* DEFAULT */ 'format_term', - 'varlistentry' => 'format_varlistentry_term' + 'spanspec' => 'format_suppressed_tags', + 'step' => 'format_step', + 'superscript' => 'sup', + 'subscript' => 'sub', + 'systemitem' => 'format_systemitem', + 'symbol' => 'span', + 'synopsis' => 'pre', + 'tag' => 'code', + 'table' => 'format_table', + 'firstterm' => 'format_term', + 'term' => array( + /* DEFAULT */ + 'format_term', + 'varlistentry' => 'format_varlistentry_term' ), - 'tfoot' => 'format_th', - 'tbody' => 'format_tbody', - 'td' => 'format_th', - 'th' => 'format_th', - 'thead' => 'format_th', - 'tgroup' => 'format_tgroup', - 'tip' => 'format_admonition', - 'title' => array( - /* DEFAULT */ 'h1', - 'example' => 'format_example_title', - 'formalpara' => 'h5', - 'info' => array( - /* DEFAULT */ 'h1', - 'example' => 'format_example_title', - 'note' => 'format_note_title', - 'table' => 'format_table_title', + 'tfoot' => 'format_th', + 'tbody' => 'format_tbody', + 'td' => 'format_th', + 'th' => 'format_th', + 'thead' => 'format_th', + 'tgroup' => 'format_tgroup', + 'tip' => 'format_admonition', + 'title' => array( + /* DEFAULT */ + 'h1', + 'example' => 'format_example_title', + 'formalpara' => 'h5', + 'info' => array( + /* DEFAULT */ + 'h1', + 'example' => 'format_example_title', + 'note' => 'format_note_title', + 'table' => 'format_table_title', 'informaltable' => 'format_table_title', - 'article' => 'format_container_chunk_top_title', - 'appendix' => 'format_container_chunk_top_title', - 'book' => 'format_container_chunk_top_title', - 'chapter' => 'format_container_chunk_top_title', - 'part' => 'format_container_chunk_top_title', - 'set' => 'format_container_chunk_top_title', + 'article' => 'format_container_chunk_top_title', + 'appendix' => 'format_container_chunk_top_title', + 'book' => 'format_container_chunk_top_title', + 'chapter' => 'format_container_chunk_top_title', + 'part' => 'format_container_chunk_top_title', + 'set' => 'format_container_chunk_top_title', ), - 'indexdiv' => 'dt', - 'legalnotice' => 'h4', - 'note' => 'format_note_title', - 'phd:toc' => 'strong', - 'procedure' => 'strong', - 'refsect1' => 'h3', - 'refsect2' => 'h4', - 'refsect3' => 'h5', - 'section' => 'h2', - 'sect1' => 'h2', - 'sect2' => 'h3', - 'sect3' => 'h4', - 'sect4' => 'h5', - 'segmentedlist' => 'format_table_title', - 'table' => 'format_table_title', - 'variablelist' => 'format_variablelist_title', - 'article' => 'format_container_chunk_top_title', - 'appendix' => 'format_container_chunk_top_title', - 'book' => 'format_container_chunk_top_title', - 'chapter' => 'format_container_chunk_top_title', - 'part' => 'format_container_chunk_top_title', - 'set' => 'format_container_chunk_top_title', + 'indexdiv' => 'dt', + 'legalnotice' => 'h4', + 'note' => 'format_note_title', + 'phd:toc' => 'strong', + 'procedure' => 'strong', + 'refsect1' => 'h3', + 'refsect2' => 'h4', + 'refsect3' => 'h5', + 'section' => 'h2', + 'sect1' => 'h2', + 'sect2' => 'h3', + 'sect3' => 'h4', + 'sect4' => 'h5', + 'segmentedlist' => 'format_table_title', + 'table' => 'format_table_title', + 'variablelist' => 'format_variablelist_title', + 'article' => 'format_container_chunk_top_title', + 'appendix' => 'format_container_chunk_top_title', + 'book' => 'format_container_chunk_top_title', + 'chapter' => 'format_container_chunk_top_title', + 'part' => 'format_container_chunk_top_title', + 'set' => 'format_container_chunk_top_title', ), - 'titleabbrev' => 'format_suppressed_tags', - 'token' => 'code', - 'tr' => 'format_row', - 'trademark' => 'format_trademark', - 'type' => 'span', - 'userinput' => 'format_userinput', - 'uri' => 'code', - 'variablelist' => 'format_variablelist', - 'varlistentry' => 'format_varlistentry', - 'varname' => array( - /* DEFAULT */ 'var', - 'fieldsynopsis' => 'format_fieldsynopsis_varname', + 'titleabbrev' => 'format_suppressed_tags', + 'token' => 'code', + 'tr' => 'format_row', + 'trademark' => 'format_trademark', + 'type' => 'span', + 'userinput' => 'format_userinput', + 'uri' => 'code', + 'variablelist' => 'format_variablelist', + 'varlistentry' => 'format_varlistentry', + 'varname' => array( + /* DEFAULT */ + 'var', + 'fieldsynopsis' => 'format_fieldsynopsis_varname', ), - 'void' => 'format_void', - 'warning' => 'format_admonition', - 'xref' => 'format_xref', - 'year' => 'span', - 'quote' => 'q', - 'qandaset' => 'format_qandaset', - 'qandaentry' => 'dl', - 'question' => array( - /* DEFAULT */ 'format_question', - 'questions' => 'format_phd_question', // From the PhD namespace + 'void' => 'format_void', + 'warning' => 'format_admonition', + 'xref' => 'format_xref', + 'year' => 'span', + 'quote' => 'q', + 'qandaset' => 'format_qandaset', + 'qandaentry' => 'dl', + 'question' => array( + /* DEFAULT */ + 'format_question', + 'questions' => 'format_phd_question', // From the PhD namespace ), - 'questions' => 'ol', // From the PhD namespace - 'answer' => 'dd', + 'questions' => 'ol', // From the PhD namespace + 'answer' => 'dd', //phpdoc: implemented in the PHP Package - 'phpdoc:classref' => 'format_suppressed_tags', - 'phpdoc:exception' => 'format_suppressed_tags', - 'phpdoc:exceptionref' => 'format_suppressed_tags', - 'phpdoc:varentry' => 'format_suppressed_tags', + 'phpdoc:classref' => 'format_suppressed_tags', + 'phpdoc:exception' => 'format_suppressed_tags', + 'phpdoc:exceptionref' => 'format_suppressed_tags', + 'phpdoc:varentry' => 'format_suppressed_tags', //phd - 'phd:toc' => 'format_phd_toc', + 'phd:toc' => 'format_phd_toc', ); /* }}} */ private $mytextmap = array( - 'segtitle' => 'format_segtitle_text', - 'affiliation' => 'format_suppressed_text', - 'contrib' => 'format_suppressed_text', - 'shortaffil' => 'format_suppressed_text', - 'edition' => 'format_suppressed_text', - - 'programlisting' => 'format_programlisting_text', - 'screen' => 'format_screen_text', - 'alt' => 'format_alt_text', - 'modifier' => array( - /* DEFAULT */ false, - 'fieldsynopsis' => 'format_fieldsynopsis_modifier_text', - 'methodparam' => 'format_modifier_text', - 'methodsynopsis' => 'format_modifier_text', + 'segtitle' => 'format_segtitle_text', + 'affiliation' => 'format_suppressed_text', + 'contrib' => 'format_suppressed_text', + 'shortaffil' => 'format_suppressed_text', + 'edition' => 'format_suppressed_text', + + 'programlisting' => 'format_programlisting_text', + 'screen' => 'format_screen_text', + 'alt' => 'format_alt_text', + 'modifier' => array( + /* DEFAULT */ + false, + 'fieldsynopsis' => 'format_fieldsynopsis_modifier_text', + 'methodparam' => 'format_modifier_text', + 'methodsynopsis' => 'format_modifier_text', 'constructorsynopsis' => 'format_modifier_text', - 'ooclass' => 'format_modifier_text', - 'ooexception' => 'format_modifier_text', - 'oointerface' => 'format_modifier_text', + 'ooclass' => 'format_modifier_text', + 'ooexception' => 'format_modifier_text', + 'oointerface' => 'format_modifier_text', ), - 'replaceable' => array( - /* DEFAULT */ false, - 'constant' => 'format_suppressed_text', + 'replaceable' => array( + /* DEFAULT */ + false, + 'constant' => 'format_suppressed_text', ), /** Those are used to retrieve the class/interface name to be able to remove it from method names */ 'classname' => [ - /* DEFAULT */ false, + /* DEFAULT */ + false, 'ooclass' => [ - /* DEFAULT */ false, + /* DEFAULT */ + false, /** This is also used by the legacy display to not display the class name at all */ 'classsynopsis' => 'format_classsynopsis_ooclass_classname_text', ] ], 'exceptionname' => [ - /* DEFAULT */ false, + /* DEFAULT */ + false, 'ooexception' => [ - /* DEFAULT */ false, + /* DEFAULT */ + false, 'classsynopsis' => 'format_classsynopsis_oo_name_text', ] ], 'interfacename' => [ - /* DEFAULT */ false, + /* DEFAULT */ + false, 'oointerface' => [ - /* DEFAULT */ false, + /* DEFAULT */ + false, 'classsynopsis' => 'format_classsynopsis_oo_name_text', ] ], - 'methodname' => array( - /* DEFAULT */ false, + 'methodname' => array( + /* DEFAULT */ + false, 'constructorsynopsis' => array( - /* DEFAULT */ false, + /* DEFAULT */ + false, 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', ), - 'methodsynopsis' => array( - /* DEFAULT */ false, + 'methodsynopsis' => array( + /* DEFAULT */ + false, 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', ), 'destructorsynopsis' => array( - /* DEFAULT */ false, + /* DEFAULT */ + false, 'classsynopsis' => 'format_classsynopsis_methodsynopsis_methodname_text', ), ), - 'para' => array( - /* DEFAULT */ false, - 'footnote' => 'format_footnote_para_text', + 'para' => array( + /* DEFAULT */ + false, + 'footnote' => 'format_footnote_para_text', ), - 'property' => [ - /* DEFAULT */ 'format_property_text', + 'property' => [ + /* DEFAULT */ + 'format_property_text', ], /* FIXME: This is one crazy stupid workaround for footnotes */ - 'constant' => array( - /* DEFAULT */ 'format_constant_text', - 'para' => array( - /* DEFAULT */ 'format_constant_text', - 'footnote' => 'format_footnote_constant_text', + 'constant' => array( + /* DEFAULT */ + 'format_constant_text', + 'para' => array( + /* DEFAULT */ + 'format_constant_text', + 'footnote' => 'format_footnote_constant_text', ), ), - 'literal' => 'format_literal_text', - 'email' => 'format_email_text', - 'titleabbrev' => 'format_suppressed_text', - 'member' => 'format_member_text', + 'literal' => 'format_literal_text', + 'email' => 'format_email_text', + 'titleabbrev' => 'format_suppressed_text', + 'member' => 'format_member_text', ); /** @var array */ @@ -486,60 +537,58 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML { /** @var string */ protected $CURRENT_CHUNK = ""; - /* Current Chunk variables */ - protected $cchunk = array(); + /* Current Chunk variables */ + protected $cchunk = array(); /* Default Chunk variables */ - private $dchunk = array( + private $dchunk = array( "classsynopsis" => [ - "close" => false, - "classname" => false, - "interface" => false, // bool: true when in interface - "ooclass" => false, - "oointerface" => false, - "legacy" => true, // legacy rendering + "close" => false, + "classname" => false, + "interface" => false, // bool: true when in interface + "ooclass" => false, + "oointerface" => false, + "legacy" => true, // legacy rendering ], - "classsynopsisinfo" => array( - "implements" => false, - "ooclass" => false, + "classsynopsisinfo" => array( + "implements" => false, + "ooclass" => false, ), - "examples" => 0, - "fieldsynopsis" => array( - "modifier" => "public", + "examples" => 0, + "fieldsynopsis" => array( + "modifier" => "public", ), - "methodsynopsis" => array( - "returntypes" => array(), - "type_separator" => array(), + "methodsynopsis" => array( + "returntypes" => array(), + "type_separator" => array(), "type_separator_stack" => array(), ), - "co" => 0, - "callouts" => 0, - "segmentedlist" => array( - "segtitleclosed" => false, - "segtitleopened" => false, + "co" => 0, + "callouts" => 0, + "segmentedlist" => array( + "segtitleclosed" => false, + "segtitleopened" => false, ), - "table" => false, - "procedure" => false, - "mediaobject" => array( - "alt" => false, + "table" => false, + "procedure" => false, + "mediaobject" => array( + "alt" => false, ), - "footnote" => array( + "footnote" => array(), + "tablefootnotes" => array(), + "chunk_id" => null, + "varlistentry" => array( + "listitems" => array(), ), - "tablefootnotes" => array( - ), - "chunk_id" => null, - "varlistentry" => array( - "listitems" => array(), - ), - "simplelist" => array( - "members" => array(), - "type" => null, - "columns" => null, + "simplelist" => array( + "members" => array(), + "type" => null, + "columns" => null, ), ); protected $pihandlers = array( - 'dbhtml' => 'PI_DBHTMLHandler', - 'dbtimestamp' => 'PI_DBHTMLHandler', + 'dbhtml' => 'PI_DBHTMLHandler', + 'dbtimestamp' => 'PI_DBHTMLHandler', ); protected $stylesheets = array(); @@ -555,31 +604,37 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML { protected array $perPageExampleIds = []; public function __construct( - Config $config, + Config $config, OutputHandler $outputHandler - ) { + ) + { parent::__construct($config, $outputHandler); $this->registerPIHandlers($this->pihandlers); $this->setExt($this->config->ext === null ? ".html" : $this->config->ext); } - public function getDefaultElementMap() { + public function getDefaultElementMap() + { return $this->myelementmap; } - public function getDefaultTextMap() { + public function getDefaultTextMap() + { return $this->mytextmap; } - public function getChunkInfo() { + public function getChunkInfo() + { return $this->cchunk; } - public function getDefaultChunkInfo() { + public function getDefaultChunkInfo() + { return $this->dchunk; } - protected function createTOC($id, $name, $props, $depth = 1, $header = true) { + protected function createTOC($id, $name, $props, $depth = 1, $header = true) + { if (!$this->getChildren($id) || $depth == 0) { return ""; } @@ -596,13 +651,13 @@ protected function createTOC($id, $name, $props, $depth = 1, $header = true) { $link = $this->createLink($child); $list = ""; - if ($depth > 1 ) { - $list = $this->createTOC($child, $name, $props, $depth -1, false); + if ($depth > 1) { + $list = $this->createTOC($child, $name, $props, $depth - 1, false); } if ($isLDesc && $isSDesc) { $toc .= '
'; - break; + case "methodsynopsis": + case "constructorsynopsis": + case "destructorsynopsis": + return '
'; + break; - default: - return '
'; + default: + return '
'; } } return '
'; } - public function format_refsect($open, $name, $attrs) { + + public function format_refsect($open, $name, $attrs) + { static $role = 0; if ($open) { - if(!isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { + if (!isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { $attrs[Reader::XMLNS_DOCBOOK]["role"] = "unknown-" . ++$role; } $this->pushRole($attrs[Reader::XMLNS_DOCBOOK]["role"]); if (isset($attrs[Reader::XMLNS_XML]["id"])) { $id = $attrs[Reader::XMLNS_XML]["id"]; - } - else { - $id = $name. "-" . $this->CURRENT_CHUNK . "-" . $this->getRole(); + } else { + $id = $name . "-" . $this->CURRENT_CHUNK . "-" . $this->getRole(); } - return '
{
"; return "
{
"; - } - } - if (isset($attrs[Reader::XMLNS_DOCBOOK]["choice"]) && $attrs[Reader::XMLNS_DOCBOOK]["choice"] == "opt") { - $this->params["opt"] = true; - } else { - $this->params["opt"] = false; - } - if ($this->params["count"]) { - $content .= ","; - if ($this->params["paramCount"] > 3) { - $content .= "
"; - } else { - $content .= " "; - } + if ($this->params["count"] === 0) { + $content .= "("; + if ($this->params["paramCount"] > 3) { + $content .= "
"; } - $content .= ''; - ++$this->params["count"]; - if (isset($attrs[Reader::XMLNS_DOCBOOK]["rep"]) && $attrs[Reader::XMLNS_DOCBOOK]["rep"] == "repeat") { - $this->params["ellipsis"] = '...'; + } + if (isset($attrs[Reader::XMLNS_DOCBOOK]["choice"]) && $attrs[Reader::XMLNS_DOCBOOK]["choice"] == "opt") { + $this->params["opt"] = true; + } else { + $this->params["opt"] = false; + } + if ($this->params["count"]) { + $content .= ","; + if ($this->params["paramCount"] > 3) { + $content .= "
"; } else { - $this->params["ellipsis"] = ''; + $content .= " "; } - return $content; + } + $content .= ''; + ++$this->params["count"]; + if (isset($attrs[Reader::XMLNS_DOCBOOK]["rep"]) && $attrs[Reader::XMLNS_DOCBOOK]["rep"] == "repeat") { + $this->params["ellipsis"] = '...'; + } else { + $this->params["ellipsis"] = ''; + } + return $content; } if ($this->params["opt"] && !$this->params["init"]) { return ' = ?'; @@ -1474,42 +1581,49 @@ public function format_methodparam($open, $name, $attrs) { return ""; } - public function format_methodname($open, $name, $attr) { + public function format_methodname($open, $name, $attr) + { if ($open) { - return ' '; + return ' '; } return ''; } - public function format_varname($open, $name, $attrs) { + public function format_varname($open, $name, $attrs) + { if ($open) { - return '$'; + return '$'; } return ""; } - public function format_fieldsynopsis_varname($open, $name, $attrs) { + + public function format_fieldsynopsis_varname($open, $name, $attrs) + { if ($open) { if ($this->cchunk["fieldsynopsis"]["modifier"] === "const") { return ''; } - return '$'; + return '$'; } return ''; } - public function format_footnoteref($open, $name, $attrs, $props) { + public function format_footnoteref($open, $name, $attrs, $props) + { if ($open) { $linkend = $attrs[Reader::XMLNS_DOCBOOK]["linkend"]; - foreach($this->cchunk["footnote"] as $k => $note) { + foreach ($this->cchunk["footnote"] as $k => $note) { if ($note["id"] === $linkend) { - return '[' .($k + 1). ']'; + return '[' . ($k + 1) . ']'; } } trigger_error("footnoteref ID '$linkend' not found", E_USER_WARNING); return ""; } } - public function format_footnote($open, $name, $attrs, $props) { + + public function format_footnote($open, $name, $attrs, $props) + { if ($open) { $count = count($this->cchunk["footnote"]); $noteid = isset($attrs[Reader::XMLNS_XML]["id"]) ? $attrs[Reader::XMLNS_XML]["id"] : $count + 1; @@ -1518,23 +1632,28 @@ public function format_footnote($open, $name, $attrs, $props) { if ($this->cchunk["table"]) { $this->cchunk["tablefootnotes"][$count] = $noteid; } - return '[' .($count + 1). ']'; + return '[' . ($count + 1) . ']'; } return ""; } /* {{{ FIXME: These are crazy workarounds :( */ - public function format_footnote_constant($open, $name, $attrs, $props) { + public function format_footnote_constant($open, $name, $attrs, $props) + { $k = count($this->cchunk["footnote"]) - 1; $this->cchunk["footnote"][$k]["str"] .= self::format_constant($open, $name, $attrs, $props); return ""; } - public function format_footnote_constant_text($value, $tag) { + + public function format_footnote_constant_text($value, $tag) + { $k = count($this->cchunk["footnote"]) - 1; $this->cchunk["footnote"][$k]["str"] .= $value; return ""; } - public function format_footnote_para($open, $name, $attrs, $props) { + + public function format_footnote_para($open, $name, $attrs, $props) + { $k = count($this->cchunk["footnote"]) - 1; if ($open) { $this->cchunk["footnote"][$k]["str"] .= ''; @@ -1544,7 +1663,9 @@ public function format_footnote_para($open, $name, $attrs, $props) { $this->cchunk["footnote"][$k]["str"] .= ""; return ""; } - public function format_footnote_para_text($value, $tag) { + + public function format_footnote_para_text($value, $tag) + { $k = count($this->cchunk["footnote"]) - 1; $this->cchunk["footnote"][$k]["str"] .= $value; return ""; @@ -1552,53 +1673,65 @@ public function format_footnote_para_text($value, $tag) { /* }}} */ - public function format_co($open, $name, $attrs, $props) { + public function format_co($open, $name, $attrs, $props) + { if (($open || $props["empty"]) && isset($attrs[Reader::XMLNS_XML]["id"])) { $co = ++$this->cchunk["co"]; - return '' .str_repeat("*", $co) .''; + return '' . str_repeat("*", $co) . ''; } /* Suppress closing tag if any */ return ""; } - public function format_calloutlist($open, $name, $attrs) { + + public function format_calloutlist($open, $name, $attrs) + { if ($open) { $this->cchunk["callouts"] = 0; return '
'; + return '
'; } - return ''; + return ''; } return ""; } - public function format_trademark($open, $name, $attrs, $props) { + + public function format_trademark($open, $name, $attrs, $props) + { if ($open) { - return ''; + return ''; } return '®'; } - public function format_userinput($open, $name, $attrs) { + + public function format_userinput($open, $name, $attrs) + { if ($open) { - return '
'; + return ''; } return ""; } - public function format_systemitem($open, $name, $attrs) { + + public function format_systemitem($open, $name, $attrs) + { if ($open) { $val = isset($attrs[Reader::XMLNS_DOCBOOK]["role"]) ? $attrs[Reader::XMLNS_DOCBOOK]["role"] : null; - switch($val) { - case "directive": - /* FIXME: Different roles should probably be handled differently */ - default: - return ''; + switch ($val) { + case "directive": + /* FIXME: Different roles should probably be handled differently */ + default: + return ' ";
}
- public function format_programlisting($open, $name, $attrs) {
+
+ public function format_programlisting($open, $name, $attrs)
+ {
$hasAnnotations = array_key_exists('annotations', $attrs[Reader::XMLNS_DOCBOOK]);
if ($open) {
$this->pushRole($attrs[Reader::XMLNS_DOCBOOK]["role"] ?? null);
@@ -1748,10 +1907,14 @@ public function format_programlisting($open, $name, $attrs) {
$this->popRole();
return "'; } } return ""; } - public function format_example_content($open, $name, $attrs) { + + public function format_example_content($open, $name, $attrs) + { if ($open) { return ''; } return "
'; + return '
'; } - return '
" . ($this->autogen('example', $props['lang']) - . (isset($this->cchunk["examples"]) ? ++$this->cchunk["examples"] : "")) . " "; + . (isset($this->cchunk["examples"]) ? ++$this->cchunk["examples"] : "")) . " "; } return "
"; } + public function format_table_title($open, $name, $attrs, $props) { if ($props["empty"]) { @@ -1968,34 +2152,41 @@ public function format_table_title($open, $name, $attrs, $props) } return ""; } - public function format_variablelist_title($open, $name, $attrs, $props) { + + public function format_variablelist_title($open, $name, $attrs, $props) + { if ($open) { return ($this->getRole() === 'constant_list') ? "'; - foreach($questions as $node) { + foreach ($questions as $node) { $id = $xp->evaluate("ancestor::db:qandaentry", $node)->item(0)->getAttributeNs(Reader::XMLNS_XML, "id"); /* FIXME: No ID? How can we create an anchor for it then? */ @@ -2211,34 +2410,40 @@ public function format_qandaset($open, $name, $attrs, $props) { $id = uniqid("phd"); } - $retval .= '- '.htmlentities($node->textContent, ENT_QUOTES, "UTF-8").'
';
+ $retval .= '- ' . htmlentities($node->textContent, ENT_QUOTES, "UTF-8") . '
';
}
$retval .= "
' . $arFixes[$class][0]; } - public function format_dl($open, $name, $attrs, $props) { + public function format_dl($open, $name, $attrs, $props) + { if ($open) { return ''; } return '
'; } - public function format_itemizedlist($open, $name, $attrs, $props) { + public function format_itemizedlist($open, $name, $attrs, $props) + { if ($open) { return ''; } return '
'; } - public function format_simplelist($open, $name, $attrs, $props) { + public function format_simplelist($open, $name, $attrs, $props) + { if ($open) { $this->cchunk["simplelist"]["type"] = $attrs[Reader::XMLNS_DOCBOOK]["type"] ?? ""; $this->cchunk["simplelist"]["columns"] = $attrs[Reader::XMLNS_DOCBOOK]["columns"] ?? 1; @@ -2354,13 +2566,13 @@ public function format_simplelist($open, $name, $attrs, $props) { $list = match ($this->cchunk["simplelist"]["type"]) { "inline" => $this->simplelist_format_inline(), - "horiz" => $this->simplelist_format_horizontal($props["depth"]) - . $this->indent($props["depth"] + 1) . "'; + return '' : ' ';
}
public function getGeneratedExampleID($index)
{
$originalId = parent::getGeneratedExampleID($index);
- if (! $this->exampleCounterIsPerPage) {
+ if (!$this->exampleCounterIsPerPage) {
return $originalId;
}
if (preg_match('/^example\-[0-9]+$/', $originalId)) {
diff --git a/phpdotnet/phd/Package/IDE/API.php b/phpdotnet/phd/Package/IDE/API.php
index 97f6543f..e513eaef 100644
--- a/phpdotnet/phd/Package/IDE/API.php
+++ b/phpdotnet/phd/Package/IDE/API.php
@@ -35,14 +35,14 @@ class Package_IDE_API
*
* @var string
*/
- const FUNCTIONS_DIR = 'ide-xml';
+ public const FUNCTIONS_DIR = 'ide-xml';
/**
* Output file of the funclist format in the IDE Package.
*
* @var string
*/
- const FUNCLIST_FILE = 'ide-funclist.txt';
+ public const FUNCLIST_FILE = 'ide-funclist.txt';
/**
* PhD output directory.
diff --git a/phpdotnet/phd/Package/IDE/Base.php b/phpdotnet/phd/Package/IDE/Base.php
index f1992040..83edbbec 100644
--- a/phpdotnet/phd/Package/IDE/Base.php
+++ b/phpdotnet/phd/Package/IDE/Base.php
@@ -1,55 +1,56 @@
'format_notes',
- 'entry' => 'format_changelog_entry',
- 'function' => 'format_seealso_entry',
- 'listitem' => 'format_parameter_desc',
- 'methodparam' => 'format_methodparam',
- 'methodname' => 'format_seealso_entry',
- 'member' => 'format_member',
- 'note' => 'format_notes',
- 'refentry' => 'format_refentry',
- 'refpurpose' => 'format_refpurpose',
- 'refnamediv' => 'format_suppressed_tags',
- 'refsect1' => 'format_refsect1',
- 'row' => 'format_changelog_row',
- 'set' => 'format_set',
- 'tbody' => 'format_changelog_tbody',
- 'tip' => 'format_notes',
- 'warning' => 'format_notes',
+ 'caution' => 'format_notes',
+ 'entry' => 'format_changelog_entry',
+ 'function' => 'format_seealso_entry',
+ 'listitem' => 'format_parameter_desc',
+ 'methodparam' => 'format_methodparam',
+ 'methodname' => 'format_seealso_entry',
+ 'member' => 'format_member',
+ 'note' => 'format_notes',
+ 'refentry' => 'format_refentry',
+ 'refpurpose' => 'format_refpurpose',
+ 'refnamediv' => 'format_suppressed_tags',
+ 'refsect1' => 'format_refsect1',
+ 'row' => 'format_changelog_row',
+ 'set' => 'format_set',
+ 'tbody' => 'format_changelog_tbody',
+ 'tip' => 'format_notes',
+ 'warning' => 'format_notes',
);
- protected $textmap = array(
- 'function' => 'format_seealso_entry_text',
- 'initializer' => 'format_initializer_text',
- 'methodname' => 'format_seealso_entry_text',
- 'parameter' => 'format_parameter_text',
- 'refname' => 'format_refname_text',
- 'title' => 'format_suppressed_text',
- 'type' => 'format_type_text',
+ protected $textmap = array(
+ 'function' => 'format_seealso_entry_text',
+ 'initializer' => 'format_initializer_text',
+ 'methodname' => 'format_seealso_entry_text',
+ 'parameter' => 'format_parameter_text',
+ 'refname' => 'format_refname_text',
+ 'title' => 'format_suppressed_text',
+ 'type' => 'format_type_text',
);
protected $cchunk = array();
protected $dchunk = array(
- 'function' => array(),
- 'methodparam' => false,
- 'param' => array(
- 'name' => false,
- 'type' => false,
- 'description' => false,
- 'opt' => false,
- 'initializer' => false,
+ 'function' => array(),
+ 'methodparam' => false,
+ 'param' => array(
+ 'name' => false,
+ 'type' => false,
+ 'description' => false,
+ 'opt' => false,
+ 'initializer' => false,
),
- 'seealso' => array(
- 'name' => false,
- 'type' => false,
- 'description' => false,
+ 'seealso' => array(
+ 'name' => false,
+ 'type' => false,
+ 'description' => false,
),
- 'changelog' => array(
- 'entry' => false,
- 'version' => false,
- 'change' => false,
+ 'changelog' => array(
+ 'entry' => false,
+ 'version' => false,
+ 'change' => false,
),
);
@@ -58,45 +59,64 @@ abstract class Package_IDE_Base extends Format {
protected $role = false;
protected $versions;
- protected $function = array();
+ protected $function = array();
protected $dfunction = array(
- 'name' => null,
- 'purpose' => null,
- 'manualid' => null,
- 'version' => null,
- 'params' => array(),
- 'currentParam' => null,
- 'return' => array(
- 'type' => null,
- 'description' => null,
+ 'name' => null,
+ 'purpose' => null,
+ 'manualid' => null,
+ 'version' => null,
+ 'params' => array(),
+ 'currentParam' => null,
+ 'return' => array(
+ 'type' => null,
+ 'description' => null,
),
- 'errors' => null,
- 'notes' => array(),
- 'changelog' => array(),
- 'seealso' => array(),
+ 'errors' => null,
+ 'notes' => array(),
+ 'changelog' => array(),
+ 'seealso' => array(),
);
-
+
private array $chunkFlags = [];
public function __construct(
- Config $config,
+ Config $config,
OutputHandler $outputHandler
- ) {
+ )
+ {
parent::__construct($config, $outputHandler);
}
- public function createLink($for, &$desc = null, $type = Format::SDESC) {}
- public function UNDEF($open, $name, $attrs, $props) {}
- public function TEXT($value) {}
- public function CDATA($value) {}
- public function transformFromMap($open, $tag, $name, $attrs, $props) {}
- public function appendData($data) {}
+ public function createLink($for, &$desc = null, $type = Format::SDESC)
+ {
+ }
+
+ public function UNDEF($open, $name, $attrs, $props)
+ {
+ }
+
+ public function TEXT($value)
+ {
+ }
+
+ public function CDATA($value)
+ {
+ }
+
+ public function transformFromMap($open, $tag, $name, $attrs, $props)
+ {
+ }
+
+ public function appendData($data)
+ {
+ }
- public abstract function parseFunction();
+ abstract public function parseFunction();
- function writeChunk() {
+ public function writeChunk()
+ {
if (!isset($this->cchunk['funcname'][0])) {
- return;
+ return;
}
if (false !== strpos($this->cchunk['funcname'][0], ' ')) {
return;
@@ -109,7 +129,7 @@ function writeChunk() {
file_put_contents($filename, $data);
$index = 0;
- while(isset($this->cchunk['funcname'][++$index])) {
+ while (isset($this->cchunk['funcname'][++$index])) {
$filename = $this->getOutputDir() . $this->cchunk['funcname'][$index] . $this->getExt();
// Replace the default function name by the alternative one
$content = preg_replace('/' . $this->cchunk['funcname'][0] . '/',
@@ -118,7 +138,8 @@ function writeChunk() {
}
}
- public function renderHTML() {
+ public function renderHTML()
+ {
static $format = null;
if ($format == null) {
$format = new Package_Generic_ChunkedXHTML(
@@ -129,63 +150,70 @@ public function renderHTML() {
return $format->parse(trim(ReaderKeeper::getReader()->readInnerXML()));
}
- public function CHUNK($value) {
+ public function CHUNK($value)
+ {
$this->chunkFlags = $value;
}
- public function STANDALONE($value) {
+ public function STANDALONE($value)
+ {
$this->registerElementMap($this->elementmap);
$this->registerTextMap($this->textmap);
}
- public function INIT($value) {
+ public function INIT($value)
+ {
$this->loadVersionInfo();
$this->createOutputDirectory();
}
- public function FINALIZE($value) {
+ public function FINALIZE($value)
+ {
}
- public function VERBOSE($value) {
+ public function VERBOSE($value)
+ {
$this->outputHandler->v('Starting %s rendering', $this->getFormatName(), VERBOSE_FORMAT_RENDERING);
}
- public function update($event, $value = null) {
- switch($event) {
- case Render::CHUNK:
- $this->CHUNK($value);
- break;
- case Render::STANDALONE:
- $this->STANDALONE($value);
- break;
- case Render::INIT:
- $this->INIT($value);
- break;
- case Render::FINALIZE:
- $this->FINALIZE($value);
- break;
- case Render::VERBOSE:
- $this->VERBOSE($value);
- break;
- }
- }
-
- public static function generateVersionInfo($filename) {
+ public function update($event, $value = null)
+ {
+ switch ($event) {
+ case Render::CHUNK:
+ $this->CHUNK($value);
+ break;
+ case Render::STANDALONE:
+ $this->STANDALONE($value);
+ break;
+ case Render::INIT:
+ $this->INIT($value);
+ break;
+ case Render::FINALIZE:
+ $this->FINALIZE($value);
+ break;
+ case Render::VERBOSE:
+ $this->VERBOSE($value);
+ break;
+ }
+ }
+
+ public static function generateVersionInfo($filename)
+ {
static $info;
if ($info) {
return $info;
}
- $r = new \XMLReader;
+ $r = new \XMLReader();
if (!$r->open($filename)) {
- throw new \Exception;
+ throw new \Exception();
}
$versions = array();
- while($r->read()) {
+ while ($r->read()) {
if (
$r->moveToAttribute('name')
&& ($funcname = str_replace(
array('::', '->', '__', '_', '$'),
- array('-', '-', '-', '-', ''),
+ array('-', '-', '-', '-', ''),
$r->value))
&& $r->moveToAttribute('from')
&& ($from = $r->value)
@@ -199,19 +227,21 @@ public static function generateVersionInfo($filename) {
return $versions;
}
- public function versionInfo($funcname) {
+ public function versionInfo($funcname)
+ {
$funcname = str_replace(
- array('.', '::', '->', '->', '__', '_', '$', '()'),
- array('-', '-', '-', '-', '-', '-', '', ''),
- strtolower($funcname));
- if(isset($this->versions[$funcname])) {
- return $this->versions[$funcname];
+ array('.', '::', '->', '->', '__', '_', '$', '()'),
+ array('-', '-', '-', '-', '-', '-', '', ''),
+ strtolower($funcname));
+ if (isset($this->versions[$funcname])) {
+ return $this->versions[$funcname];
}
$this->outputHandler->v('No version info for %s', $funcname, VERBOSE_NOVERSION);
return false;
}
- public function loadVersionInfo() {
+ public function loadVersionInfo()
+ {
if (file_exists($this->config->phpwebVersionFilename)) {
$this->versions = self::generateVersionInfo($this->config->phpwebVersionFilename);
} else {
@@ -219,34 +249,37 @@ public function loadVersionInfo() {
}
}
- public function createOutputDirectory() {
+ public function createOutputDirectory()
+ {
$this->setOutputDir($this->config->outputDir . strtolower($this->getFormatName()) . '/');
if (file_exists($this->getOutputDir())) {
if (!is_dir($this->getOutputDir())) {
trigger_error("Output directory is a file?", E_USER_ERROR);
}
- } else {
- if (!mkdir($this->getOutputDir(), 0777, true)) {
- trigger_error("Can't create output directory", E_USER_ERROR);
- }
+ } elseif (!mkdir($this->getOutputDir(), 0777, true)) {
+ trigger_error("Can't create output directory", E_USER_ERROR);
}
}
- public function format_suppressed_tags($open, $name, $attrs, $props) {
+ public function format_suppressed_tags($open, $name, $attrs, $props)
+ {
return '';
}
- public function format_suppressed_text($value, $tag) {
+ public function format_suppressed_text($value, $tag)
+ {
return '';
}
- public function format_set($open, $name, $attrs, $props) {
+ public function format_set($open, $name, $attrs, $props)
+ {
if (isset($attrs[Reader::XMLNS_XML]['id']) && $attrs[Reader::XMLNS_XML]['id'] == 'funcref') {
$this->isFunctionRefSet = $open;
}
}
- public function format_refentry($open, $name, $attrs, $props) {
+ public function format_refentry($open, $name, $attrs, $props)
+ {
if (!$this->isFunctionRefSet) {
return;
}
@@ -254,25 +287,28 @@ public function format_refentry($open, $name, $attrs, $props) {
$this->function = $this->dfunction;
$this->cchunk = $this->dchunk;
- $this->function['manualid'] = $attrs[Reader::XMLNS_XML]['id'];
+ $this->function['manualid'] = $attrs[Reader::XMLNS_XML]['id'];
return;
}
$this->writeChunk();
}
- public function format_refname_text($value, $tag) {
+ public function format_refname_text($value, $tag)
+ {
if ($this->isFunctionRefSet) {
$this->cchunk['funcname'][] = $this->toValidName(trim($value));
}
}
- public function format_refpurpose($open, $name, $attrs, $props) {
+ public function format_refpurpose($open, $name, $attrs, $props)
+ {
if ($this->isFunctionRefSet && $open) {
$this->function['purpose'] = str_replace("\n", '', trim(ReaderKeeper::getReader()->readString()));
}
}
- public function format_refsect1($open, $name, $attrs, $props) {
+ public function format_refsect1($open, $name, $attrs, $props)
+ {
if (!$this->isFunctionRefSet) {
return;
}
@@ -292,7 +328,8 @@ public function format_refsect1($open, $name, $attrs, $props) {
}
}
- public function format_type_text($value, $tag) {
+ public function format_type_text($value, $tag)
+ {
if (!$this->isFunctionRefSet) {
return;
}
@@ -305,8 +342,9 @@ public function format_type_text($value, $tag) {
}
}
- public function format_methodparam($open, $name, $attrs, $props) {
- if ($this->role != 'description' || !$this->isFunctionRefSet ) {
+ public function format_methodparam($open, $name, $attrs, $props)
+ {
+ if ($this->role != 'description' || !$this->isFunctionRefSet) {
return;
}
if ($open) {
@@ -329,7 +367,8 @@ public function format_methodparam($open, $name, $attrs, $props) {
$this->function['params'][$param['name']] = $param;
}
- public function format_parameter_text($value, $tag) {
+ public function format_parameter_text($value, $tag)
+ {
if (!$this->isFunctionRefSet) {
return;
}
@@ -341,7 +380,8 @@ public function format_parameter_text($value, $tag) {
}
}
- public function format_parameter_desc($open, $name, $attrs, $props) {
+ public function format_parameter_desc($open, $name, $attrs, $props)
+ {
if ($this->role != 'parameters') {
return;
}
@@ -354,7 +394,8 @@ public function format_parameter_desc($open, $name, $attrs, $props) {
}
}
- public function format_initializer_text($value, $tag) {
+ public function format_initializer_text($value, $tag)
+ {
if (!$this->isFunctionRefSet) {
return;
}
@@ -364,7 +405,8 @@ public function format_initializer_text($value, $tag) {
$this->cchunk['param']['initializer'] = $value;
}
- public function format_return($open, $name, $attrs, $props) {
+ public function format_return($open, $name, $attrs, $props)
+ {
if ($open) {
//Read the description
$content = $this->renderHTML();
@@ -374,7 +416,8 @@ public function format_return($open, $name, $attrs, $props) {
}
}
- public function format_notes($open, $name, $attrs, $props) {
+ public function format_notes($open, $name, $attrs, $props)
+ {
if ($this->role != 'notes' || !$this->isFunctionRefSet) {
return;
}
@@ -388,7 +431,8 @@ public function format_notes($open, $name, $attrs, $props) {
}
}
- public function format_errors($open, $name, $attrs, $props) {
+ public function format_errors($open, $name, $attrs, $props)
+ {
if ($open) {
//Read the description
$content = $this->renderHTML();
@@ -398,13 +442,15 @@ public function format_errors($open, $name, $attrs, $props) {
}
}
- public function format_changelog_tbody($open, $name, $attrs, $props) {
+ public function format_changelog_tbody($open, $name, $attrs, $props)
+ {
if ($this->role == 'changelog' && $this->isFunctionRefSet) {
$this->isChangelogRow = $open;
}
}
- public function format_changelog_row($open, $name, $attrs, $props) {
+ public function format_changelog_row($open, $name, $attrs, $props)
+ {
if ($this->isChangelogRow) {
if ($open) {
$this->cchunk['changelog'] = $this->dchunk['changelog'];
@@ -416,23 +462,26 @@ public function format_changelog_row($open, $name, $attrs, $props) {
}
}
- public function format_changelog_entry($open, $name, $attrs, $props) {
+ public function format_changelog_entry($open, $name, $attrs, $props)
+ {
if ($this->isChangelogRow && $open) {
$entryType = ($this->cchunk['changelog']['entry'] == 'version')
- ? 'change'
- : 'version';
+ ? 'change'
+ : 'version';
$this->cchunk['changelog'][$entryType] = trim(ReaderKeeper::getReader()->readString());
$this->cchunk['changelog']['entry'] = $entryType;
}
}
- public function format_changelog_entry_text($value, $tag) {
+ public function format_changelog_entry_text($value, $tag)
+ {
if ($this->isChangelogRow) {
$this->cchunk['changelog'][$this->cchunk['changelog']['entry']] = $value;
}
}
- public function format_member($open, $name, $attrs, $props) {
+ public function format_member($open, $name, $attrs, $props)
+ {
if ($this->role == 'seealso' && $this->isFunctionRefSet) {
if ($open) {
$this->cchunk['seealso'] = $this->dchunk['seealso'];
@@ -449,19 +498,22 @@ public function format_member($open, $name, $attrs, $props) {
}
}
- public function format_seealso_entry($open, $name, $attrs, $props) {
+ public function format_seealso_entry($open, $name, $attrs, $props)
+ {
if ($this->role == 'seealso' && $this->isFunctionRefSet) {
$this->cchunk['seealso']['type'] = $name;
}
}
- public function format_seealso_entry_text($value, $tag) {
+ public function format_seealso_entry_text($value, $tag)
+ {
if ($this->role == 'seealso' && $this->isFunctionRefSet) {
$this->cchunk['seealso']['name'] = $value;
}
}
- public function toValidName($functionName) {
+ public function toValidName($functionName)
+ {
return str_replace(array('::', '->', '()'), array('.', '.', ''), $functionName);
}
diff --git a/phpdotnet/phd/Package/IDE/demo.php b/phpdotnet/phd/Package/IDE/demo.php
index fd7601cd..e0e7cfaa 100644
--- a/phpdotnet/phd/Package/IDE/demo.php
+++ b/phpdotnet/phd/Package/IDE/demo.php
@@ -11,7 +11,7 @@
spl_autoload_register(array("phpdotnet\\phd\\Autoloader", "autoload"));
//FIXME Remove this call to Config
-$config = new PhD\Config;
+$config = new PhD\Config();
$config->init(array());
function usage()
diff --git a/phpdotnet/phd/Package/PEAR/CHM.php b/phpdotnet/phd/Package/PEAR/CHM.php
index d016be5b..c7ab69e1 100755
--- a/phpdotnet/phd/Package/PEAR/CHM.php
+++ b/phpdotnet/phd/Package/PEAR/CHM.php
@@ -2,8 +2,8 @@
namespace phpdotnet\phd;
class Package_PEAR_CHM extends Package_PEAR_ChunkedXHTML {
- const DEFAULT_FONT = "Arial,10,0";
- const DEFAULT_TITLE = "PEAR Manual";
+ public const DEFAULT_FONT = "Arial,10,0";
+ public const DEFAULT_TITLE = "PEAR Manual";
// Array to manual code -> HTML Help Code conversion
// Code list: http://www.helpware.net/htmlhelp/hh_info.htm
diff --git a/phpdotnet/phd/Package/PEAR/ChunkedXHTML.php b/phpdotnet/phd/Package/PEAR/ChunkedXHTML.php
index 8a8383b5..bd4eeeca 100755
--- a/phpdotnet/phd/Package/PEAR/ChunkedXHTML.php
+++ b/phpdotnet/phd/Package/PEAR/ChunkedXHTML.php
@@ -82,10 +82,8 @@ public function update($event, $value = null) {
if (!is_dir($this->getOutputDir())) {
trigger_error("Output directory is a file?", E_USER_ERROR);
}
- } else {
- if (!mkdir($this->getOutputDir(), 0777, true)) {
- trigger_error("Can't create output directory", E_USER_ERROR);
- }
+ } elseif (!mkdir($this->getOutputDir(), 0777, true)) {
+ trigger_error("Can't create output directory", E_USER_ERROR);
}
if ($this->config->css) {
$this->fetchStylesheet();
diff --git a/phpdotnet/phd/Package/PEAR/XHTML.php b/phpdotnet/phd/Package/PEAR/XHTML.php
index dcbc8cd7..a6b3fa43 100755
--- a/phpdotnet/phd/Package/PEAR/XHTML.php
+++ b/phpdotnet/phd/Package/PEAR/XHTML.php
@@ -348,7 +348,7 @@ abstract class Package_PEAR_XHTML extends Package_Generic_XHTML {
* If whitespace should be trimmed.
* Helpful for programlistings that are encapsulated in
'; } return '
'; } /* Support for key inputs is coded like junk */ - public function format_keycap($open, $name, $attrs, $props) { + public function format_keycap($open, $name, $attrs, $props) + { if ($open) { $content = ''; if ($props['sibling']) { @@ -2486,7 +2706,8 @@ public function format_keycap($open, $name, $attrs, $props) { return ''; } - public function format_keycombo($open, $name, $attrs, $props) { + public function format_keycombo($open, $name, $attrs, $props) + { if (isset($attrs[Reader::XMLNS_DOCBOOK]["action"])) { if ($attrs[Reader::XMLNS_DOCBOOK]["action"] !== "simul") { @@ -2499,12 +2720,13 @@ public function format_keycombo($open, $name, $attrs, $props) { return ''; } - public function format_whitespace($whitespace, $elementStack, $currentDepth) { + public function format_whitespace($whitespace, $elementStack, $currentDepth) + { /* The following if is to skip unnecessary whitespaces in the parameter list */ if ( in_array($elementStack[$currentDepth - 1], ['methodsynopsis', 'constructorsynopsis', 'destructorsynopsis'], true) && (in_array($elementStack[$currentDepth] ?? "", ["methodname", "methodparam", "type", "void"], true) - || count($elementStack) === $currentDepth) + || count($elementStack) === $currentDepth) ) { return false; } @@ -2530,7 +2752,7 @@ public function format_whitespace($whitespace, $elementStack, $currentDepth) { && ($this->cchunk["simplelist"]["type"] === "inline" || $this->cchunk["simplelist"]["type"] === "vert" || $this->cchunk["simplelist"]["type"] === "horiz") - ) { + ) { return false; } @@ -2545,14 +2767,15 @@ public function format_whitespace($whitespace, $elementStack, $currentDepth) { return $whitespace; } - public function format_caption($open, $name, $attrs, $props) { + public function format_caption($open, $name, $attrs, $props) + { return $open ? 'tags * - * @var boolean + * @var bool * * @see CDATA() */ @@ -643,7 +643,7 @@ public function format_phd_pearapi($open, $name, $attrs, $props) if (count($arLinkend) == 1) { //link to class $linktpl = '{$package}/docs/latest/{$package}/{$class}.html'; - } else if ($arLinkend[1]{0} == '$') { + } elseif ($arLinkend[1]{0} == '$') { //link to class variable $variable = $arLinkend[1]; $linktpl = '{$package}/docs/latest/{$package}/{$class}.html#var{$variable}'; diff --git a/phpdotnet/phd/Package/PHP/CHM.php b/phpdotnet/phd/Package/PHP/CHM.php index 86d9c445..3d36b79a 100644 --- a/phpdotnet/phd/Package/PHP/CHM.php +++ b/phpdotnet/phd/Package/PHP/CHM.php @@ -3,8 +3,8 @@ class Package_PHP_CHM extends Package_PHP_ChunkedXHTML { - const DEFAULT_FONT = "Arial,10,0"; - const DEFAULT_TITLE = "PHP Manual"; + public const DEFAULT_FONT = "Arial,10,0"; + public const DEFAULT_TITLE = "PHP Manual"; // Array to manual code -> HTML Help Code conversion // Code list: http://www.helpware.net/htmlhelp/hh_info.htm diff --git a/phpdotnet/phd/Package/PHP/HowTo.php b/phpdotnet/phd/Package/PHP/HowTo.php index 20db365e..b6983608 100644 --- a/phpdotnet/phd/Package/PHP/HowTo.php +++ b/phpdotnet/phd/Package/PHP/HowTo.php @@ -30,10 +30,8 @@ public function update($event, $value = null) { if (!is_dir($this->getOutputDir())) { trigger_error("Output directory is a file?", E_USER_ERROR); } - } else { - if (!mkdir($this->getOutputDir(), 0777, true)) { - trigger_error("Can't create output directory", E_USER_ERROR); - } + } elseif (!mkdir($this->getOutputDir(), 0777, true)) { + trigger_error("Can't create output directory", E_USER_ERROR); } break; } diff --git a/phpdotnet/phd/Package/PHP/KDevelop.php b/phpdotnet/phd/Package/PHP/KDevelop.php index 5783e898..5fc5927b 100644 --- a/phpdotnet/phd/Package/PHP/KDevelop.php +++ b/phpdotnet/phd/Package/PHP/KDevelop.php @@ -2,7 +2,7 @@ namespace phpdotnet\phd; class Package_PHP_KDevelop extends Format { - const DEFAULT_HREF = "http://www.php.net/manual/en/"; + public const DEFAULT_HREF = "http://www.php.net/manual/en/"; protected $elementmap = array( 'book' => 'format_tocsect1', @@ -132,10 +132,8 @@ public function format_tocsect1($open, $name, $attrs) { $name = htmlspecialchars(Format::getShortDescription($id), ENT_QUOTES, 'UTF-8'); $url = (Format::getFilename($id) ? Format::getFilename($id) : $id) . $this->getExt(); fwrite($this->getFileStream(), "\n");
- } else {
- if ($hasChild)
- fwrite($this->getFileStream(), " \n");
- }
+ } elseif ($hasChild)
+ fwrite($this->getFileStream(), "\n");
return "";
}
diff --git a/phpdotnet/phd/Package/PHP/Web.php b/phpdotnet/phd/Package/PHP/Web.php
index ad36b7cf..f136b8ef 100644
--- a/phpdotnet/phd/Package/PHP/Web.php
+++ b/phpdotnet/phd/Package/PHP/Web.php
@@ -91,10 +91,8 @@ public function update($event, $value = null) {
if (!is_dir($this->getOutputDir())) {
trigger_error("Output directory is a file?", E_USER_ERROR);
}
- } else {
- if (!mkdir($this->getOutputDir(), 0777, true)) {
- trigger_error("Can't create output directory", E_USER_ERROR);
- }
+ } elseif (!mkdir($this->getOutputDir(), 0777, true)) {
+ trigger_error("Can't create output directory", E_USER_ERROR);
}
if ($this->getFormatName() == "PHP-Web") {
if (!$this->config->noToc && is_dir($this->getOutputDir() . 'toc')) {
@@ -409,7 +407,7 @@ public static function generateSourcesInfo($filename) {
return array();
}
- $r = new \XMLReader;
+ $r = new \XMLReader();
if (!$r->open($filename)) {
trigger_error(vsprintf("Can't open the sources file (%s)", [$filename]), E_USER_ERROR);
return array();
diff --git a/phpdotnet/phd/Package/PHP/XHTML.php b/phpdotnet/phd/Package/PHP/XHTML.php
index 1109038e..e33f97d2 100644
--- a/phpdotnet/phd/Package/PHP/XHTML.php
+++ b/phpdotnet/phd/Package/PHP/XHTML.php
@@ -261,7 +261,7 @@ public static function generateVersionInfo($filename) {
return array();
}
- $r = new \XMLReader;
+ $r = new \XMLReader();
if (!$r->open($filename)) {
trigger_error(vsprintf("Can't open the version info file (%s)", [$filename]), E_USER_ERROR);
}
@@ -298,7 +298,7 @@ protected static function generateDeprecatedInfo($filename) {
return array();
}
- $r = new \XMLReader;
+ $r = new \XMLReader();
if (!$r->open($filename)) {
trigger_error(vsprintf("Can't open the version info file (%s)", [$filename]), E_USER_ERROR);
}
@@ -332,7 +332,7 @@ public static function generateAcronymInfo($filename) {
return array();
}
- $r = new \XMLReader;
+ $r = new \XMLReader();
if (!$r->open($filename)) {
trigger_error(vsprintf("Could not open file for accessing acronym information (%s)", [$filename]), E_USER_ERROR);
}
@@ -347,7 +347,7 @@ public static function generateAcronymInfo($filename) {
$r->read();
$k = $r->value;
$acronyms[$k] = "";
- } else if ($r->name == "simpara") {
+ } elseif ($r->name == "simpara") {
$r->read();
$acronyms[$k] = $r->value;
}
@@ -425,15 +425,13 @@ public function format_methodsynopsis_type($open, $tag, $attrs) {
"intersection" => "&",
};
}
- } else {
- if (
- isset($attrs[Reader::XMLNS_DOCBOOK]["class"])
- && ($attrs[Reader::XMLNS_DOCBOOK]["class"] === "union"
- || $attrs[Reader::XMLNS_DOCBOOK]["class"] === "intersection")
- ) {
- $lastSeparator = array_pop($this->cchunk["methodsynopsis"]["type_separator_stack"]);
- $this->cchunk["methodsynopsis"]["type_separator"][count($this->cchunk["methodsynopsis"]["type_separator"]) - 1] = end($this->cchunk["methodsynopsis"]["type_separator_stack"]) ?: $lastSeparator;
- }
+ } elseif (
+ isset($attrs[Reader::XMLNS_DOCBOOK]["class"])
+ && ($attrs[Reader::XMLNS_DOCBOOK]["class"] === "union"
+ || $attrs[Reader::XMLNS_DOCBOOK]["class"] === "intersection")
+ ) {
+ $lastSeparator = array_pop($this->cchunk["methodsynopsis"]["type_separator_stack"]);
+ $this->cchunk["methodsynopsis"]["type_separator"][count($this->cchunk["methodsynopsis"]["type_separator"]) - 1] = end($this->cchunk["methodsynopsis"]["type_separator_stack"]) ?: $lastSeparator;
}
return "";
@@ -541,7 +539,7 @@ public function format_methodsynopsis($open, $name, $attrs, $props) {
$content = "";
if ($this->params["paramCount"] > 3) {
$content .= ""; - } else if ($this->params["paramCount"] === 0) { + } elseif ($this->params["paramCount"] === 0) { $content .= "("; } @@ -652,15 +650,13 @@ public function format_type_methodparam($open, $tag, $attrs) { "intersection" => "&", }; } - } else { - if ( - isset($attrs[Reader::XMLNS_DOCBOOK]["class"]) - && ($attrs[Reader::XMLNS_DOCBOOK]["class"] === "union" - || $attrs[Reader::XMLNS_DOCBOOK]["class"] === "intersection") - ) { - $lastSeparator = array_pop($this->cchunk["methodparam"]["type_separator_stack"]); - $this->cchunk["methodparam"]["type_separator"][count($this->cchunk["methodparam"]["type_separator"]) - 1] = end($this->cchunk["methodparam"]["type_separator_stack"]) ?: $lastSeparator; - } + } elseif ( + isset($attrs[Reader::XMLNS_DOCBOOK]["class"]) + && ($attrs[Reader::XMLNS_DOCBOOK]["class"] === "union" + || $attrs[Reader::XMLNS_DOCBOOK]["class"] === "intersection") + ) { + $lastSeparator = array_pop($this->cchunk["methodparam"]["type_separator_stack"]); + $this->cchunk["methodparam"]["type_separator"][count($this->cchunk["methodparam"]["type_separator"]) - 1] = end($this->cchunk["methodparam"]["type_separator_stack"]) ?: $lastSeparator; } return ""; @@ -757,7 +753,7 @@ public function configureVerInfoAttribute($attrs) { /* TODO This should be migrated to the annotations attribute */ if (isset($attrs[Reader::XMLNS_DOCBOOK]["annotations"])) { $this->cchunk["verinfo"] = !str_contains($attrs[Reader::XMLNS_DOCBOOK]["annotations"], 'verify_info:false'); - } else if (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { + } elseif (isset($attrs[Reader::XMLNS_DOCBOOK]["role"])) { $this->cchunk["verinfo"] = !($attrs[Reader::XMLNS_DOCBOOK]["role"] == "noversion"); } else { $this->cchunk["verinfo"] = true; diff --git a/phpdotnet/phd/Reader.php b/phpdotnet/phd/Reader.php index 796a2d71..864fda77 100644 --- a/phpdotnet/phd/Reader.php +++ b/phpdotnet/phd/Reader.php @@ -3,10 +3,10 @@ class Reader extends \XMLReader { - const XMLNS_XML = "http://www.w3.org/XML/1998/namespace"; - const XMLNS_XLINK = "http://www.w3.org/1999/xlink"; - const XMLNS_PHD = "http://www.php.net/ns/phd"; - const XMLNS_DOCBOOK = "http://docbook.org/ns/docbook"; + public const XMLNS_XML = "http://www.w3.org/XML/1998/namespace"; + public const XMLNS_XLINK = "http://www.w3.org/1999/xlink"; + public const XMLNS_PHD = "http://www.php.net/ns/phd"; + public const XMLNS_DOCBOOK = "http://docbook.org/ns/docbook"; protected OutputHandler $outputHandler; diff --git a/phpdotnet/phd/Reader/Partial.php b/phpdotnet/phd/Reader/Partial.php index 6ff1d631..9ed188ba 100644 --- a/phpdotnet/phd/Reader/Partial.php +++ b/phpdotnet/phd/Reader/Partial.php @@ -78,15 +78,13 @@ public function read(): bool { return $ret; } elseif (empty($this->partial)) { return false; - } else { + } elseif ($id && $this->parents) { // If we are used by the indexer then we have no clue about the // parents :) - if ($id && $this->parents) { - // If this id isn't one of our ancestors we can jump - // completely over it - if (!in_array($id, $this->parents)) { - parent::next(); - } + // If this id isn't one of our ancestors we can jump + // completely over it + if (!in_array($id, $this->parents)) { + parent::next(); } } } diff --git a/phpdotnet/phd/Render.php b/phpdotnet/phd/Render.php index 5e4201cd..62a53237 100644 --- a/phpdotnet/phd/Render.php +++ b/phpdotnet/phd/Render.php @@ -3,13 +3,13 @@ class Render extends ObjectStorage { - const CHUNK = 0x001; - const OPEN = 0x002; - const CLOSE = 0x004; - const STANDALONE = 0x008; - const INIT = 0x010; - const FINALIZE = 0x020; - const VERBOSE = 0x040; + public const CHUNK = 0x001; + public const OPEN = 0x002; + public const CLOSE = 0x004; + public const STANDALONE = 0x008; + public const INIT = 0x010; + public const FINALIZE = 0x020; + public const VERBOSE = 0x040; private $STACK = array(); diff --git a/render.php b/render.php index f7b3e3e3..7a37fcdd 100644 --- a/render.php +++ b/render.php @@ -8,7 +8,7 @@ spl_autoload_register(array(__NAMESPACE__ . "\\Autoloader", "autoload")); -$config = new Config; +$config = new Config(); $outputHandler = new OutputHandler($config); @@ -34,7 +34,7 @@ } } $optionsParser = new Options_Parser( - new Options_Handler($config, new Package_Generic_Factory, $outputHandler), + new Options_Handler($config, new Package_Generic_Factory(), $outputHandler), ...$packageHandlers ); $commandLineOptions = $optionsParser->getopt(); diff --git a/tests/setup.php b/tests/setup.php index 37ebb2de..11fb7c6e 100644 --- a/tests/setup.php +++ b/tests/setup.php @@ -7,7 +7,7 @@ Autoloader::setPackageDirs([__INSTALLDIR__]); spl_autoload_register(["phpdotnet\\phd\\Autoloader", "autoload"]); -$config = new Config; +$config = new Config(); $outputHandler = new OutputHandler($config);