1 | <?php |
||
17 | class StorageService implements StorageInterface |
||
18 | { |
||
19 | /** |
||
20 | * Put |
||
21 | * |
||
22 | * @param string $file |
||
23 | * @param string $disk |
||
24 | * @param string $path |
||
25 | * @param string|null $filename |
||
26 | * @return mixed |
||
27 | */ |
||
28 | public function put($file, $disk, $path, $filename = null) |
||
35 | |||
36 | /** |
||
37 | * Size On Disk |
||
38 | * |
||
39 | * @param $disk |
||
40 | * @param $path |
||
41 | * @return bool|int |
||
42 | */ |
||
43 | public function sizeOnDisk($disk, $path) |
||
51 | |||
52 | /** |
||
53 | * Get |
||
54 | * |
||
55 | * @param string $disk |
||
56 | * @param string $path |
||
57 | * @return false|string |
||
58 | * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException |
||
59 | */ |
||
60 | public function get($disk, $path) |
||
68 | |||
69 | /** |
||
70 | * Move |
||
71 | * |
||
72 | * @param string $source_path |
||
73 | * @param string $destination_path |
||
74 | * @param string|null $source_disk |
||
75 | * @param string|null $destination_disk |
||
76 | * @return mixed |
||
77 | * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException |
||
78 | */ |
||
79 | public function move($source_path, $destination_path, $source_disk = null, $destination_disk = null) |
||
94 | |||
95 | public function delete($disk, $path) |
||
99 | } |
PHP has two types of connecting operators (logical operators, and boolean operators):
and
&&
or
||
The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like
&&
, or||
.Let’s take a look at a few examples:
Logical Operators are used for Control-Flow
One case where you explicitly want to use logical operators is for control-flow such as this:
Since
die
introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined withthrow
at this point:These limitations lead to logical operators rarely being of use in current PHP code.