| Conditions | 3 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | public function getSyncTimestamp() |
||
|
|
|||
| 13 | { |
||
| 14 | if (empty($this->syncTimestamp)) { |
||
| 15 | $timestamp = new DateTime(); |
||
| 16 | $this->syncTimestamp = |
||
| 17 | $timestamp->format(Constants::SYNC_TIMESTAMP_FORMAT) . |
||
| 18 | Constants::SEPARATOR . md5( |
||
| 19 | (php_sapi_name() == 'cli' ? |
||
| 20 | 'cli' : $_SERVER['REMOTE_ADDR'] |
||
| 21 | ) . time() |
||
| 22 | ); |
||
| 23 | } |
||
| 24 | return $this->syncTimestamp; |
||
| 25 | } |
||
| 26 | } |
||
| 27 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: