Skip to content

Implementation of a simple menu bar with composite design pattern in PHP

Notifications You must be signed in to change notification settings

majidkarimizadeh/composite-design-pattern-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Composite Design Pattern in PHP

  • Interact with a group of objects, just like a single object.
  • Tree structure to represent part-whole hierarchies.

                            Menu
                          /      \
                         /        \
                        /          \
                  CellPhone       Laptop
                      / \          / \
                     /   \        /   \
                    /     \     L1     L2
                   /       \
             SmartPhone   DumpPhone 
                /   \
               /     \
              /       \
            S1         S2

Composite (it can have other objects below it)

  • Menu
  • Laptop
  • CellPhone
  • SmartPhone

Leaf (it has no objects below it)

  • S1
  • S2
  • L1
  • L2
  • DumpPhone

YouTube link

https://youtu.be/3dmak5Do3xo

About

Implementation of a simple menu bar with composite design pattern in PHP

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages