Various code tweaks

This commit is contained in:
Timothy Warren 2020-05-01 19:38:45 -04:00
parent 03638991a3
commit 75bd011a2c
5 changed files with 34 additions and 6 deletions

View File

@ -29,7 +29,7 @@ class AnimeListTransformer extends AbstractTransformer {
public function transform($item): AnimeListItem
{
return new AnimeListItem([]);
return AnimeListItem::from([]);
}
/**

View File

@ -176,7 +176,7 @@ trait KitsuTrait {
$logger->warning('Non 200 response for api call', (array)$response);
}
// throw new FailedResponseException('Failed to get the proper response from the API');
throw new FailedResponseException('Failed to get the proper response from the API');
}
try

View File

@ -0,0 +1,27 @@
<?php declare(strict_types=1);
/**
* Hummingbird Anime List Client
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 7.4
*
* @package HummingbirdAnimeClient
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2020 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5
* @link https://git.timshomepage.net/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\AnimeClient\Enum;
use Aviat\Ion\Enum as BaseEnum;
/**
* Types of lists
*/
final class APISource extends BaseEnum {
public const KITSU = 'kitsu';
public const ANILIST = 'anilist';
}

View File

@ -26,7 +26,7 @@ trait ContainerAware {
*
* @var ContainerInterface
*/
protected $container;
protected ContainerInterface $container;
/**
* Set the container for the current object

View File

@ -17,6 +17,7 @@
namespace Aviat\Ion;
use ReflectionClass;
use ReflectionException;
/**
* Class emulating an enumeration type
@ -27,7 +28,7 @@ abstract class Enum {
* Return the list of constant values for the Enum
*
* @return array
* @throws \ReflectionException
* @throws ReflectionException
*/
public static function getConstList(): array
{
@ -48,12 +49,12 @@ abstract class Enum {
*
* @param mixed $key
* @return boolean
* @throws \ReflectionException
* @throws ReflectionException
*/
public static function isValid($key): bool
{
$values = array_values(static::getConstList());
return \in_array($key, $values, TRUE);
return in_array($key, $values, TRUE);
}
}
// End of Enum.php