Updated uml diagrams for structural patterns

This commit is contained in:
John Webb
2014-07-31 13:27:12 -05:00
parent 6dd33fd433
commit d42043c36c
39 changed files with 3731 additions and 219 deletions

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>PHP</ID>
<OriginalElement>\DesignPatterns\Structural\Adapter\Book</OriginalElement>
<nodes>
<node x="0.0" y="117.0">\DesignPatterns\Structural\Adapter\EBookAdapter</node>
<node x="173.0" y="138.0">\DesignPatterns\Structural\Adapter\Book</node>
<node x="-8.0" y="388.0">\DesignPatterns\Structural\Adapter\Kindle</node>
<node x="-8.0" y="271.0">\DesignPatterns\Structural\Adapter\EBookInterface</node>
<node x="85.75" y="0.0">\DesignPatterns\Structural\Adapter\PaperBookInterface</node>
</nodes>
<notes />
<edges>
<edge source="\DesignPatterns\Structural\Adapter\EBookAdapter" target="\DesignPatterns\Structural\Adapter\PaperBookInterface">
<point x="0.0" y="-54.5" />
<point x="80.5" y="92.0" />
<point x="125.75" y="92.0" />
<point x="-32.0" y="33.5" />
</edge>
<edge source="\DesignPatterns\Structural\Adapter\Book" target="\DesignPatterns\Structural\Adapter\PaperBookInterface">
<point x="0.0" y="-33.5" />
<point x="235.0" y="92.0" />
<point x="189.75" y="92.0" />
<point x="32.0" y="33.5" />
</edge>
<edge source="\DesignPatterns\Structural\Adapter\Kindle" target="\DesignPatterns\Structural\Adapter\EBookInterface">
<point x="0.0" y="-33.5" />
<point x="0.0" y="33.5" />
</edge>
</edges>
<settings layout="Hierarchic Group" zoom="0.8126315789473684" x="144.5" y="227.50000000000003" />
<SelectedNodes />
<Categories>
<Category>Fields</Category>
<Category>Constants</Category>
<Category>Constructors</Category>
<Category>Methods</Category>
</Categories>
<VISIBILITY>private</VISIBILITY>
</Diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 13 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -1,33 +0,0 @@
@startuml
interface PaperBookInterface {
+turnPage()
+open()
}
interface EBookInterface {
+pressNext()
+pressStart()
}
class Book {
+open()
+turnPage()
}
class Kindle {
+pressNext()
+pressStart()
}
class EBookAdapter {
#eBook : EBookInterface
+__construct(ebook : EBookInterface)
+open()
+turnPage()
}
PaperBookInterface <|.. Book
PaperBookInterface <|.. EBookAdapter
EBookInterface <|.. Kindle
EBookAdapter o-- EBookInterface
@enduml

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>PHP</ID>
<OriginalElement>\DesignPatterns\Structural\Bridge\Vehicle</OriginalElement>
<nodes>
<node x="53.5" y="272.0">\DesignPatterns\Structural\Bridge\Workshop</node>
<node x="290.0" y="159.0">\DesignPatterns\Structural\Bridge\Car</node>
<node x="107.0" y="369.0">\DesignPatterns\Structural\Bridge\Produce</node>
<node x="0.0" y="159.0">\DesignPatterns\Structural\Bridge\Motorcycle</node>
<node x="0.0" y="369.0">\DesignPatterns\Structural\Bridge\Assemble</node>
<node x="187.5" y="0.0">\DesignPatterns\Structural\Bridge\Vehicle</node>
</nodes>
<notes />
<edges>
<edge source="\DesignPatterns\Structural\Bridge\Car" target="\DesignPatterns\Structural\Bridge\Vehicle">
<point x="0.0" y="-34.0" />
<point x="425.0" y="134.0" />
<point x="326.25" y="134.0" />
<point x="46.25" y="54.5" />
</edge>
<edge source="\DesignPatterns\Structural\Bridge\Assemble" target="\DesignPatterns\Structural\Bridge\Workshop">
<point x="0.0" y="-23.5" />
<point x="43.5" y="344.0" />
<point x="75.25" y="344.0" />
<point x="-21.75" y="23.5" />
</edge>
<edge source="\DesignPatterns\Structural\Bridge\Motorcycle" target="\DesignPatterns\Structural\Bridge\Vehicle">
<point x="0.0" y="-34.0" />
<point x="135.0" y="134.0" />
<point x="233.75" y="134.0" />
<point x="-46.25" y="54.5" />
</edge>
<edge source="\DesignPatterns\Structural\Bridge\Produce" target="\DesignPatterns\Structural\Bridge\Workshop">
<point x="0.0" y="-23.5" />
<point x="150.5" y="344.0" />
<point x="118.75" y="344.0" />
<point x="21.75" y="23.5" />
</edge>
</edges>
<settings layout="Hierarchic Group" zoom="0.8853211009174312" x="280.0" y="208.0" />
<SelectedNodes />
<Categories>
<Category>Fields</Category>
<Category>Constants</Category>
<Category>Constructors</Category>
<Category>Methods</Category>
</Categories>
<VISIBILITY>private</VISIBILITY>
</Diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 16 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View File

@@ -1,35 +0,0 @@
@startuml
class Assemble {
+work()
}
class Car {
+__construct(Workshop $workShop1, Workshop $workShop2)
+manufacture()
}
class Motorcycle {
+__construct(Workshop $workShop1, Workshop $workShop2)
+manufacture()
}
class Produce {
+work()
}
abstract class Vehicle {
#workShop1
#workShop2
#__construct()
+manufacture()
}
interface Workshop {
+work()
}
Workshop <|.. Assemble
Workshop <|.. Produce
Vehicle <|.. Motorcycle
Vehicle <|.. Car
@enduml

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>PHP</ID>
<OriginalElement>\DesignPatterns\Structural\Composite\InputElement</OriginalElement>
<nodes>
<node x="321.0" y="117.5">\DesignPatterns\Structural\Composite\TextElement</node>
<node x="175.0" y="0.0">\DesignPatterns\Structural\Composite\FormElement</node>
<node x="175.0" y="117.5">\DesignPatterns\Structural\Composite\InputElement</node>
<node x="0.0" y="97.0">\DesignPatterns\Structural\Composite\Form</node>
</nodes>
<notes />
<edges>
<edge source="\DesignPatterns\Structural\Composite\InputElement" target="\DesignPatterns\Structural\Composite\FormElement">
<point x="0.0" y="-23.5" />
<point x="0.0" y="23.5" />
</edge>
<edge source="\DesignPatterns\Structural\Composite\Form" target="\DesignPatterns\Structural\Composite\FormElement">
<point x="0.0" y="-44.0" />
<point x="77.5" y="72.0" />
<point x="196.0" y="72.0" />
<point x="-42.0" y="23.5" />
</edge>
<edge source="\DesignPatterns\Structural\Composite\TextElement" target="\DesignPatterns\Structural\Composite\FormElement">
<point x="0.0" y="-23.5" />
<point x="384.0" y="72.0" />
<point x="280.0" y="72.0" />
<point x="42.0" y="23.5" />
</edge>
</edges>
<settings layout="Hierarchic Group" zoom="1.0" x="223.5" y="92.5" />
<SelectedNodes>
<node>\DesignPatterns\Structural\Composite\InputElement</node>
</SelectedNodes>
<Categories>
<Category>Fields</Category>
<Category>Constants</Category>
<Category>Constructors</Category>
<Category>Methods</Category>
</Categories>
<VISIBILITY>private</VISIBILITY>
</Diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>PHP</ID>
<OriginalElement>\DesignPatterns\Structural\DataMapper\User</OriginalElement>
<nodes>
<node x="0.0" y="0.0">\DesignPatterns\Structural\DataMapper\User</node>
<node x="0.0" y="274.0">\DesignPatterns\Structural\DataMapper\UserMapper</node>
</nodes>
<notes />
<edges />
<settings layout="Hierarchic Group" zoom="0.871331828442438" x="141.5" y="211.5" />
<SelectedNodes>
<node>\DesignPatterns\Structural\DataMapper\User</node>
</SelectedNodes>
<Categories>
<Category>Fields</Category>
<Category>Constants</Category>
<Category>Constructors</Category>
<Category>Methods</Category>
</Categories>
<VISIBILITY>private</VISIBILITY>
</Diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -1,24 +0,0 @@
@startuml
class User {
#$userId : int
#$username : string
#$email : string
+__construct($id = null : int, $username = null : string, $email = null : string)
+getUserId()
+setUserID($userId : int)
+getUsername()
+setUsername($username : string)
+getEmail()
+setEmail($email : string)
}
class UserMapper {
#$adapter : DBAL
+__construct(DBAL $dbLayer)
+save(User $user)
+findById($id : int)
+findAll()
#mapObject(array $row)
}
@enduml

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>PHP</ID>
<OriginalElement>\DesignPatterns\Structural\Decorator\RenderInXml</OriginalElement>
<nodes>
<node x="139.0" y="236.0">\DesignPatterns\Structural\Decorator\RenderInJson</node>
<node x="0.0" y="236.0">\DesignPatterns\Structural\Decorator\RenderInXml</node>
<node x="216.0" y="97.0">\DesignPatterns\Structural\Decorator\Webservice</node>
<node x="62.0" y="107.5">\DesignPatterns\Structural\Decorator\Decorator</node>
<node x="145.0" y="0.0">\DesignPatterns\Structural\Decorator\RendererInterface</node>
</nodes>
<notes />
<edges>
<edge source="\DesignPatterns\Structural\Decorator\RenderInJson" target="\DesignPatterns\Structural\Decorator\Decorator">
<point x="0.0" y="-23.5" />
<point x="198.5" y="211.0" />
<point x="162.5" y="211.0" />
<point x="33.500000000000014" y="34.0" />
</edge>
<edge source="\DesignPatterns\Structural\Decorator\RenderInXml" target="\DesignPatterns\Structural\Decorator\Decorator">
<point x="0.0" y="-23.5" />
<point x="59.5" y="211.0" />
<point x="95.5" y="211.0" />
<point x="-33.5" y="34.0" />
</edge>
<edge source="\DesignPatterns\Structural\Decorator\Webservice" target="\DesignPatterns\Structural\Decorator\RendererInterface">
<point x="0.0" y="-44.5" />
<point x="283.0" y="72.0" />
<point x="236.5" y="72.0" />
<point x="30.5" y="23.5" />
</edge>
<edge source="\DesignPatterns\Structural\Decorator\Decorator" target="\DesignPatterns\Structural\Decorator\RendererInterface">
<point x="1.4210854715202004E-14" y="-34.0" />
<point x="129.0" y="72.0" />
<point x="175.5" y="72.0" />
<point x="-30.5" y="23.5" />
</edge>
</edges>
<settings layout="Hierarchic Group" zoom="1.0" x="175.0" y="141.5" />
<SelectedNodes>
<node>\DesignPatterns\Structural\Decorator\RenderInXml</node>
</SelectedNodes>
<Categories>
<Category>Fields</Category>
<Category>Constants</Category>
<Category>Constructors</Category>
<Category>Methods</Category>
</Categories>
<VISIBILITY>private</VISIBILITY>
</Diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@@ -1,29 +0,0 @@
@startuml
interface RendererInterface {
+renderData()
}
abstract class Decorator {
#$wrapped : RendererInterface
+__construct(RendererInterface $wrappable)
}
class RenderInJson {
+renderData()
}
class RenderInXml {
+renderData()
}
class Webservice {
#$data : mixed
+__construct($data)
+renderData()
}
Decorator <|.. RenderInJson
Decorator <|.. RenderInXml
RendererInterface <|.. Decorator
RendererInterface <|.. Webservice
@enduml

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>PHP</ID>
<OriginalElement>\DesignPatterns\Structural\DependencyInjection\AbstractConfig</OriginalElement>
<nodes>
<node x="0.0" y="230.0">\DesignPatterns\Structural\DependencyInjection\Connection</node>
<node x="51.0" y="118.0">\DesignPatterns\Structural\DependencyInjection\ArrayConfig</node>
<node x="0.0" y="0.5">\DesignPatterns\Structural\DependencyInjection\Parameters</node>
<node x="137.0" y="0.0">\DesignPatterns\Structural\DependencyInjection\AbstractConfig</node>
</nodes>
<notes />
<edges>
<edge source="\DesignPatterns\Structural\DependencyInjection\ArrayConfig" target="\DesignPatterns\Structural\DependencyInjection\AbstractConfig">
<point x="39.5" y="-33.5" />
<point x="169.5" y="93.0" />
<point x="201.5" y="93.0" />
<point x="0.0" y="34.0" />
</edge>
<edge source="\DesignPatterns\Structural\DependencyInjection\ArrayConfig" target="\DesignPatterns\Structural\DependencyInjection\Parameters">
<point x="-39.5" y="-33.5" />
<point x="90.5" y="93.0" />
<point x="58.5" y="93.0" />
<point x="0.0" y="33.5" />
</edge>
</edges>
<settings layout="Hierarchic Group" zoom="1.0" x="133.0" y="179.5" />
<SelectedNodes>
<node>\DesignPatterns\Structural\DependencyInjection\AbstractConfig</node>
</SelectedNodes>
<Categories>
<Category>Fields</Category>
<Category>Constants</Category>
<Category>Constructors</Category>
<Category>Methods</Category>
</Categories>
<VISIBILITY>private</VISIBILITY>
</Diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

@@ -1,28 +0,0 @@
@startuml
abstract class AbstractConfig {
#$storage
+__construct($storage)
}
class ArrayConfig {
+get($key : string|int, $default = null)
+set($key : string|int, $value : mixed)
}
class Connection {
#$configuration : Parameters
#$host
+__construct(Parameters $config)
+connect()
+getHost()
}
interface Parameters {
+get($key : string|int)
+set($key, $value : mixed)
}
AbstractConfig <|.. ArrayConfig
Parameters <|.. ArrayConfig
@enduml

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>PHP</ID>
<OriginalElement>\DesignPatterns\Structural\Facade\BiosInterface</OriginalElement>
<nodes>
<node x="0.0" y="174.0">\DesignPatterns\Structural\Facade\BiosInterface</node>
<node x="208.0" y="174.0">\DesignPatterns\Structural\Facade\OsInterface</node>
<node x="0.0" y="0.0">\DesignPatterns\Structural\Facade\Facade</node>
</nodes>
<notes />
<edges />
<settings layout="Hierarchic Group" zoom="1.0" x="149.0" y="140.5" />
<SelectedNodes>
<node>\DesignPatterns\Structural\Facade\BiosInterface</node>
</SelectedNodes>
<Categories>
<Category>Fields</Category>
<Category>Constants</Category>
<Category>Constructors</Category>
<Category>Methods</Category>
</Categories>
<VISIBILITY>private</VISIBILITY>
</Diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -1,20 +0,0 @@
@startuml
interface BiosInterface {
+execute()
+waitForKeyPress()
+launch(OsInterface $os)
+powerDown()
}
class Facade {
#$os : OsInterface
#$bios : BiosInterface
+__construct(BiosInterface $bios, OsInterface $os)
+turnOn()
+turnOff()
}
interface OsInterface {
+halt()
}
@enduml

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>PHP</ID>
<OriginalElement>\DesignPatterns\Structural\FluentInterface\Sql</OriginalElement>
<nodes>
<node x="0.0" y="0.0">\DesignPatterns\Structural\FluentInterface\Sql</node>
</nodes>
<notes />
<edges />
<settings layout="Hierarchic Group" zoom="1.0" x="108.5" y="84.0" />
<SelectedNodes>
<node>\DesignPatterns\Structural\FluentInterface\Sql</node>
</SelectedNodes>
<Categories>
<Category>Fields</Category>
<Category>Constants</Category>
<Category>Constructors</Category>
<Category>Methods</Category>
</Categories>
<VISIBILITY>private</VISIBILITY>
</Diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -1,13 +0,0 @@
@startuml
class Sql {
#$fields : array
#$from : array
#$where : array
+select(array $fields = array())
+from($table : string, $alias : string)
+where($condition : string)
+getQuery()
}
@enduml

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>PHP</ID>
<OriginalElement>\DesignPatterns\Structural\Proxy\Record</OriginalElement>
<nodes>
<node x="4.0" y="0.0">\DesignPatterns\Structural\Proxy\Record</node>
<node x="0.0" y="159.0">\DesignPatterns\Structural\Proxy\RecordProxy</node>
</nodes>
<notes />
<edges>
<edge source="\DesignPatterns\Structural\Proxy\RecordProxy" target="\DesignPatterns\Structural\Proxy\Record">
<point x="0.0" y="-54.5" />
<point x="0.0" y="54.5" />
</edge>
</edges>
<settings layout="Hierarchic Group" zoom="1.0" x="81.0" y="134.0" />
<SelectedNodes>
<node>\DesignPatterns\Structural\Proxy\Record</node>
</SelectedNodes>
<Categories>
<Category>Fields</Category>
<Category>Constants</Category>
<Category>Constructors</Category>
<Category>Methods</Category>
</Categories>
<VISIBILITY>private</VISIBILITY>
</Diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

@@ -1,18 +0,0 @@
@startuml
class Record {
#$data : array|null
+__construct($data = null)
+__set($name : string, $value : mixed)
+__get($name : string)
}
class RecordProxy {
#$isDirty : bool
#$isInitialized : bool
+__construct(data : array)
+__set($name : string, $value : mixed)
}
Record <|.. RecordProxy
@enduml

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<Diagram>
<ID>PHP</ID>
<OriginalElement>\DesignPatterns\Structural\Registry\Registry</OriginalElement>
<nodes>
<node x="0.0" y="0.0">\DesignPatterns\Structural\Registry\Registry</node>
</nodes>
<notes />
<edges />
<settings layout="Hierarchic Group" zoom="1.0" x="97.0" y="54.5" />
<SelectedNodes>
<node>\DesignPatterns\Structural\Registry\Registry</node>
</SelectedNodes>
<Categories>
<Category>Fields</Category>
<Category>Constants</Category>
<Category>Constructors</Category>
<Category>Methods</Category>
</Categories>
<VISIBILITY>private</VISIBILITY>
</Diagram>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -1,9 +0,0 @@
@startuml
abstract class Registry {
#static $storedValues : array;
+static function set($key : string, $value : mixed)
+static function get($key : string)
}
@enduml