From 4644e09ced11fad88bfbae5f4e515ccaae7eda4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr> Date: Thu, 10 Mar 2016 17:05:21 +0100 Subject: [PATCH] Correction des Namespaces Php. --- ...EntitySchemaCommand.php => GenerateCommand.php} | 0 Model/Namespace_/Php/AbstractNamespace.php | 14 ++------------ Model/Namespace_/Php/Namespace_.php | 14 +++++++++++--- Model/Namespace_/Php/RootNamespace.php | 5 +++++ 4 files changed, 18 insertions(+), 15 deletions(-) rename Command/{EntitySchemaCommand.php => GenerateCommand.php} (100%) diff --git a/Command/EntitySchemaCommand.php b/Command/GenerateCommand.php similarity index 100% rename from Command/EntitySchemaCommand.php rename to Command/GenerateCommand.php diff --git a/Model/Namespace_/Php/AbstractNamespace.php b/Model/Namespace_/Php/AbstractNamespace.php index 2d591ee..d0ba86c 100644 --- a/Model/Namespace_/Php/AbstractNamespace.php +++ b/Model/Namespace_/Php/AbstractNamespace.php @@ -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'; diff --git a/Model/Namespace_/Php/Namespace_.php b/Model/Namespace_/Php/Namespace_.php index 8c6da0b..7fff4a5 100644 --- a/Model/Namespace_/Php/Namespace_.php +++ b/Model/Namespace_/Php/Namespace_.php @@ -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 diff --git a/Model/Namespace_/Php/RootNamespace.php b/Model/Namespace_/Php/RootNamespace.php index 90c5f1a..7b07b8b 100644 --- a/Model/Namespace_/Php/RootNamespace.php +++ b/Model/Namespace_/Php/RootNamespace.php @@ -51,4 +51,9 @@ class RootNamespace extends AbstractNamespace { return ""; } + + public function getNodeLabel($className) + { + return $className; + } } -- GitLab