Type Tunnel Design Pattern in PHP

Type tunnel pattern is not exactly a recognized software design pattern by GOF (Gang of Four book). Type tunnel is used in cases where multiple unrelated types are passed (tunneled) through adaptation layer and converted to the type the underlying layer expects.

Type Tunnel Design Pattern UML

Type tunnel also has side effect that compensates its benefits, because in a dynamically typed language such as PHP, the types can be solved differently.

It can be best used in statically typed programming languages such as C++ but in case of PHP implementing type tunnel isn’t really applicable.

See Also

GitHub OctocatFound a typo? Something wrong with this content? Just fork and edit it.

Content of this work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license. Code snippets in examples are published under the CC0 1.0 Universal (CC0 1.0). Thanks to all the contributors.