En raison du déménagement des baies serveurs, les services gitlab.irstea.fr et mattermost.irstea.fr seront interrompus le samedi 2 octobre 2021 au matin. Ils devraient revenir à la normale dans la journée.

Commit 4644e09c authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

Correction des Namespaces Php.

parent 1d5a1de6
......@@ -8,9 +8,8 @@
namespace Irstea\PlantUmlBundle\Model\Namespace_\Php;
use Irstea\PlantUmlBundle\Model\Namespace_\AbstractNamespace as Base;
use Irstea\PlantUmlBundle\Model\NamespaceInterface;
use Irstea\PlantUmlBundle\Model\NodeInterface;
use Irstea\PlantUmlBundle\Writer\WritableInterface;
use Irstea\PlantUmlBundle\Writer\WriterInterface;
/**
......@@ -18,7 +17,7 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface;
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
abstract class AbstractNamespace extends AbstractNamespace
abstract class AbstractNamespace extends Base
{
/**
* @var NamespaceInterface
......@@ -50,15 +49,6 @@ abstract class AbstractNamespace extends AbstractNamespace
*/
abstract protected function getNamespacePrefix();
public function getNodeLabel($name)
{
$prefix = $this->getNamespacePrefix();
if (0 === strpos($name, $prefix)) {
return substr($name, strlen($prefix));
}
return $name;
}
public function getNodeId($name)
{
return str_replace('\\', '.', $name).'_node';
......
......@@ -9,7 +9,6 @@
namespace Irstea\PlantUmlBundle\Model\Namespace_\Php;
use Irstea\PlantUmlBundle\Model\ArrowInterface;
use Irstea\PlantUmlBundle\Model\NamespaceInterface;
use Irstea\PlantUmlBundle\Writer\WriterInterface;
/**
......@@ -17,7 +16,7 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface;
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
class Namespace_ extends AbstractHierachicalNamespace
class Namespace_ extends AbstractNamespace
{
/**
* @var AbstractNamespace
......@@ -29,7 +28,7 @@ class Namespace_ extends AbstractHierachicalNamespace
*/
private $name;
public function __construct(AbstractHierachicalNamespace $parent, $name)
public function __construct(AbstractNamespace $parent, $name)
{
$this->parent = $parent;
$this->name = $name;
......@@ -53,6 +52,15 @@ class Namespace_ extends AbstractHierachicalNamespace
return $this->parent->getNamespacePrefix() . $this->name . '\\';
}
public function getNodeLabel($name)
{
$prefix = $this->getNamespacePrefix();
if (0 === strpos($name, $prefix)) {
return substr($name, strlen($prefix));
}
return $name;
}
/**
* @param resource WriterInterface $writer
* @return self
......
......@@ -51,4 +51,9 @@ class RootNamespace extends AbstractNamespace
{
return "";
}
public function getNodeLabel($className)
{
return $className;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment