Created
August 30, 2017 08:37
-
-
Save andreconghau/8007b34adef8b2a3bd8f0c316b99c896 to your computer and use it in GitHub Desktop.
Class config with Singleton parttern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Configuration { | |
private static $instance; | |
private function __construct($configuration) {/* */} | |
public static function getInstance() { | |
if (self::$instance === null) { | |
self::$instance = new Configuration(); | |
} | |
return self::$instance; | |
} | |
public function get($key) {/* */} | |
public function getAll() {/* */} | |
} | |
$singleton = Configuration::getInstance(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment