@@ -83,6 +83,9 @@ discard block |
||
| 83 | 83 | $this->storage = new Storage($this->getStorageDir(), $this->config->imagesDir, $this->config->filesDir); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | + /** |
|
| 87 | + * @param Request $request |
|
| 88 | + */ |
|
| 86 | 89 | private function redirectMatching($request) |
| 87 | 90 | { |
| 88 | 91 | $redirects = $this->storage->getRedirects()->getRedirects(); |
@@ -112,7 +115,7 @@ discard block |
||
| 112 | 115 | * Loop through sitemap items and see if one matches the requestUri. |
| 113 | 116 | * If it does, add it tot the matchedSitemapItems array |
| 114 | 117 | * |
| 115 | - * @param $request |
|
| 118 | + * @param Request $request |
|
| 116 | 119 | */ |
| 117 | 120 | private function sitemapMatching($request) |
| 118 | 121 | { |
@@ -177,7 +180,7 @@ discard block |
||
| 177 | 180 | * @param array $parameters |
| 178 | 181 | * @param \stdClass|null $matchedSitemapItem |
| 179 | 182 | * |
| 180 | - * @return mixed |
|
| 183 | + * @return Component |
|
| 181 | 184 | * @throws \Exception |
| 182 | 185 | */ |
| 183 | 186 | private function getComponentObject($class = '', $template = '', $parameters = array(), $matchedSitemapItem) |
@@ -268,6 +271,9 @@ discard block |
||
| 268 | 271 | return $this->config->templateDir; |
| 269 | 272 | } |
| 270 | 273 | |
| 274 | + /** |
|
| 275 | + * @return string |
|
| 276 | + */ |
|
| 271 | 277 | public function getStorageDir() |
| 272 | 278 | { |
| 273 | 279 | return $this->config->storageDir; |
@@ -141,8 +141,8 @@ |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | - * @param $template |
|
| 145 | - * @param null $application |
|
| 144 | + * @param string $template |
|
| 145 | + * @param null|Application $application |
|
| 146 | 146 | * @return string |
| 147 | 147 | */ |
| 148 | 148 | protected function getTemplatePath($template, $application=null) |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | - * @param $request |
|
| 71 | + * @param Request $request |
|
| 72 | 72 | * @param CmsComponent $cmsComponent |
| 73 | 73 | */ |
| 74 | 74 | private function newRoute($request, $cmsComponent) |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | - * @param $request |
|
| 86 | + * @param Request $request |
|
| 87 | 87 | * @param CmsComponent $cmsComponent |
| 88 | 88 | */ |
| 89 | 89 | private function deleteRoute($request, $cmsComponent) |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | - * @param \cc\Request $request |
|
| 183 | + * @param \CloudControl\Cms\cc\Request $request |
|
| 184 | 184 | * @return array |
| 185 | 185 | */ |
| 186 | 186 | private function getPostValues($request) |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | - * @return \cc\Request |
|
| 294 | + * @return \CloudControl\Cms\cc\Request |
|
| 295 | 295 | */ |
| 296 | 296 | private function setPathBackup() |
| 297 | 297 | { |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
| 308 | - * @param \cc\Request $request |
|
| 308 | + * @param \CloudControl\Cms\cc\Request $request |
|
| 309 | 309 | */ |
| 310 | 310 | private function resetPathBackup($request) |
| 311 | 311 | { |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
| 320 | - * @param $form |
|
| 320 | + * @param string|null $form |
|
| 321 | 321 | */ |
| 322 | 322 | private function setFormParameter($form) |
| 323 | 323 | { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param string $imagePath |
| 77 | 77 | * @param bool $getExtension |
| 78 | 78 | * |
| 79 | - * @return bool|int|string |
|
| 79 | + * @return integer |
|
| 80 | 80 | */ |
| 81 | 81 | public function getImageMimeType($imagePath, $getExtension = false) |
| 82 | 82 | { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | - * @param $pathToBitmapFile |
|
| 152 | + * @param string $pathToBitmapFile |
|
| 153 | 153 | * |
| 154 | 154 | * @return string |
| 155 | 155 | */ |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | - * @param $header |
|
| 168 | + * @param string $header |
|
| 169 | 169 | * |
| 170 | 170 | * @return array |
| 171 | 171 | */ |
@@ -195,14 +195,14 @@ discard block |
||
| 195 | 195 | * Loop through the data in the body of the bitmap |
| 196 | 196 | * file and calculate each individual pixel based on the |
| 197 | 197 | * bytes |
| 198 | - * @param $bodySize |
|
| 199 | - * @param $x |
|
| 198 | + * @param integer $bodySize |
|
| 199 | + * @param integer $x |
|
| 200 | 200 | * @param $width |
| 201 | - * @param $usePadding |
|
| 202 | - * @param $y |
|
| 201 | + * @param boolean $usePadding |
|
| 202 | + * @param integer $y |
|
| 203 | 203 | * @param $height |
| 204 | - * @param $body |
|
| 205 | - * @param $image |
|
| 204 | + * @param string $body |
|
| 205 | + * @param resource $image |
|
| 206 | 206 | */ |
| 207 | 207 | private function loopThroughBodyAndCalculatePixels($bodySize, $x, $width, $usePadding, $y, $height, $body, $image) |
| 208 | 208 | { |
@@ -13,6 +13,10 @@ |
||
| 13 | 13 | { |
| 14 | 14 | protected $imagesDir; |
| 15 | 15 | |
| 16 | + /** |
|
| 17 | + * @param \CloudControl\Cms\storage\Repository $repository |
|
| 18 | + * @param string $imagesDir |
|
| 19 | + */ |
|
| 16 | 20 | public function __construct($repository, $imagesDir) |
| 17 | 21 | { |
| 18 | 22 | parent::__construct($repository); |
@@ -78,12 +78,15 @@ |
||
| 78 | 78 | */ |
| 79 | 79 | public static function humanFileSize($size, $unit = "") |
| 80 | 80 | { |
| 81 | - if ((!$unit && $size >= 1 << 30) || $unit == "GB") |
|
| 82 | - return number_format($size / (1 << 30), 2) . "GB"; |
|
| 83 | - if ((!$unit && $size >= 1 << 20) || $unit == "MB") |
|
| 84 | - return number_format($size / (1 << 20), 2) . "MB"; |
|
| 85 | - if ((!$unit && $size >= 1 << 10) || $unit == "KB") |
|
| 86 | - return number_format($size / (1 << 10), 2) . "KB"; |
|
| 81 | + if ((!$unit && $size >= 1 << 30) || $unit == "GB") { |
|
| 82 | + return number_format($size / (1 << 30), 2) . "GB"; |
|
| 83 | + } |
|
| 84 | + if ((!$unit && $size >= 1 << 20) || $unit == "MB") { |
|
| 85 | + return number_format($size / (1 << 20), 2) . "MB"; |
|
| 86 | + } |
|
| 87 | + if ((!$unit && $size >= 1 << 10) || $unit == "KB") { |
|
| 88 | + return number_format($size / (1 << 10), 2) . "KB"; |
|
| 89 | + } |
|
| 87 | 90 | |
| 88 | 91 | return number_format($size) . " bytes"; |
| 89 | 92 | } |
@@ -63,7 +63,9 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | protected function calculateX($imageResource) |
| 65 | 65 | { |
| 66 | - if (intval($this->_x) === $this->_x) return $this->_x; |
|
| 66 | + if (intval($this->_x) === $this->_x) { |
|
| 67 | + return $this->_x; |
|
| 68 | + } |
|
| 67 | 69 | |
| 68 | 70 | $x = strtolower($this->_x); |
| 69 | 71 | |
@@ -88,7 +90,9 @@ discard block |
||
| 88 | 90 | */ |
| 89 | 91 | public function calculateY($imageResource) |
| 90 | 92 | { |
| 91 | - if (intval($this->_y) === $this->_y) return $this->_y; |
|
| 93 | + if (intval($this->_y) === $this->_y) { |
|
| 94 | + return $this->_y; |
|
| 95 | + } |
|
| 92 | 96 | |
| 93 | 97 | $y = strtolower($this->_y); |
| 94 | 98 | |
@@ -125,7 +129,9 @@ discard block |
||
| 125 | 129 | */ |
| 126 | 130 | public function GetWatermark() |
| 127 | 131 | { |
| 128 | - if ($this->_watermark == null) throw new \Exception('A watermark is not set. Please supply a \CloudControl\Cms\image\Image using $this->SetWatermark'); |
|
| 132 | + if ($this->_watermark == null) { |
|
| 133 | + throw new \Exception('A watermark is not set. Please supply a \CloudControl\Cms\image\Image using $this->SetWatermark'); |
|
| 134 | + } |
|
| 129 | 135 | return $this->_watermark; |
| 130 | 136 | } |
| 131 | 137 | |
@@ -38,7 +38,9 @@ |
||
| 38 | 38 | |
| 39 | 39 | // Define which ratio will be used, depending on which is the biggest side |
| 40 | 40 | $ratio = $wRatio < $hRatio ? $wRatio : $hRatio; |
| 41 | - if ($ratio < 1) $ratio = 1; |
|
| 41 | + if ($ratio < 1) { |
|
| 42 | + $ratio = 1; |
|
| 43 | + } |
|
| 42 | 44 | |
| 43 | 45 | // Calculate the destination width, height, x and y |
| 44 | 46 | $this->_destWidth = $originalWidth / $ratio; |