I have an array that I want to show in a class diagram.
protected static $config = array(
'host' => 'localhost',
'username' => '',
'password' => '',
'dbname' => ''
);
is this a correct way :
$config( key: 'localhost', value: '', key: 'username', value: '', key: 'password', value: '', key: 'dbname', value: '')
and underlined the whole line for static
Usually one doesn't use UML to configure things, but you can do it. You would need to create instance specifications to get the result you want.
You could create an instance specification,
associativeArrayInstanceSpec1
of typeAssociativeArray
that composes a bunch of otherAssociativeArrayEntry
instance specifications that each have a specific key and value. Then you could declare a property with a default value inSomeClass
asconfig : AssociativeArray [1] = associativeArrayInstanceSpec1
.