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

Correction des Namespaces Php.

parent 1d5a1de6
...@@ -8,9 +8,8 @@ ...@@ -8,9 +8,8 @@
namespace Irstea\PlantUmlBundle\Model\Namespace_\Php; namespace Irstea\PlantUmlBundle\Model\Namespace_\Php;
use Irstea\PlantUmlBundle\Model\Namespace_\AbstractNamespace as Base;
use Irstea\PlantUmlBundle\Model\NamespaceInterface; use Irstea\PlantUmlBundle\Model\NamespaceInterface;
use Irstea\PlantUmlBundle\Model\NodeInterface;
use Irstea\PlantUmlBundle\Writer\WritableInterface;
use Irstea\PlantUmlBundle\Writer\WriterInterface; use Irstea\PlantUmlBundle\Writer\WriterInterface;
/** /**
...@@ -18,7 +17,7 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface; ...@@ -18,7 +17,7 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface;
* *
* @author Guillaume Perréal <guillaume.perreal@irstea.fr> * @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/ */
abstract class AbstractNamespace extends AbstractNamespace abstract class AbstractNamespace extends Base
{ {
/** /**
* @var NamespaceInterface * @var NamespaceInterface
...@@ -50,15 +49,6 @@ abstract class AbstractNamespace extends AbstractNamespace ...@@ -50,15 +49,6 @@ abstract class AbstractNamespace extends AbstractNamespace
*/ */
abstract protected function getNamespacePrefix(); 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) public function getNodeId($name)
{ {
return str_replace('\\', '.', $name).'_node'; return str_replace('\\', '.', $name).'_node';
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
namespace Irstea\PlantUmlBundle\Model\Namespace_\Php; namespace Irstea\PlantUmlBundle\Model\Namespace_\Php;
use Irstea\PlantUmlBundle\Model\ArrowInterface; use Irstea\PlantUmlBundle\Model\ArrowInterface;
use Irstea\PlantUmlBundle\Model\NamespaceInterface;
use Irstea\PlantUmlBundle\Writer\WriterInterface; use Irstea\PlantUmlBundle\Writer\WriterInterface;
/** /**
...@@ -17,7 +16,7 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface; ...@@ -17,7 +16,7 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface;
* *
* @author Guillaume Perréal <guillaume.perreal@irstea.fr> * @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/ */
class Namespace_ extends AbstractHierachicalNamespace class Namespace_ extends AbstractNamespace
{ {
/** /**
* @var AbstractNamespace * @var AbstractNamespace
...@@ -29,7 +28,7 @@ class Namespace_ extends AbstractHierachicalNamespace ...@@ -29,7 +28,7 @@ class Namespace_ extends AbstractHierachicalNamespace
*/ */
private $name; private $name;
public function __construct(AbstractHierachicalNamespace $parent, $name) public function __construct(AbstractNamespace $parent, $name)
{ {
$this->parent = $parent; $this->parent = $parent;
$this->name = $name; $this->name = $name;
...@@ -53,6 +52,15 @@ class Namespace_ extends AbstractHierachicalNamespace ...@@ -53,6 +52,15 @@ class Namespace_ extends AbstractHierachicalNamespace
return $this->parent->getNamespacePrefix() . $this->name . '\\'; 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 * @param resource WriterInterface $writer
* @return self * @return self
......
...@@ -51,4 +51,9 @@ class RootNamespace extends AbstractNamespace ...@@ -51,4 +51,9 @@ class RootNamespace extends AbstractNamespace
{ {
return ""; 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