Mercurial > defr > DualBlog
comparison includes/class.factory.php @ 28:bdf116822fc6
Ajout d'un moyen d'obtenir un singleton sur l'objet Requete.
Cela permet d'éviter d'avoir à charger plusieurs fois les données
provenant de $_GET, $_COOKIE et $_POST, entre autres.
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Thu, 01 Nov 2007 17:43:31 +0100 |
parents | ff57b45eda37 |
children |
comparison
equal
deleted
inserted
replaced
27:6125c7a882b8 | 28:bdf116822fc6 |
---|---|
1 <?php | 1 <?php |
2 class Factory { | 2 class Factory { |
3 private static $db = null; | 3 private static $db = null; |
4 private static $mainTemplate = null; | 4 private static $mainTemplate = null; |
5 private static $skeleton = null; | 5 private static $skeleton = null; |
6 private static $request = null; | |
6 | 7 |
7 public static function getDB() { | 8 public static function getDB() { |
8 if(is_null(Factory::$db)) | 9 if(is_null(Factory::$db)) |
9 Factory::$db = new DataAccess(); | 10 Factory::$db = new DataAccess(); |
10 return Factory::$db; | 11 return Factory::$db; |
13 public static function getSkeleton() { | 14 public static function getSkeleton() { |
14 if(is_null(Factory::$skeleton)) | 15 if(is_null(Factory::$skeleton)) |
15 Factory::$skeleton = new Skeleton(); | 16 Factory::$skeleton = new Skeleton(); |
16 return Factory::$skeleton; | 17 return Factory::$skeleton; |
17 } | 18 } |
19 | |
20 public static function getRequete() { | |
21 if(is_null(Factory::$request)) | |
22 Factory::$request = new Requete(); | |
23 return Factory::$request; | |
24 } | |
18 } | 25 } |
19 | 26 |