Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pôle IS
Bundles Symfony 2
plantuml-bundle
Commits
b8bcadb6
Commit
b8bcadb6
authored
Mar 09, 2016
by
Guillaume Perréal
Browse files
Refactoring: Uml*Interface => Writable*Interface.
parent
85f81393
Changes
16
Hide whitespace changes
Inline
Side-by-side
Model/AbstractNamespace.php
View file @
b8bcadb6
...
...
@@ -8,6 +8,7 @@
namespace
Irstea\PlantUmlBundle\Model
;
use
Irstea\PlantUmlBundle\Writer\WritableInterface
;
use
Irstea\PlantUmlBundle\Writer\WriterInterface
;
/**
...
...
@@ -15,10 +16,10 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface;
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
abstract
class
AbstractNamespace
implements
UmlComponent
Interface
,
NamespaceInterface
abstract
class
AbstractNamespace
implements
Writable
Interface
,
NamespaceInterface
{
/**
* @var
Uml
NodeInterface[]
* @var NodeInterface[]
*/
private
$nodes
=
[];
...
...
@@ -29,9 +30,9 @@ abstract class AbstractNamespace implements UmlComponentInterface, NamespaceInte
/**
*
* @param
Uml
NodeInterface $node
* @param NodeInterface $node
*/
public
function
addNode
(
Uml
NodeInterface
$node
)
public
function
addNode
(
NodeInterface
$node
)
{
$this
->
nodes
[]
=
$node
;
return
$this
;
...
...
Model/Arrow/BaseArrow.php
View file @
b8bcadb6
...
...
@@ -8,8 +8,8 @@
namespace
Irstea\PlantUmlBundle\Model\Arrow
;
use
Irstea\PlantUmlBundle\Model\
Uml
ArrowInterface
;
use
Irstea\PlantUmlBundle\Model\
Uml
NodeInterface
;
use
Irstea\PlantUmlBundle\Model\ArrowInterface
;
use
Irstea\PlantUmlBundle\Model\NodeInterface
;
use
Irstea\PlantUmlBundle\Writer\WriterInterface
;
/**
...
...
@@ -17,15 +17,15 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface;
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
class
BaseArrow
implements
Uml
ArrowInterface
class
BaseArrow
implements
ArrowInterface
{
/**
* @var
Uml
NodeInterface
* @var NodeInterface
*/
private
$source
;
/**
* @var
Uml
NodeInterface
* @var NodeInterface
*/
private
$target
;
...
...
@@ -34,7 +34,7 @@ class BaseArrow implements UmlArrowInterface
*/
private
$link
;
public
function
__construct
(
Uml
NodeInterface
$source
,
Uml
NodeInterface
$target
,
$link
=
"--"
,
$label
=
null
)
public
function
__construct
(
NodeInterface
$source
,
NodeInterface
$target
,
$link
=
"--"
,
$label
=
null
)
{
$this
->
source
=
$source
;
$this
->
target
=
$target
;
...
...
Model/Arrow/ExtendsClass.php
View file @
b8bcadb6
...
...
@@ -8,7 +8,7 @@
namespace
Irstea\PlantUmlBundle\Model\Arrow
;
use
Irstea\PlantUmlBundle\
Model\Uml
NodeInterface
;
use
Irstea\PlantUmlBundle\
Writer\Writable
NodeInterface
;
/**
* Description of ExtendsClass
...
...
@@ -17,7 +17,7 @@ use Irstea\PlantUmlBundle\Model\UmlNodeInterface;
*/
class
ExtendsClass
extends
BaseArrow
{
public
function
__construct
(
Uml
NodeInterface
$source
,
Uml
NodeInterface
$target
)
public
function
__construct
(
Writable
NodeInterface
$source
,
Writable
NodeInterface
$target
)
{
parent
::
__construct
(
$target
,
$source
,
"<|--"
);
}
...
...
Model/Arrow/ImplementsInterface.php
View file @
b8bcadb6
...
...
@@ -9,7 +9,7 @@
namespace
Irstea\PlantUmlBundle\Model\Arrow
;
use
Irstea\PlantUmlBundle\Model\Node\Interface_
;
use
Irstea\PlantUmlBundle\
Model\Uml
NodeInterface
;
use
Irstea\PlantUmlBundle\
Writer\Writable
NodeInterface
;
/**
* Description of ImplementsInterface
...
...
@@ -18,7 +18,7 @@ use Irstea\PlantUmlBundle\Model\UmlNodeInterface;
*/
class
ImplementsInterface
extends
BaseArrow
{
public
function
__construct
(
Uml
NodeInterface
$source
,
Interface_
$target
)
public
function
__construct
(
Writable
NodeInterface
$source
,
Interface_
$target
)
{
parent
::
__construct
(
$target
,
$source
,
"<|.."
);
}
...
...
Model/Arrow/UsesTrait.php
View file @
b8bcadb6
...
...
@@ -9,7 +9,7 @@
namespace
Irstea\PlantUmlBundle\Model\Arrow
;
use
Irstea\PlantUmlBundle\Model\Node\Trait_
;
use
Irstea\PlantUmlBundle\
Model\Uml
NodeInterface
;
use
Irstea\PlantUmlBundle\
Writer\Writable
NodeInterface
;
/**
* Description of UseTrait
...
...
@@ -18,7 +18,7 @@ use Irstea\PlantUmlBundle\Model\UmlNodeInterface;
*/
class
UsesTrait
extends
BaseArrow
{
public
function
__construct
(
Uml
NodeInterface
$source
,
Trait_
$trait
)
public
function
__construct
(
Writable
NodeInterface
$source
,
Trait_
$trait
)
{
parent
::
__construct
(
$trait
,
$source
,
"<|--"
);
}
...
...
Model/ArrowInterface.php
0 → 100644
View file @
b8bcadb6
<?php
/*
* © 2016 IRSTEA
* Guillaume Perréal <guillaume.perreal@irstea.fr>
* Tous droits réservés.
*/
namespace
Irstea\PlantUmlBundle\Model
;
use
Irstea\PlantUmlBundle\Writer\WritableArrowInterface
;
/**
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
interface
ArrowInterface
extends
WritableArrowInterface
{
//put your code here
}
Model/ClassVisitor.php
View file @
b8bcadb6
...
...
@@ -11,6 +11,8 @@ namespace Irstea\PlantUmlBundle\Model;
use
Irstea\PlantUmlBundle\Model\Node\Class_
;
use
Irstea\PlantUmlBundle\Model\Node\Interface_
;
use
Irstea\PlantUmlBundle\Model\Node\Trait_
;
use
Irstea\PlantUmlBundle\Writer\WritableInterface
;
use
Irstea\PlantUmlBundle\Writer\WritableNodeInterface
;
use
Irstea\PlantUmlBundle\Writer\WriterInterface
;
use
ReflectionClass
;
...
...
@@ -19,7 +21,7 @@ use ReflectionClass;
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
class
ClassVisitor
implements
ClassVisitorInterface
,
UmlComponent
Interface
class
ClassVisitor
implements
ClassVisitorInterface
,
Writable
Interface
{
/**
* @var RootNamespace
...
...
@@ -44,7 +46,7 @@ class ClassVisitor implements ClassVisitorInterface, UmlComponentInterface
/**
*
* @param string $className
* @return
Uml
NodeInterface
* @return NodeInterface
*/
protected
function
doVisitClass
(
$className
)
{
...
...
@@ -54,7 +56,7 @@ class ClassVisitor implements ClassVisitorInterface, UmlComponentInterface
/**
* @param ReflectionClass $class
* @return
Uml
NodeInterface
* @return NodeInterface
*/
protected
function
visitClassReflection
(
ReflectionClass
$class
)
{
...
...
@@ -98,7 +100,7 @@ class ClassVisitor implements ClassVisitorInterface, UmlComponentInterface
return
$node
;
}
protected
function
visitRelations
(
Uml
NodeInterface
$source
,
NamespaceInterface
$namespace
,
array
$classNames
,
$relationClass
)
protected
function
visitRelations
(
Writable
NodeInterface
$source
,
NamespaceInterface
$namespace
,
array
$classNames
,
$relationClass
)
{
foreach
(
$classNames
as
$className
)
{
$target
=
$this
->
visitClass
(
$className
);
...
...
Model/ClassVisitorInterface.php
View file @
b8bcadb6
...
...
@@ -15,7 +15,7 @@ namespace Irstea\PlantUmlBundle\Model;
interface
ClassVisitorInterface
{
/**
* @return
Uml
NodeInterface
* @return NodeInterface
*/
public
function
visitClass
(
$className
);
}
Model/NamespaceInterface.php
View file @
b8bcadb6
...
...
@@ -8,11 +8,13 @@
namespace
Irstea\PlantUmlBundle\Model
;
use
Irstea\PlantUmlBundle\Writer\WritableInterface
;
/**
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
interface
NamespaceInterface
interface
NamespaceInterface
extends
WritableInterface
{
/**
* @param string $namespaceName
...
...
@@ -21,14 +23,14 @@ interface NamespaceInterface
public
function
getNamespace
(
$namespaceName
);
/**
* @param
Uml
NodeInterface $node
* @param NodeInterface $node
* @return self
*/
public
function
addNode
(
Uml
NodeInterface
$node
);
public
function
addNode
(
NodeInterface
$node
);
/**
* @param
Uml
ArrowInterface $arrow
* @param ArrowInterface $arrow
* @return self
*/
public
function
addArrow
(
Uml
ArrowInterface
$arrow
);
public
function
addArrow
(
ArrowInterface
$arrow
);
}
Model/Namespace_.php
View file @
b8bcadb6
...
...
@@ -34,10 +34,10 @@ class Namespace_ extends AbstractNamespace
}
/**
* @param
Uml
ArrowInterface $arrow
* @param ArrowInterface $arrow
* @return self
*/
public
function
addArrow
(
Uml
ArrowInterface
$arrow
)
public
function
addArrow
(
ArrowInterface
$arrow
)
{
$this
->
parent
->
addArrow
(
$arrow
);
return
$this
;
...
...
Model/Node/BaseNode.php
View file @
b8bcadb6
...
...
@@ -8,7 +8,7 @@
namespace
Irstea\PlantUmlBundle\Model\Node
;
use
Irstea\PlantUmlBundle\Model\
Uml
NodeInterface
;
use
Irstea\PlantUmlBundle\Model\NodeInterface
;
use
Irstea\PlantUmlBundle\Writer\WriterInterface
;
/**
...
...
@@ -16,7 +16,7 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface;
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
class
BaseNode
implements
Uml
NodeInterface
class
BaseNode
implements
NodeInterface
{
/**
* @var string
...
...
@@ -123,12 +123,4 @@ class BaseNode implements UmlNodeInterface
{
return
$this
;
}
static
public
function
compare
(
BaseNode
$a
,
BaseNode
$b
)
{
if
(
$a
->
ordering
===
$b
->
ordering
)
{
return
strcmp
(
$a
->
name
,
$b
->
name
);
}
return
$a
->
ordering
-
$b
->
ordering
;
}
}
Model/NodeInterface.php
0 → 100644
View file @
b8bcadb6
<?php
/*
* © 2016 IRSTEA
* Guillaume Perréal <guillaume.perreal@irstea.fr>
* Tous droits réservés.
*/
namespace
Irstea\PlantUmlBundle\Model
;
use
Irstea\PlantUmlBundle\Writer\WritableNodeInterface
;
/**
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
interface
NodeInterface
extends
WritableNodeInterface
{
//put your code here
}
Model/RootNamespace.php
View file @
b8bcadb6
...
...
@@ -8,6 +8,8 @@
namespace
Irstea\PlantUmlBundle\Model
;
use
Irstea\PlantUmlBundle\Writer\WriterInterface
;
/**
* Description of RootNamespace
*
...
...
@@ -16,17 +18,17 @@ namespace Irstea\PlantUmlBundle\Model;
class
RootNamespace
extends
AbstractNamespace
{
/**
* @var
Uml
ArrowInterface[]
* @var ArrowInterface[]
*/
private
$arrows
=
[];
public
function
addArrow
(
Uml
ArrowInterface
$arrow
)
public
function
addArrow
(
ArrowInterface
$arrow
)
{
$this
->
arrows
[]
=
$arrow
;
return
$this
;
}
public
function
outputTo
(
\
Irstea\PlantUmlBundle\Writer\
WriterInterface
$writer
)
public
function
outputTo
(
WriterInterface
$writer
)
{
$this
->
outputNodesTo
(
$writer
)
...
...
@@ -35,7 +37,7 @@ class RootNamespace extends AbstractNamespace
return
$this
;
}
protected
function
outputArrowsTo
(
\
Irstea\PlantUmlBundle\Writer\
WriterInterface
$writer
)
protected
function
outputArrowsTo
(
WriterInterface
$writer
)
{
foreach
(
$this
->
arrows
as
$arrow
)
{
$arrow
->
outputTo
(
$writer
);
...
...
Model/Uml
ArrowInterface.php
→
Writer/Writable
ArrowInterface.php
View file @
b8bcadb6
...
...
@@ -6,12 +6,12 @@
* Tous droits réservés.
*/
namespace
Irstea\PlantUmlBundle\
Model
;
namespace
Irstea\PlantUmlBundle\
Writer
;
/**
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
interface
Uml
ArrowInterface
extends
UmlComponent
Interface
interface
Writable
ArrowInterface
extends
Writable
Interface
{
}
Model/UmlComponent
Interface.php
→
Writer/Writable
Interface.php
View file @
b8bcadb6
...
...
@@ -6,7 +6,7 @@
* Tous droits réservés.
*/
namespace
Irstea\PlantUmlBundle\
Model
;
namespace
Irstea\PlantUmlBundle\
Writer
;
use
Irstea\PlantUmlBundle\Writer\WriterInterface
;
...
...
@@ -14,7 +14,7 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface;
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
interface
UmlComponent
Interface
interface
Writable
Interface
{
/**
* @param WriterInterface $writer
...
...
Model/Uml
NodeInterface.php
→
Writer/Writable
NodeInterface.php
View file @
b8bcadb6
...
...
@@ -6,7 +6,7 @@
* Tous droits réservés.
*/
namespace
Irstea\PlantUmlBundle\
Model
;
namespace
Irstea\PlantUmlBundle\
Writer
;
use
Irstea\PlantUmlBundle\Writer\WriterInterface
;
...
...
@@ -14,7 +14,7 @@ use Irstea\PlantUmlBundle\Writer\WriterInterface;
*
* @author Guillaume Perréal <guillaume.perreal@irstea.fr>
*/
interface
Uml
NodeInterface
extends
UmlComponent
Interface
interface
Writable
NodeInterface
extends
Writable
Interface
{
/**
* @param WriterInterface $writer
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment