Skip to content

Commit

Permalink
Add StyleCI to check PSR-2 coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
peter279k committed May 11, 2019
1 parent 9e90d32 commit ca5abf2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
preset: psr2
15 changes: 8 additions & 7 deletions src/ImageConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ private function saveImage($to, $image, $quality)
}


if(isset($quality) && !is_int($quality)) {
throw new \InvalidArgumentException(sprintf('The %s quality has to be an integer', $quality));
if (isset($quality) && !is_int($quality)) {
throw new \InvalidArgumentException(sprintf('The %s quality has to be an integer', $quality));
}

switch ($extension) {
Expand All @@ -100,7 +100,7 @@ private function saveImage($to, $image, $quality)
throw new \InvalidArgumentException(sprintf('The %s quality is out of range', $quality));
}
$image = imagejpeg($image, $to, $quality);
break;
break;
case 'png':
if ($quality < -1 && $quality > 9) {
throw new \InvalidArgumentException(sprintf('The %s quality is out of range', $quality));
Expand Down Expand Up @@ -179,7 +179,8 @@ private function makeDirectory($to)
* @return resource
* @throws \InvalidArgumentException
*/
function convert($from, $to, $quality = null) {
$converter = new ImageConverter();
return $converter->convert($from, $to, $quality);
}
function convert($from, $to, $quality = null)
{
$converter = new ImageConverter();
return $converter->convert($from, $to, $quality);
}

0 comments on commit ca5abf2

Please sign in to comment.