PHPStrom PlantUML语法

创建的UMl文件有文档地址可以参考 

https://plantuml.com/class-diagram

 

 

tree:

.
├── AbstractFactory.php
├── Html
│   ├── Picture.php
│   └── Text.php
├── HtmlFactory.php
├── Json
│   ├── Picture.php
│   └── Text.php
├── JsonFactory.php
├── MediaInterface.php
├── Picture.php
├── readme.md
├── Tests
│   ├── AbstractFactoryTest.php
│   └── RunController.php
├── Text.php
└── UML.puml

 

demo:

@startuml
'https://plantuml.com/class-diagram

abstract class AbstractFactory{
  +{abstract} createText(content)
  +{abstract} createPicture(path,name)
}
note top of AbstractFactory
  AbstractFactory 抽象类
end note
note right of AbstractFactory::createText
  创建本文组件
end note
note right of AbstractFactory::createPicture
  创建图片组件
end note

class JsonFactory {
  +createPicture(path,name)
  +createText(content)
}
note top of JsonFactory
  <b>JsonFactory</b>
  是用于创建
  JSON 组件的工厂
end note
note left of JsonFactory::createPicture
  创建图片组件
end note
note left of JsonFactory::createText
  创建文本组件
end note


class HtmlFactory {
  +createPicture(path,name)
  +createText(content)
}
note top of HtmlFactory
  HtmlFactory
  是用于创建 HTML
  组件的工厂
end note

note left of HtmlFactory::createPicture
  创建图片组件
end note
note left of HtmlFactory::createText
  创建文本组件
end note

class JsonFactory extends AbstractFactory
class HtmlFactory extends AbstractFactory

note top of MediaInterface
  该接口不是抽象工厂设计模式的一部分,
  一般情况下, 每个组件都是不相干的
end note
note right of MediaInterface::render
  JSON 或 HTML(取决于具体类)
  输出的未经处理的渲染
end note

interface MediaInterface{
  +render()
}

note top of Picture
  Picture类
end note

abstract Picture{
  #path
  #name
  +__construct(path,name)
}

note top of Text
  Text类
end note
abstract Text{
  #text
  +__construct(text)
}
class Picture implements MediaInterface
class Text implements MediaInterface

class Html/Picture {
   +render()
}
note top of Html/Picture
  该类是以 HTML 格式渲染的具体图片类
end note
note left of Html/Picture::render
  HTML 格式输出的图片
end note
class Html/Text {
   +render()
}

class Json/Picture {
   +render()
}
class Json/Text {
   +render()
}

class Html/Text extends Text
class Json/Text extends Text
class Html/Picture extends Picture
class Json/Picture extends Picture

@enduml

demo-uml示例图:

 

posted @ 2022-09-26 15:17  php的自我修养  阅读(62)  评论(0编辑  收藏  举报