1 | <?php |
||
7 | class FileNameParser |
||
8 | { |
||
9 | private $version; |
||
10 | |||
11 | /** |
||
12 | * Constructor. |
||
13 | * |
||
14 | * @param string $filename Filename of migration. |
||
15 | */ |
||
16 | public function __construct($filename) |
||
25 | |||
26 | /** |
||
27 | * Get version of migration. |
||
28 | * |
||
29 | * @return string |
||
30 | */ |
||
31 | public function getVersion() |
||
35 | |||
36 | /** |
||
37 | * Get name of migration. |
||
38 | * |
||
39 | * @return string |
||
40 | */ |
||
41 | public function getMigrationName() |
||
45 | |||
46 | /** |
||
47 | * Get class name of migration. |
||
48 | * |
||
49 | * @return string |
||
50 | */ |
||
51 | public function getMigrationClassName() |
||
55 | } |
||
56 |
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: