Skip to content

Commit f625e76

Browse files
committed
Fix rendering of class method names inside packagesynopsis
1 parent e546e7b commit f625e76

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

phpdotnet/phd/Package/Generic/XHTML.php

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,11 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
467467
'constant' => 'format_suppressed_text',
468468
),
469469
/** Those are used to retrieve the class/interface name to be able to remove it from method names */
470+
'package' => [
471+
/* DEFAULT */ false,
472+
'packagesynopsis' => 'format_packagesynopsis_package_text'
473+
],
474+
/** Those are used to retrieve the class/interface name to be able to remove it from method names */
470475
'classname' => [
471476
/* DEFAULT */ false,
472477
'ooclass' => [
@@ -538,7 +543,10 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML {
538543
protected $cchunk = array();
539544
/* Default Chunk variables */
540545
private $dchunk = array(
541-
"packagesynopsis" => false,
546+
"packagesynopsis" => [
547+
"open" => false,
548+
"namespace" => false,
549+
],
542550
"classsynopsis" => [
543551
"close" => false,
544552
"classname" => false,
@@ -1257,7 +1265,7 @@ public function format_classsynopsis($open, $name, $attrs, $props) {
12571265
/** Legacy presentation does not use the class attribute */
12581266
$this->cchunk["classsynopsis"]['legacy'] = !isset($attrs[Reader::XMLNS_DOCBOOK]["class"]);
12591267

1260-
$inPackageSynopsis = $this->cchunk["packagesynopsis"] ?? false;
1268+
$inPackageSynopsis = $this->cchunk["packagesynopsis"]["open"] ?? false;
12611269

12621270
if ($this->cchunk["classsynopsis"]['legacy']) {
12631271
if ($open) {
@@ -1324,18 +1332,26 @@ public function format_classsynopsis_methodsynopsis_methodname_text($value, $tag
13241332
}
13251333

13261334
list($class, $method) = explode($explode, $value);
1327-
if ($class !== $this->cchunk["classsynopsis"]["classname"]) {
1335+
$thisFqcn = "";
1336+
if ($this->cchunk["packagesynopsis"]["namespace"]) {
1337+
$thisFqcn = $this->cchunk["packagesynopsis"]["namespace"] . '\\';
1338+
}
1339+
$thisFqcn .= $this->cchunk["classsynopsis"]["classname"];
1340+
1341+
if ($class !== $thisFqcn) {
13281342
return $value;
13291343
}
1344+
13301345
return $method;
13311346
}
13321347

13331348
public function format_packagesynopsis($open, $name, $attrs, $props) {
1349+
$this->cchunk["packagesynopsis"] = $this->dchunk["packagesynopsis"];
13341350
if ($open) {
1335-
$this->cchunk["packagesynopsis"] = true;
1351+
$this->cchunk["packagesynopsis"]["open"] = true;
13361352
return '<div class="classsynopsis"><div class="classsynopsisinfo">';
13371353
}
1338-
$this->cchunk["packagesynopsis"] = false;
1354+
$this->cchunk["packagesynopsis"]["open"] = false;
13391355
return '</div>';
13401356
}
13411357

@@ -1346,8 +1362,16 @@ public function format_packagesynopsis_package($open, $name, $attrs, $props) {
13461362
return '</strong>;</div>';
13471363
}
13481364

1365+
public function format_packagesynopsis_package_text($value, $tag) {
1366+
if (!$this->cchunk["packagesynopsis"]["namespace"]) {
1367+
$this->cchunk["packagesynopsis"]["namespace"] = $value;
1368+
}
1369+
1370+
return $this->TEXT($value);
1371+
}
1372+
13491373
public function format_enumsynopsis($open, $name, $attrs, $props) {
1350-
$inPackageSynopsis = $this->cchunk["packagesynopsis"] ?? false;
1374+
$inPackageSynopsis = $this->cchunk["packagesynopsis"]["open"] ?? false;
13511375
if ($open) {
13521376
if ($inPackageSynopsis) {
13531377
return '<div class="classsynopsisinfo">';

0 commit comments

Comments
 (0)