Conditions | 4 |
Paths | 3 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
19 | public function __construct( array $files ) { |
||
20 | foreach ( $files as $url => $fileContents ) { |
||
21 | if ( !is_string( $url ) || !is_string( $fileContents ) ) { |
||
22 | throw new InvalidArgumentException( 'Both file url and file contents need to be of type string' ); |
||
23 | } |
||
24 | } |
||
25 | |||
26 | $this->files = $files; |
||
|
|||
27 | } |
||
28 | |||
46 |
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: