@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * Loop through sitemap items and see if one matches the requestUri. |
| 89 | 89 | * If it does, add it tot the matchedSitemapItems array |
| 90 | 90 | * |
| 91 | - * @param $request |
|
| 91 | + * @param Request $request |
|
| 92 | 92 | */ |
| 93 | 93 | private function sitemapMatching($request) |
| 94 | 94 | { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @param string $template |
| 151 | 151 | * @param array $parameters |
| 152 | 152 | * |
| 153 | - * @return mixed |
|
| 153 | + * @return Component |
|
| 154 | 154 | * @throws \Exception |
| 155 | 155 | */ |
| 156 | 156 | private function getComponentObject($class='', $template='', $parameters=array(), $matchedSitemapItem) |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * @param array $replace |
| 112 | 112 | * @param string $delimiter |
| 113 | 113 | * |
| 114 | - * @return mixed|string |
|
| 114 | + * @return string |
|
| 115 | 115 | */ |
| 116 | 116 | function slugify($str, $replace=array(), $delimiter='-') { |
| 117 | 117 | if( !empty($replace) ) { |
@@ -130,7 +130,6 @@ discard block |
||
| 130 | 130 | * Dumps a var_dump of the passed arguments with <pre> tags surrounding it. |
| 131 | 131 | * Dies afterwards |
| 132 | 132 | * |
| 133 | - * @param mixed $data The data to be displayed |
|
| 134 | 133 | */ |
| 135 | 134 | function dump() |
| 136 | 135 | { |
@@ -61,12 +61,15 @@ |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | function humanFileSize($size,$unit="") { |
| 64 | - if( (!$unit && $size >= 1<<30) || $unit == "GB") |
|
| 65 | - return number_format($size/(1<<30),2)."GB"; |
|
| 66 | - if( (!$unit && $size >= 1<<20) || $unit == "MB") |
|
| 67 | - return number_format($size/(1<<20),2)."MB"; |
|
| 68 | - if( (!$unit && $size >= 1<<10) || $unit == "KB") |
|
| 69 | - return number_format($size/(1<<10),2)."KB"; |
|
| 64 | + if( (!$unit && $size >= 1<<30) || $unit == "GB") { |
|
| 65 | + return number_format($size/(1<<30),2)."GB"; |
|
| 66 | + } |
|
| 67 | + if( (!$unit && $size >= 1<<20) || $unit == "MB") { |
|
| 68 | + return number_format($size/(1<<20),2)."MB"; |
|
| 69 | + } |
|
| 70 | + if( (!$unit && $size >= 1<<10) || $unit == "KB") { |
|
| 71 | + return number_format($size/(1<<10),2)."KB"; |
|
| 72 | + } |
|
| 70 | 73 | return number_format($size)." bytes"; |
| 71 | 74 | } |
| 72 | 75 | |
@@ -73,6 +73,7 @@ discard block |
||
| 73 | 73 | * @see http://www.php.net/manual/en/function.image-type-to-mime-type.php |
| 74 | 74 | * @param string $imagePath |
| 75 | 75 | * @param bool $getExtension |
| 76 | + * @return integer |
|
| 76 | 77 | */ |
| 77 | 78 | public function GetImageMimeType($imagePath, $getExtension = false) |
| 78 | 79 | { |
@@ -93,7 +94,7 @@ discard block |
||
| 93 | 94 | * |
| 94 | 95 | * @see http://www.php.net/manual/en/function.imagecreatefromwbmp.php#86214 |
| 95 | 96 | * @author alexander at alexauto dot nl |
| 96 | - * @param string $imagePath |
|
| 97 | + * @param string $p_sFile |
|
| 97 | 98 | * @return resource |
| 98 | 99 | */ |
| 99 | 100 | public function CreateImageFromBmp($p_sFile) |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | return imagejpeg($imageResource, $path, $quality); |
| 60 | 60 | } elseif ($mimeTypeConstantValue == IMAGETYPE_PNG) { |
| 61 | 61 | return imagepng($imageResource, $path, (intval($quality / 10) -1)); |
| 62 | - } |
|
| 63 | - else { |
|
| 62 | + } else { |
|
| 64 | 63 | throw new \Exception('Not a valid mimetypeconstant given see function documentation'); |
| 65 | 64 | } |
| 66 | 65 | return false; |
@@ -101,8 +100,9 @@ discard block |
||
| 101 | 100 | // Load the image into a string |
| 102 | 101 | $file = fopen($p_sFile,"rb"); |
| 103 | 102 | $read = fread($file,10); |
| 104 | - while(!feof($file)&&($read<>"")) |
|
| 105 | - $read .= fread($file,1024); |
|
| 103 | + while(!feof($file)&&($read<>"")) { |
|
| 104 | + $read .= fread($file,1024); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | $temp = unpack("H*",$read); |
| 108 | 108 | $hex = $temp[1]; |
@@ -153,8 +153,9 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | // If padding needed, ignore image-padding |
| 155 | 155 | // Shift i to the ending of the current 32-bit-block |
| 156 | - if ($usePadding) |
|
| 157 | - $i += $width%4; |
|
| 156 | + if ($usePadding) { |
|
| 157 | + $i += $width%4; |
|
| 158 | + } |
|
| 158 | 159 | |
| 159 | 160 | // Reset horizontal position |
| 160 | 161 | $x = 0; |
@@ -163,8 +164,9 @@ discard block |
||
| 163 | 164 | $y++; |
| 164 | 165 | |
| 165 | 166 | // Reached the image-height? Break the for-loop |
| 166 | - if ($y>$height) |
|
| 167 | - break; |
|
| 167 | + if ($y>$height) { |
|
| 168 | + break; |
|
| 169 | + } |
|
| 168 | 170 | } |
| 169 | 171 | |
| 170 | 172 | // Calculation of the RGB-pixel (defined as BGR in image-data) |
@@ -24,6 +24,9 @@ discard block |
||
| 24 | 24 | $this->imageSet = $imageSet; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | + /** |
|
| 28 | + * @param string $imagePath |
|
| 29 | + */ |
|
| 27 | 30 | public function applyImageSetToImage($imagePath) |
| 28 | 31 | { |
| 29 | 32 | $returnFileNames = array(); |
@@ -104,6 +107,12 @@ discard block |
||
| 104 | 107 | } |
| 105 | 108 | } |
| 106 | 109 | |
| 110 | + /** |
|
| 111 | + * @param string $imagePath |
|
| 112 | + * @param string $modifier |
|
| 113 | + * |
|
| 114 | + * @return string |
|
| 115 | + */ |
|
| 107 | 116 | private function modifyName($imagePath, $modifier) |
| 108 | 117 | { |
| 109 | 118 | $filename = basename($imagePath); |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | /** |
| 57 | 57 | * Use build-in logic to position the x of watermark |
| 58 | 58 | * |
| 59 | - * @param string $x |
|
| 60 | - * @return self |
|
| 59 | + * @param resource $imageResource |
|
| 60 | + * @return integer |
|
| 61 | 61 | */ |
| 62 | 62 | protected function calculateX($imageResource) |
| 63 | 63 | { |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | /** |
| 82 | 82 | * Use build-in logic to position the y of watermark |
| 83 | 83 | * |
| 84 | - * @param string $y |
|
| 85 | - * @return self |
|
| 84 | + * @param resource $imageResource |
|
| 85 | + * @return integer |
|
| 86 | 86 | */ |
| 87 | 87 | public function calculateY($imageResource) |
| 88 | 88 | { |
@@ -131,6 +131,7 @@ discard block |
||
| 131 | 131 | * Set the x |
| 132 | 132 | * |
| 133 | 133 | * @param int | string $x |
| 134 | + * @param string $x |
|
| 134 | 135 | * @return self |
| 135 | 136 | */ |
| 136 | 137 | public function SetX($x) |
@@ -143,6 +144,7 @@ discard block |
||
| 143 | 144 | * Set the y |
| 144 | 145 | * |
| 145 | 146 | * @param int | string $y |
| 147 | + * @param string $y |
|
| 146 | 148 | * @return self |
| 147 | 149 | */ |
| 148 | 150 | public function SetY($y) |
@@ -61,7 +61,9 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | protected function calculateX($imageResource) |
| 63 | 63 | { |
| 64 | - if (intval($this->_x) === $this->_x) return $this->_x; |
|
| 64 | + if (intval($this->_x) === $this->_x) { |
|
| 65 | + return $this->_x; |
|
| 66 | + } |
|
| 65 | 67 | |
| 66 | 68 | $x = strtolower($this->_x); |
| 67 | 69 | |
@@ -86,7 +88,9 @@ discard block |
||
| 86 | 88 | */ |
| 87 | 89 | public function calculateY($imageResource) |
| 88 | 90 | { |
| 89 | - if (intval($this->_y) === $this->_y) return $this->_y; |
|
| 91 | + if (intval($this->_y) === $this->_y) { |
|
| 92 | + return $this->_y; |
|
| 93 | + } |
|
| 90 | 94 | |
| 91 | 95 | $y = strtolower($this->_y); |
| 92 | 96 | |
@@ -123,7 +127,9 @@ discard block |
||
| 123 | 127 | */ |
| 124 | 128 | public function GetWatermark() |
| 125 | 129 | { |
| 126 | - if ($this->_watermark == null) throw new \Exception('A watermark is not set. Please supply a \library\image\Image using $this->SetWatermark'); |
|
| 130 | + if ($this->_watermark == null) { |
|
| 131 | + throw new \Exception('A watermark is not set. Please supply a \library\image\Image using $this->SetWatermark'); |
|
| 132 | + } |
|
| 127 | 133 | return $this->_watermark; |
| 128 | 134 | } |
| 129 | 135 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * JsonStorage constructor. |
| 19 | 19 | * |
| 20 | - * @param $storagePath |
|
| 20 | + * @param string $storagePath |
|
| 21 | 21 | */ |
| 22 | 22 | public function __construct($storagePath) |
| 23 | 23 | { |
@@ -837,6 +837,9 @@ discard block |
||
| 837 | 837 | } |
| 838 | 838 | } |
| 839 | 839 | |
| 840 | + /** |
|
| 841 | + * @param string $path |
|
| 842 | + */ |
|
| 840 | 843 | private function validateFilename($filename, $path) |
| 841 | 844 | { |
| 842 | 845 | $fileParts = explode('.', $filename); |
@@ -9,8 +9,10 @@ |
||
| 9 | 9 | <? if (isset($dynamicBrick)) : |
| 10 | 10 | $fieldSlug = $field->slug; |
| 11 | 11 | $value = isset($dynamicBrick->fields->$fieldSlug) ? current($dynamicBrick->fields->$fieldSlug) : ''; |
| 12 | - else : |
|
| 12 | + else { |
|
| 13 | + : |
|
| 13 | 14 | $value = ''; |
| 15 | + } |
|
| 14 | 16 | endif ?> |
| 15 | 17 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
| 16 | 18 | <ul class="grid-wrapper sortable"> |
@@ -45,8 +45,10 @@ discard block |
||
| 45 | 45 | <? if (isset($document)) : |
| 46 | 46 | $fieldSlug = $field->slug; |
| 47 | 47 | $value = isset($document->fields->$fieldSlug) ? current($document->fields->$fieldSlug) : ''; |
| 48 | - else : |
|
| 48 | + else { |
|
| 49 | + : |
|
| 49 | 50 | $value = ''; |
| 51 | + } |
|
| 50 | 52 | endif ?> |
| 51 | 53 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
| 52 | 54 | <ul class="grid-wrapper sortable"> |
@@ -138,8 +140,10 @@ discard block |
||
| 138 | 140 | $brickSlug = $brick->slug; |
| 139 | 141 | $fieldSlug = $field->slug; |
| 140 | 142 | $value = isset($document->bricks->$brickSlug->fields->$fieldSlug) ? current($document->bricks->$brickSlug->fields->$fieldSlug) : ''; |
| 141 | - else : |
|
| 143 | + else { |
|
| 144 | + : |
|
| 142 | 145 | $value = ''; |
| 146 | + } |
|
| 143 | 147 | endif ?> |
| 144 | 148 | <? if ($field->multiple == true && $field->type != 'Rich Text') : ?> |
| 145 | 149 | <ul class="grid-wrapper sortable"> |
@@ -26,7 +26,9 @@ |
||
| 26 | 26 | |
| 27 | 27 | // Define which ratio will be used, depending on which is the smallest side |
| 28 | 28 | $ratio = min($hRatio, $wRatio); |
| 29 | - if($ratio > 1) $ratio = 1; |
|
| 29 | + if($ratio > 1) { |
|
| 30 | + $ratio = 1; |
|
| 31 | + } |
|
| 30 | 32 | |
| 31 | 33 | // Define sizes |
| 32 | 34 | $this->_destWidth = floor($originalWidth * $ratio); |