From 60614e47bea4c6f0052b1dbc330f30e850f246d7 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Wed, 13 Sep 2017 22:31:27 +0300 Subject: [PATCH] Code style changes and added travis build badge to README --- README.md | 2 +- src/ivuorinen/Palette/Palette.php | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 4086544..ff93af5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Palette +Palette [![Build Status](https://travis-ci.org/ivuorinen/palette.svg?branch=master)](https://travis-ci.org/ivuorinen/palette) ======= Palette is a PHP class that takes your images and returns used colors, sorts them by usage and saves the results. diff --git a/src/ivuorinen/Palette/Palette.php b/src/ivuorinen/Palette/Palette.php index acd75ce..b6a61f3 100644 --- a/src/ivuorinen/Palette/Palette.php +++ b/src/ivuorinen/Palette/Palette.php @@ -3,8 +3,6 @@ * Palette * Parses image and returns most used colors * - * PHP version 5 - * * MIT License * =========== * @@ -163,9 +161,9 @@ class Palette if (! empty($this->colorsArray) and is_array($this->colorsArray)) { return $this->colorsArray; - } else { - return false; } + + return false; } /** @@ -255,9 +253,8 @@ class Palette file_put_contents($this->destination, $colorsData); if (is_readable($this->destination)) { return true; - } else { - return false; } + return false; } /** @@ -323,11 +320,10 @@ class Palette // Test if we can write to it try { - if (! is_writable($destination_dir)) { - chmod($destination_dir, 0755); - } else { + if (is_writable($destination_dir)) { return true; } + chmod($destination_dir, 0755); if (! is_writable($destination_dir)) { throw new \Exception("Destination directory not writable: {$destination_dir}");