| Total Complexity | 10 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | trait SchemeAttribute |
||
| 9 | { |
||
| 10 | protected $host; |
||
| 11 | protected $port; |
||
| 12 | protected $scheme; |
||
| 13 | |||
| 14 | public function getScheme() |
||
| 26 | } |
||
| 27 | } |
||
| 28 | |||
| 29 | public function getHost() |
||
| 30 | { |
||
| 31 | if (isset($this->host)) { |
||
| 32 | return $this->host; |
||
| 33 | } |
||
| 34 | return $this->host = $this->getServer()['HTTP_HOST'] ?? 'localhost'; |
||
| 35 | } |
||
| 36 | |||
| 37 | public function getPort() |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * 获取服务器基础Uri |
||
| 47 | * |
||
| 48 | * @return string |
||
| 49 | */ |
||
| 50 | public function getServerUri() |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Get 服务器属性 |
||
| 57 | * |
||
| 58 | * @return array |
||
| 59 | */ |
||
| 60 | abstract public function getServer(); |
||
| 61 | } |
||
| 62 |