Merge remote-tracking branch 'origin/develop'
Some checks failed
timw4mail/HummingBirdAnimeClient/master There was a failure building this commit
Some checks failed
timw4mail/HummingBirdAnimeClient/master There was a failure building this commit
This commit is contained in:
commit
44ec41b0f7
@ -7,7 +7,6 @@ php:
|
|||||||
- 7.1
|
- 7.1
|
||||||
- 7.2
|
- 7.2
|
||||||
- 7.3
|
- 7.3
|
||||||
- hhvm
|
|
||||||
- nightly
|
- nightly
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
16
Jenkinsfile
vendored
16
Jenkinsfile
vendored
@ -33,5 +33,21 @@ pipeline {
|
|||||||
sh 'phpdbg -qrr -- ./vendor/bin/phpunit --coverage-text --colors=never'
|
sh 'phpdbg -qrr -- ./vendor/bin/phpunit --coverage-text --colors=never'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('PHP 7.3') {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'php:7.3-alpine'
|
||||||
|
args '-u root --privileged'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
sh 'chmod +x ./build/docker_install.sh'
|
||||||
|
sh 'sh build/docker_install.sh'
|
||||||
|
sh 'apk add --no-cache php7-phpdbg'
|
||||||
|
sh 'curl -sS https://getcomposer.org/installer | php'
|
||||||
|
sh 'php composer.phar install --ignore-platform-reqs'
|
||||||
|
sh 'phpdbg -qrr -- ./vendor/bin/phpunit --coverage-text --colors=never'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -269,11 +269,21 @@ final class Model
|
|||||||
*/
|
*/
|
||||||
private function getMediaIdFromMalId(string $malId, string $type = 'ANIME'): ?string
|
private function getMediaIdFromMalId(string $malId, string $type = 'ANIME'): ?string
|
||||||
{
|
{
|
||||||
|
if ($malId === '')
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
$info = $this->runQuery('MediaIdByMalId', [
|
$info = $this->runQuery('MediaIdByMalId', [
|
||||||
'id' => $malId,
|
'id' => $malId,
|
||||||
'type' => mb_strtoupper($type),
|
'type' => mb_strtoupper($type),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if (array_key_exists('errors', $info))
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return (string)$info['data']['Media']['id'];
|
return (string)$info['data']['Media']['id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -187,7 +187,7 @@ class Anime extends API {
|
|||||||
$requester = new ParallelAPIRequest();
|
$requester = new ParallelAPIRequest();
|
||||||
$requester->addRequest($this->kitsuModel->incrementListItem($data), 'kitsu');
|
$requester->addRequest($this->kitsuModel->incrementListItem($data), 'kitsu');
|
||||||
|
|
||||||
if ($this->anilistEnabled && $data['mal_id'] !== null)
|
if (( ! empty($data['mal_id'])) && $this->anilistEnabled)
|
||||||
{
|
{
|
||||||
$requester->addRequest($this->anilistModel->incrementListItem($data, 'ANIME'), 'anilist');
|
$requester->addRequest($this->anilistModel->incrementListItem($data, 'ANIME'), 'anilist');
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ class Anime extends API {
|
|||||||
$requester = new ParallelAPIRequest();
|
$requester = new ParallelAPIRequest();
|
||||||
$requester->addRequest($this->kitsuModel->updateListItem($data), 'kitsu');
|
$requester->addRequest($this->kitsuModel->updateListItem($data), 'kitsu');
|
||||||
|
|
||||||
if ($this->anilistEnabled && $data['mal_id'] !== null)
|
if (( ! empty($data['mal_id'])) && $this->anilistEnabled)
|
||||||
{
|
{
|
||||||
$requester->addRequest($this->anilistModel->updateListItem($data, 'ANIME'), 'anilist');
|
$requester->addRequest($this->anilistModel->updateListItem($data, 'ANIME'), 'anilist');
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,10 @@
|
|||||||
namespace Aviat\AnimeClient\Types;
|
namespace Aviat\AnimeClient\Types;
|
||||||
|
|
||||||
use ArrayAccess;
|
use ArrayAccess;
|
||||||
|
use ArrayObject;
|
||||||
|
use Countable;
|
||||||
|
|
||||||
abstract class AbstractType implements ArrayAccess {
|
abstract class AbstractType implements ArrayAccess, Countable {
|
||||||
/**
|
/**
|
||||||
* Populate values for un-serializing data
|
* Populate values for un-serializing data
|
||||||
*
|
*
|
||||||
@ -164,6 +166,17 @@ abstract class AbstractType implements ArrayAccess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementing Countable
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function count(): int
|
||||||
|
{
|
||||||
|
$keys = array_keys($this->toArray());
|
||||||
|
return count($keys);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively cast properties to an array
|
* Recursively cast properties to an array
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user