| Conditions | 4 |
| Paths | 3 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | protected function getUserAgent($userAgent) |
||
| 42 | { |
||
| 43 | if (!empty($userAgent)) { |
||
| 44 | return $userAgent; |
||
| 45 | } |
||
| 46 | |||
| 47 | if (isset($_SERVER['HTTP_USER_AGENT']) && !empty($_SERVER['HTTP_USER_AGENT'])) { |
||
| 48 | return $_SERVER['HTTP_USER_AGENT']; |
||
| 49 | } |
||
| 50 | |||
| 51 | return config('tracker.default_user_agent', ''); |
||
| 52 | } |
||
| 53 | |||
| 61 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: