| Conditions | 1 |
| Paths | 1 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | public function getThumbnail($image, $type) |
||
| 39 | { |
||
| 40 | // We need to get extension type ( .jpeg , .png ...) |
||
| 41 | $ext = pathinfo($image, PATHINFO_EXTENSION); |
||
| 42 | |||
| 43 | // We remove extension from file name so we can append thumbnail type |
||
| 44 | $name = str_replace_last('.'.$ext, '', $image); |
||
| 45 | |||
| 46 | // We merge original name + type + extension |
||
| 47 | return $name.'-'.$type.'.'.$ext; |
||
| 48 | } |
||
| 49 | } |
||
| 50 |
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: