Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
77 | public function getHost() |
||
78 | { |
||
79 | if ($this->db->driverName === 'mysql') { |
||
80 | $host = $this->db |
||
81 | ->createCommand('SELECT `HOST` FROM `information_schema`.`PROCESSLIST` WHERE `ID` = CONNECTION_ID()') |
||
82 | ->queryScalar(); |
||
83 | return preg_replace('/:\d+$/', '', $host); |
||
84 | } |
||
85 | |||
86 | if ($this->db->driverName === 'pgsql') { |
||
87 | return $this->db |
||
|
|||
88 | ->createCommand('SELECT inet_client_addr()') |
||
89 | ->queryScalar(); |
||
90 | } |
||
91 | |||
92 | return '127.0.0.1'; // By default |
||
93 | } |
||
95 |
If the returned type also contains false, it is an indicator that maybe an error condition leading to the specific return statement remains unhandled.