| 1 | <?php |
||
| 7 | class UserAgentParser |
||
| 8 | { |
||
| 9 | public $parser; |
||
| 10 | |||
| 11 | public $userAgent; |
||
| 12 | |||
| 13 | public $operatingSystem; |
||
| 14 | |||
| 15 | public $device; |
||
| 16 | |||
| 17 | public $originalUserAgent; |
||
| 18 | |||
| 19 | public function __construct($basePath, $userAgent = '') |
||
| 33 | |||
| 34 | public function getOperatingSystemVersion() |
||
| 40 | |||
| 41 | protected function getUserAgent($userAgent) |
||
| 53 | |||
| 54 | public function getUserAgentVersion() |
||
| 60 | } |
||
| 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: