From d3541da789c91509bfc3afd94d3fc1b91ce9e041 Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Thu, 5 Nov 2015 11:26:03 -0500 Subject: [PATCH] Fix some more code style issues --- .scrutinizer.yml | 4 +++ build.xml | 9 ++++++- sonar-project.properties | 4 ++- src/Aviat/AnimeClient/Model/API.php | 3 +-- .../AnimeClient/Model/AnimeCollection.php | 27 ++++++++++++++----- src/Aviat/AnimeClient/Model/Manga.php | 7 +++-- 6 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 .scrutinizer.yml diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 00000000..796747ee --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,4 @@ +# .scrutinizer.yml +tools: + external_code_coverage: + timeout: 600 # Timeout in seconds. \ No newline at end of file diff --git a/build.xml b/build.xml index 8f8c5151..dfcc88e3 100644 --- a/build.xml +++ b/build.xml @@ -8,6 +8,7 @@ + + + + + + diff --git a/sonar-project.properties b/sonar-project.properties index 22cbd0e3..f2bf2278 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,4 +1,6 @@ sonar.projectKey=animeclient sonar.projectName=Anime Client sonar.projectVersion=1.0 -sonar.sources=src \ No newline at end of file +sonar.sources=src +sonar.php.coverage.overallReportPath=build/logs/clover.xml +sonar.php.tests.reportPath=build/logs/junit.xml \ No newline at end of file diff --git a/src/Aviat/AnimeClient/Model/API.php b/src/Aviat/AnimeClient/Model/API.php index 3ec8c30b..335c1a29 100644 --- a/src/Aviat/AnimeClient/Model/API.php +++ b/src/Aviat/AnimeClient/Model/API.php @@ -94,8 +94,7 @@ class API extends BaseModel { } array_unshift($args, strtoupper($method)); - $response = call_user_func_array([$this->client, 'request'], $args); - return $response; + return call_user_func_array([$this->client, 'request'], $args); } /** diff --git a/src/Aviat/AnimeClient/Model/AnimeCollection.php b/src/Aviat/AnimeClient/Model/AnimeCollection.php index 1af4b862..ee7f8250 100644 --- a/src/Aviat/AnimeClient/Model/AnimeCollection.php +++ b/src/Aviat/AnimeClient/Model/AnimeCollection.php @@ -75,7 +75,10 @@ class AnimeCollection extends DB { ->join('genres g', 'g.id=gl.genre_id', 'left'); - if ( ! empty($filter)) $this->db->where_in('hummingbird_id', $filter); + if ( ! empty($filter)) + { + $this->db->where_in('hummingbird_id', $filter); + } $query = $this->db->order_by('hummingbird_id') ->order_by('genre') @@ -89,8 +92,10 @@ class AnimeCollection extends DB { $genre = $row['genre']; // Empty genre names aren't useful - if (empty($genre)) continue; - + if (empty($genre)) + { + continue; + } if (array_key_exists($id, $output)) { @@ -174,7 +179,10 @@ class AnimeCollection extends DB { */ private function _get_collection() { - if ( ! $this->valid_database) return []; + if ( ! $this->valid_database) + { + return []; + } $query = $this->db->select('hummingbird_id, slug, title, alternate_title, show_type, age_rating, episode_count, episode_length, cover_image, notes, media.type as media') @@ -225,7 +233,10 @@ class AnimeCollection extends DB { public function update($data) { // If there's no id to update, don't update - if ( ! array_key_exists('hummingbird_id', $data)) return; + if ( ! array_key_exists('hummingbird_id', $data)) + { + return; + } $id = $data['hummingbird_id']; unset($data['hummingbird_id']); @@ -257,8 +268,10 @@ class AnimeCollection extends DB { */ private function json_import() { - if ( ! file_exists('import.json')) return; - if ( ! $this->valid_database) return; + if ( ! file_exists('import.json') || ! $this->valid_database) + { + return; + } $anime = json_decode(file_get_contents("import.json")); diff --git a/src/Aviat/AnimeClient/Model/Manga.php b/src/Aviat/AnimeClient/Model/Manga.php index d80601b2..d03f2922 100644 --- a/src/Aviat/AnimeClient/Model/Manga.php +++ b/src/Aviat/AnimeClient/Model/Manga.php @@ -66,7 +66,7 @@ class Manga extends API { { $data = $this->_get_list_from_api(); - foreach ($data as $key => &$val) + foreach ($data as &$val) { $this->sort_by_name($val); } @@ -121,7 +121,10 @@ class Manga extends API { { // Bail out early if there isn't any manga data $api_data = json_decode($response->getBody(), TRUE); - if ( ! array_key_exists('manga', $api_data)) return []; + if ( ! array_key_exists('manga', $api_data)) + { + return []; + } $cache_file = _dir($this->config->get('data_cache_path'), 'manga.json'); $transformed_cache_file = _dir($this->config->get('data_cache_path'), 'manga-transformed.json');