pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/DesignPatternsPHP/DesignPatternsPHP/tree/main/Behavioral/State

"stylesheet" href="https://github.githubassets.com/assets/repository-6534fbc3f5e83ac0.css" /> DesignPatternsPHP/Behavioral/State at main · DesignPatternsPHP/DesignPatternsPHP · GitHub
Skip to content

Latest commit

 

History

History

README.rst

Purpose

Encapsulate varying behavior for the same routine based on an object's state. This can be a cleaner way for an object to change its behavior at runtime without resorting to large monolithic conditional statements.

UML Diagram

Alt State UML Diagram

Code

You can also find this code on GitHub

ContextOrder.php

.. literalinclude:: ContextOrder.php
   :language: php
   :linenos:

StateOrder.php

.. literalinclude:: StateOrder.php
   :language: php
   :linenos:

CreateOrder.php

.. literalinclude:: CreateOrder.php
   :language: php
   :linenos:

ShippingOrder.php

.. literalinclude:: ShippingOrder.php
   :language: php
   :linenos:

OrderDone.php

.. literalinclude:: OrderDone.php
   :language: php
   :linenos:

Test

Tests/StateTest.php

.. literalinclude:: Tests/StateTest.php
   :language: php
   :linenos:


pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy