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.

View File

@@ -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}");