
Public Member Functions | |
| setXml ($strXml) | |
| getXml () | |
| setUmlSequenceDiagram (UmlSequenceDiagram $objUmlSequenceDiagram) | |
| getUmlSequenceDiagram () | |
| perform () | |
Static Public Member Functions | |
| static | getInstance () |
Protected Member Functions | |
| loadActors () | |
| loadMessages () | |
Protected Attributes | |
| $objUmlSequenceDiagram | |
| $objXml | |
Static Protected Attributes | |
| static | $objInstance |
Definition at line 11 of file UmlSequenceDiagramFactoryFromXml.class.php.
| static getInstance | ( | ) | [static] |
Return the singleton of the UmlSequenceDiagramFactoryFromXml
Implements UmlSequenceDiagramFactoryInterface.
Definition at line 41 of file UmlSequenceDiagramFactoryFromXml.class.php.
00042 { 00043 if( self::$objInstance == null ) 00044 { 00045 self::$objInstance = new UmlSequenceDiagramFactoryFromXml(); 00046 } 00047 return self::$objInstance; 00048 }
| getUmlSequenceDiagram | ( | ) |
get the xml sequence object
Implements UmlSequenceDiagramFactoryInterface.
Definition at line 97 of file UmlSequenceDiagramFactoryFromXml.class.php.
Referenced by loadActors(), loadMessages(), and perform().
| getXml | ( | ) |
Get the xml of the sequence object
UmlSequenceDiagram::setXml( string )
| string | $strXml |
Definition at line 73 of file UmlSequenceDiagramFactoryFromXml.class.php.
| loadActors | ( | ) | [protected] |
Load the xml file and based on it insert a list of actors into the UmlSequenceDiagram Object
Definition at line 120 of file UmlSequenceDiagramFactoryFromXml.class.php.
References getUmlSequenceDiagram().
Referenced by perform().
00121 { 00122 $arrActors = $this->getUmlSequenceDiagram()->getActors(); 00123 00124 foreach( $this->objXml->actors->actor as $xmlActor ) 00125 { 00126 $strId = (string)$xmlActor['id']; 00127 $strType = (string)$xmlActor['type']; 00128 $strName = (string)$xmlActor; 00129 00130 $objActor = new UmlSequenceDiagramActor(); 00131 $objActor->setId( $strId ); 00132 $objActor->setType( $strType ); 00133 $objActor->setName( $strName ); 00134 00135 $arrActors[ $objActor->getId() ] = $objActor; 00136 } 00137 $this->getUmlSequenceDiagram()->setActors( $arrActors ); 00138 }
| loadMessages | ( | ) | [protected] |
Load the xml file and based on it insert a list of messages into the UmlSequenceDiagram Object
Definition at line 144 of file UmlSequenceDiagramFactoryFromXml.class.php.
References getUmlSequenceDiagram().
Referenced by perform().
00145 { 00146 $arrMessages = $this->getUmlSequenceDiagram()->getMessages(); 00147 $arrActors = $this->getUmlSequenceDiagram()->getActors(); 00148 00149 foreach( $this->objXml->messages->message as $xmlMessage ) 00150 { 00151 $strFrom = (string)$xmlMessage[ 'from' ]; 00152 $strTo = (string)$xmlMessage[ 'to' ]; 00153 $strType = (string) $xmlMessage[ 'type' ]; 00154 $strText = (string) $xmlMessage[ 'text' ]; 00155 00156 $objMessage = new UmlSequenceDiagramMessage(); 00157 $objMessage->setType( $strType ); 00158 $objMessage->setText( $strText ); 00159 00160 if( !array_key_exists( $strFrom , $arrActors ) ) 00161 { 00162 throw new Exception( ' Actor From ' . $strFrom . ' not Found ' ); 00163 } 00164 $objMessage->setActorFrom( $arrActors[ $strFrom ] ); 00165 00166 if( !array_key_exists( $strTo , $arrActors ) ) 00167 { 00168 throw new Exception( ' Actor To ' . $strTo . ' not Found ' ); 00169 } 00170 $objMessage->setActorTo( $arrActors[ $strTo ] ); 00171 00172 if( isset( $xmlMessage->values->value ) ) 00173 foreach( $xmlMessage->values->value as $xmlValue ) 00174 { 00175 $strName = (string)$xmlValue['name']; 00176 $strValue = (string)$xmlValue['value']; 00177 $objValue = new UmlSequenceDiagramValue(); 00178 $objValue->setName( $strName ); 00179 $objValue->setValue( $strValue ); 00180 00181 $objMessage->addValue( $objValue ); 00182 } 00183 00184 $arrMessages[] = $objMessage; 00185 } 00186 $this->getUmlSequenceDiagram()->setMessages( $arrMessages ); 00187 }
| perform | ( | ) |
create a UmlSequenceDiagram based into its configurations
Implements UmlSequenceDiagramFactoryInterface.
Definition at line 108 of file UmlSequenceDiagramFactoryFromXml.class.php.
References getUmlSequenceDiagram(), loadActors(), loadMessages(), and setUmlSequenceDiagram().
00109 { 00110 $this->setUmlSequenceDiagram( new UmlSequenceDiagram() ); 00111 $this->loadActors(); 00112 $this->loadMessages(); 00113 return $this->getUmlSequenceDiagram(); 00114 }
| setUmlSequenceDiagram | ( | UmlSequenceDiagram $ | objUmlSequenceDiagram | ) |
set the xml sequence object
| $objUmlSequenceDiagram |
Implements UmlSequenceDiagramFactoryInterface.
Definition at line 85 of file UmlSequenceDiagramFactoryFromXml.class.php.
Referenced by perform().
00086 { 00087 $this->objUmlSequenceDiagram = $objUmlSequenceDiagram; 00088 return $this; 00089 }
| setXml | ( | $ | strXml | ) |
Set the xml of the sequence object
UmlSequenceDiagram::getXml()
| string | $strXml |
Definition at line 59 of file UmlSequenceDiagramFactoryFromXml.class.php.
References $strXml.
00060 { 00061 $this->objXml = simplexml_load_string( $strXml ); 00062 return $this; 00063 }
$objInstance [static, protected] |
Singleton of the UmlSequenceDiagramFactoryFromXml
Definition at line 19 of file UmlSequenceDiagramFactoryFromXml.class.php.
$objUmlSequenceDiagram [protected] |
Xml Sequence Object in factory
Definition at line 27 of file UmlSequenceDiagramFactoryFromXml.class.php.
$objXml [protected] |
Simple Xml Element used to access information from a xml
SimpleXmlElement
Definition at line 34 of file UmlSequenceDiagramFactoryFromXml.class.php.
1.5.9