SGIRequestAdapter.php
7 years ago
SGRequest.php
7 years ago
SGRequestAdapterWordpress.php
5 years ago
SGResponse.php
7 years ago
SGRequest.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | class SGRequest |
| 4 | { |
| 5 | private static $instance = null; |
| 6 | |
| 7 | public static function getInstance() |
| 8 | { |
| 9 | if (!self::$instance) { |
| 10 | self::$instance = self::createAdapterInstance(); |
| 11 | } |
| 12 | |
| 13 | return self::$instance; |
| 14 | } |
| 15 | |
| 16 | private static function createAdapterInstance() |
| 17 | { |
| 18 | $className = 'SGRequestAdapter'.SG_ENV_ADAPTER; |
| 19 | require_once(SG_REQUEST_PATH.$className.'.php'); |
| 20 | $adapter = new $className(); |
| 21 | return $adapter; |
| 22 | } |
| 23 | |
| 24 | private function __construct() |
| 25 | { |
| 26 | |
| 27 | } |
| 28 | |
| 29 | private function __clone() |
| 30 | { |
| 31 | |
| 32 | } |
| 33 | } |
| 34 |