Code style changes and added travis build badge to README

This commit is contained in:
Ismo Vuorinen
2017-09-13 22:31:27 +03:00
parent 6c1dca08da
commit 60614e47be
2 changed files with 6 additions and 10 deletions

View File

@@ -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. Palette is a PHP class that takes your images and returns used colors, sorts them by usage and saves the results.

View File

@@ -3,8 +3,6 @@
* Palette * Palette
* Parses image and returns most used colors * Parses image and returns most used colors
* *
* PHP version 5
*
* MIT License * MIT License
* =========== * ===========
* *
@@ -163,9 +161,9 @@ class Palette
if (! empty($this->colorsArray) and is_array($this->colorsArray)) { if (! empty($this->colorsArray) and is_array($this->colorsArray)) {
return $this->colorsArray; return $this->colorsArray;
} else {
return false;
} }
return false;
} }
/** /**
@@ -255,9 +253,8 @@ class Palette
file_put_contents($this->destination, $colorsData); file_put_contents($this->destination, $colorsData);
if (is_readable($this->destination)) { if (is_readable($this->destination)) {
return true; return true;
} else {
return false;
} }
return false;
} }
/** /**
@@ -323,11 +320,10 @@ class Palette
// Test if we can write to it // Test if we can write to it
try { try {
if (! is_writable($destination_dir)) { if (is_writable($destination_dir)) {
chmod($destination_dir, 0755);
} else {
return true; return true;
} }
chmod($destination_dir, 0755);
if (! is_writable($destination_dir)) { if (! is_writable($destination_dir)) {
throw new \Exception("Destination directory not writable: {$destination_dir}"); throw new \Exception("Destination directory not writable: {$destination_dir}");