Factory Method

This commit is contained in:
2025-07-03 19:35:54 +03:00
parent 91f8ded888
commit 0f4618edf5
24 changed files with 409 additions and 31 deletions

View File

@@ -1,4 +1,7 @@
<!doctype html>
<?php
require '../vendor/autoload.php';
require '../src/helpers.php';
?><!doctype html>
<html lang="uk">
<head>
<meta charset="UTF-8">
@@ -10,31 +13,49 @@
<script src="assets/js/highlight.min.js"></script>
<script src="assets/js/stylus.min.js"></script>
<style>
html, body {
position: relative;
width: 100%;
height: 100dvh;
margin: 0;
padding: 0;
background: #ddd;
color: #1c1b19;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}
main {
box-shadow: -1px 1px 5px 0 rgba(123, 123, 123, 1);
-webkit-box-shadow: -1px 1px 5px 0 rgba(123, 123, 123, 1);
-moz-box-shadow: -1px 1px 5px 0 rgba(123, 123, 123, 1);
position: absolute;
width: 100%;
max-width: 1280px;
margin: 0 auto;
outline: dotted 1px #a9a49f;
padding: 1rem;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
pre {
font-family: Consolas, monospace;
align-self: center;
}
</style>
</head>
<body>
<main>
<?php
<main>
<?php
/** Creational patterns **/
use Pattern\Creational\Singleton;
require '../vendor/autoload.php';
require '../src/helpers.php';
// Creational patterns
require '../code/singleton.php';
?>
</main>
<script>hljs.highlightAll();</script>
// require '../code/singleton.php';
require '../code/factory_method.php';
?>
</main>
<script>hljs.highlightAll()</script>
</body>
</html>