1 | <?php |
||
24 | class Image { |
||
25 | |||
26 | use IntegerHeightTrait; |
||
27 | use IntegerSizeTrait; |
||
28 | use IntegerWidthTrait; |
||
29 | use StringDirectoryTrait; |
||
30 | use StringExtensionTrait; |
||
31 | use StringFilenameTrait; |
||
32 | use StringPathnameTrait; |
||
33 | |||
34 | /** |
||
35 | * Orientation "horizontal". |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | const ORIENTATION_HORIZONTAL = "horizontal"; |
||
40 | |||
41 | /** |
||
42 | * Orientation "vertical". |
||
43 | * |
||
44 | * @var string |
||
45 | */ |
||
46 | const ORIENTATION_VERTICAL = "vertical"; |
||
47 | |||
48 | /** |
||
49 | * Constructor. |
||
50 | * |
||
51 | * @param string $pathname The pathname. |
||
52 | */ |
||
53 | public function __construct($pathname) { |
||
56 | |||
57 | /** |
||
58 | * Get the dimensions. |
||
59 | * |
||
60 | * @return int[] Returns the dimensions. |
||
61 | */ |
||
62 | public function getDimensions() { |
||
65 | |||
66 | /** |
||
67 | * Get the orientation. |
||
68 | * |
||
69 | * @return string|null Returns the orientation, null if width and height are equals. |
||
70 | */ |
||
71 | public function getOrientation() { |
||
83 | |||
84 | /** |
||
85 | * Initialize. |
||
86 | * |
||
87 | * @return void |
||
88 | */ |
||
89 | public function init() { |
||
103 | |||
104 | /** |
||
105 | * Resize. |
||
106 | * |
||
107 | * @param int $newWidth The new width. |
||
108 | * @param int $newHeight The new height. |
||
109 | * @param string $pathname The pathname. |
||
110 | * @return bool Returns true in case os success, false otherwise. |
||
111 | * @throws RuntimeException Throws a runtime exception if the re-sampled copy failed. |
||
112 | */ |
||
113 | public function resize($newWidth, $newHeight, $pathname) { |
||
129 | |||
130 | /** |
||
131 | * Set the pathname. |
||
132 | * |
||
133 | * @param string $pathname The pathname. |
||
134 | * @return Image Returns this image. |
||
135 | * @throws InvalidArgumentException Throws an invalid argument exception if the pathname was not found. |
||
136 | */ |
||
137 | protected function setPathname($pathname) { |
||
144 | } |
||
145 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.