You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: pages/Design-Patterns.md
+10-10
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ make your code easier to manage and easier for others to understand.
11
11
12
12
*[Architectural pattern on Wikipedia](https://en.wikipedia.org/wiki/Architectural_pattern)
13
13
*[Software design pattern on Wikipedia](https://en.wikipedia.org/wiki/Software_design_pattern)
14
-
*[Collection of implementation examples](http://designpatternsphp.readthedocs.io/en/latest/)
14
+
*[Collection of implementation examples](https://designpatternsphp.readthedocs.io/en/latest/)
15
15
16
16
## Factory
17
17
@@ -70,17 +70,17 @@ one instance of a particular class. The singleton pattern enables us to do this.
70
70
71
71
**TODO: NEED NEW SINGLETON CODE EXAMPLE**
72
72
73
-
The code above implements the singleton pattern using a [*static* variable](http://php.net/language.variables.scope#language.variables.scope.static) and the static creation method `getInstance()`.
73
+
The code above implements the singleton pattern using a [*static* variable](https://www.php.net/language.variables.scope#language.variables.scope.static) and the static creation method `getInstance()`.
74
74
Note the following:
75
75
76
-
* The constructor [`__construct()`](http://php.net/language.oop5.decon#object.construct) is declared as protected to
76
+
* The constructor [`__construct()`](https://www.php.net/language.oop5.decon#object.construct) is declared as protected to
77
77
prevent creating a new instance outside of the class via the `new` operator.
78
-
* The magic method [`__clone()`](http://php.net/language.oop5.cloning#object.clone) is declared as private to prevent
79
-
cloning of an instance of the class via the [`clone`](http://php.net/language.oop5.cloning) operator.
80
-
* The magic method [`__wakeup()`](http://php.net/language.oop5.magic#object.wakeup) is declared as private to prevent
81
-
unserializing of an instance of the class via the global function [`unserialize()`](http://php.net/function.unserialize)
78
+
* The magic method [`__clone()`](https://www.php.net/language.oop5.cloning#object.clone) is declared as private to prevent
79
+
cloning of an instance of the class via the [`clone`](https://www.php.net/language.oop5.cloning) operator.
80
+
* The magic method [`__wakeup()`](https://www.php.net/language.oop5.magic#object.wakeup) is declared as private to prevent
81
+
unserializing of an instance of the class via the global function [`unserialize()`](https://www.php.net/function.unserialize)
82
82
.
83
-
* A new instance is created via [late static binding](http://php.net/language.oop5.late-static-bindings) in the static
83
+
* A new instance is created via [late static binding](https://www.php.net/language.oop5.late-static-bindings) in the static
84
84
creation method `getInstance()` with the keyword `static`. This allows the subclassing of the class `Singleton` in the
85
85
example.
86
86
@@ -142,7 +142,7 @@ add new output types without affecting the client code.
142
142
143
143
You will see how each concrete 'output' class implements an OutputInterface - this serves two purposes, primarily it
144
144
provides a simple contract which must be obeyed by any new concrete implementations. Secondly by implementing a common
145
-
interface you will see in the next section that you can now utilise [Type Hinting](http://php.net/language.oop5.typehinting) to ensure that the client which is utilising these behaviours is of the correct type,
145
+
interface you will see in the next section that you can now utilise [Type Hinting](https://www.php.net/language.oop5.typehinting) to ensure that the client which is utilising these behaviours is of the correct type,
146
146
in this case 'OutputInterface'.
147
147
148
148
The next snippet of code outlines how a calling client class might use one of these algorithms and even better set the
0 commit comments