From 78b8adc0157bb6b7aba55651a46f0d4adf46a179 Mon Sep 17 00:00:00 2001 From: Florian Wolters Date: Wed, 13 Mar 2013 16:21:22 +0100 Subject: [PATCH] Enhanced the example for the Singleton design pattern. - Moved static variable into the static creation method getInstance. - Replaced "new self();" with "new static" (late static binding to allow subclassing). - Changed visibility of __construct to protected. - Added the two private methods __clone and __wakeup. - Added DocBlock comments. - Updated description and enhanced with links to the PHP manual. --- pages/Design-Patterns.md | 66 ++++++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/pages/Design-Patterns.md b/pages/Design-Patterns.md index 041928a..75c14d3 100644 --- a/pages/Design-Patterns.md +++ b/pages/Design-Patterns.md @@ -71,30 +71,72 @@ only one instance of a particular class. The singleton pattern enables us to do