diff --git a/src/collector/project/Project.php b/src/collector/project/Project.php index 2e15414b..24d80b9f 100644 --- a/src/collector/project/Project.php +++ b/src/collector/project/Project.php @@ -238,7 +238,7 @@ private function saveUnit(array $map, array $reportUnits, AbstractUnitObject $un ProjectException::UnitNotFoundInIndex ); } - $name = \str_replace('\\', '_', $unit->getName()); + $name = sha1($unit->getName()); $dom = $unit->export(); $dom->formatOutput = true; $dom->preserveWhiteSpace = false; diff --git a/src/generator/engine/html/Html.php b/src/generator/engine/html/Html.php index 048e61e8..b558a3c6 100644 --- a/src/generator/engine/html/Html.php +++ b/src/generator/engine/html/Html.php @@ -194,6 +194,8 @@ protected function getXSLTProcessor($template) { $xsl->setParameter('', 'project', $this->projectNode->getAttribute('name')); } + $xsl->registerPHPFunctions('sha1'); + return $xsl; } @@ -256,7 +258,7 @@ private function genericMethodBuild(fDOMDocument $ctx, $target, $unitName, $meth } private function classNameToFileName($class, $method = null) { - $name = \str_replace('\\', '_', $class); + $name = sha1($class); if ($method !== null) { $name .= '/' . $method; diff --git a/src/generator/engine/xml/Xml.php b/src/generator/engine/xml/Xml.php index 7e2227ef..b3a1c061 100644 --- a/src/generator/engine/xml/Xml.php +++ b/src/generator/engine/xml/Xml.php @@ -45,9 +45,10 @@ public function handle(AbstractEvent $event): void { } } $dom = $ctx->asDom(); + $fname = sha1($dom->documentElement->getAttribute('full')); $this->saveDomDocument( $dom, - $this->outputDir . '/' . $path . '/' . \str_replace('\\', '_', $dom->documentElement->getAttribute('full')) . '.xml' + $this->outputDir . '/' . $path . '/' . $fname . '.xml' ); } diff --git a/templates/html/functions.xsl b/templates/html/functions.xsl index 3e9088e0..736ef10c 100644 --- a/templates/html/functions.xsl +++ b/templates/html/functions.xsl @@ -7,8 +7,9 @@ xmlns:idx="http://xml.phpdox.net/src" xmlns:git="http://xml.phpdox.net/gitlog" xmlns:ctx="ctx://engine/html" + xmlns:php="http://php.net/xsl" extension-element-prefixes="func" - exclude-result-prefixes="idx pdx pdxf pu git ctx"> + exclude-result-prefixes="idx pdx pdxf pu git ctx php"> @@ -39,7 +40,7 @@ + select="concat($base, $dir, '/', php:function('sha1', concat('', $ctx/@full)), $withMethod, '.', $extension)"/> diff --git a/templates/html/units.xsl b/templates/html/units.xsl index 60031af0..a8cf6436 100644 --- a/templates/html/units.xsl +++ b/templates/html/units.xsl @@ -7,8 +7,9 @@ xmlns:idx="http://xml.phpdox.net/src" xmlns:git="http://xml.phpdox.net/gitlog" xmlns:ctx="ctx://engine/html" + xmlns:php="http://php.net/xsl" extension-element-prefixes="func" - exclude-result-prefixes="idx pdx pdxf pu git ctx"> + exclude-result-prefixes="idx pdx pdxf pu git ctx php"> @@ -49,11 +50,15 @@ + + + + classes interfaces traits - /_. + /. diff --git a/tests/data/issue351/src/Lorem/ipsum/dolor/sit/amet/consectetur/adipiscing/elit/Phasellus/aliquet/lacus/vel/lectus/vehicula/facilisis/quis/eu/ex/Duis/dignissim/test.php b/tests/data/issue351/src/Lorem/ipsum/dolor/sit/amet/consectetur/adipiscing/elit/Phasellus/aliquet/lacus/vel/lectus/vehicula/facilisis/quis/eu/ex/Duis/dignissim/test.php new file mode 100644 index 00000000..b3dfb29d --- /dev/null +++ b/tests/data/issue351/src/Lorem/ipsum/dolor/sit/amet/consectetur/adipiscing/elit/Phasellus/aliquet/lacus/vel/lectus/vehicula/facilisis/quis/eu/ex/Duis/dignissim/test.php @@ -0,0 +1,13 @@ + + + + + + + + + + + + + + +