Fix some more code style issues
This commit is contained in:
parent
1de8b46657
commit
4937d4c099
4
.scrutinizer.yml
Normal file
4
.scrutinizer.yml
Normal file
@ -0,0 +1,4 @@
|
||||
# .scrutinizer.yml
|
||||
tools:
|
||||
external_code_coverage:
|
||||
timeout: 600 # Timeout in seconds.
|
@ -8,6 +8,7 @@
|
||||
<property name="phploc" value="phploc"/>
|
||||
<property name="phpmd" value="phpmd"/>
|
||||
<property name="phpunit" value="phpunit"/>
|
||||
<property name="sonar" value="sonar-runner"/>
|
||||
|
||||
<!-- Use this when the tools are located as PHARs in ${basedir}/build/tools
|
||||
<property name="pdepend" value="${basedir}/build/tools/pdepend.phar"/>
|
||||
@ -28,7 +29,7 @@
|
||||
<property name="phpunit" value="${basedir}/vendor/bin/phpunit"/> -->
|
||||
|
||||
<target name="full-build"
|
||||
depends="prepare,static-analysis,phpunit,phpdox,-check-failure"
|
||||
depends="prepare,static-analysis,phpunit,phpdox,sonar,-check-failure"
|
||||
description="Performs static analysis, runs the tests, and generates project documentation"/>
|
||||
|
||||
<target name="full-build-parallel"
|
||||
@ -231,6 +232,12 @@
|
||||
<property name="phpdox.done" value="true"/>
|
||||
</target>
|
||||
|
||||
<target name="sonar"
|
||||
depends="phpunit">
|
||||
<exec executable="${sonar}" taskname="sonar"/>
|
||||
<property name="sonar.done" value="true"/>
|
||||
</target>
|
||||
|
||||
<target name="-check-failure">
|
||||
<fail message="PHPUnit did not finish successfully">
|
||||
<condition>
|
||||
|
@ -2,3 +2,5 @@ sonar.projectKey=animeclient
|
||||
sonar.projectName=Anime Client
|
||||
sonar.projectVersion=1.0
|
||||
sonar.sources=src
|
||||
sonar.php.coverage.overallReportPath=build/logs/clover.xml
|
||||
sonar.php.tests.reportPath=build/logs/junit.xml
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user