Conditions | 3 |
Paths | 3 |
Total Lines | 9 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function getFileSize($path) |
||
22 | { |
||
23 | // Use the Windows COM interface |
||
24 | $fsobj = new \COM('Scripting.FileSystemObject'); |
||
25 | if (dirname($path) == '.') |
||
26 | $this->path = ((substr(getcwd(), -1) == DIRECTORY_SEPARATOR) ? getcwd() . basename($path) : getcwd() . DIRECTORY_SEPARATOR . basename($path)); |
||
|
|||
27 | $f = $fsobj->GetFile($path); |
||
28 | return BigInteger::of($f->Size); |
||
29 | } |
||
30 | } |
||
31 |
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: