Version 5.1 - All the GraphQL #32
@ -15,7 +15,7 @@ class HummingbirdAuth {
|
|||||||
/**
|
/**
|
||||||
* Anime API Model
|
* Anime API Model
|
||||||
*
|
*
|
||||||
* @var AnimeModel
|
* @var \Aviat\AnimeClient\Model\API
|
||||||
*/
|
*/
|
||||||
protected $model;
|
protected $model;
|
||||||
|
|
||||||
@ -48,7 +48,8 @@ class HummingbirdAuth {
|
|||||||
*/
|
*/
|
||||||
public function authenticate($password)
|
public function authenticate($password)
|
||||||
{
|
{
|
||||||
$username = $this->config->get('hummingbird_username');
|
$username = $this->container->get('config')
|
||||||
|
->get('hummingbird_username');
|
||||||
$auth_token = $this->model->authenticate($username, $password);
|
$auth_token = $this->model->authenticate($username, $password);
|
||||||
|
|
||||||
if (FALSE !== $auth_token)
|
if (FALSE !== $auth_token)
|
||||||
@ -62,7 +63,7 @@ class HummingbirdAuth {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the current user is authenticated
|
* Check whether the current user is authenticated
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function is_authenticated()
|
public function is_authenticated()
|
||||||
|
@ -84,10 +84,8 @@ class Config {
|
|||||||
{
|
{
|
||||||
$this->map->set($key, $value);
|
$this->map->set($key, $value);
|
||||||
}
|
}
|
||||||
else
|
else throw
|
||||||
{
|
new InvalidArgumentException("Key must be integer, string, or array, and cannot be empty");
|
||||||
throw new InvalidArgumentException("Key must be integer, string, or array, and cannot be empty");
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ use Aviat\Ion\Di\ContainerInterface;
|
|||||||
use Aviat\AnimeClient\Controller as BaseController;
|
use Aviat\AnimeClient\Controller as BaseController;
|
||||||
use Aviat\AnimeClient\Hummingbird\Enum\AnimeWatchingStatus;
|
use Aviat\AnimeClient\Hummingbird\Enum\AnimeWatchingStatus;
|
||||||
use Aviat\AnimeClient\Model\Anime as AnimeModel;
|
use Aviat\AnimeClient\Model\Anime as AnimeModel;
|
||||||
use Aviat\AnimeClient\Model\AnimeCollection as AnimeCollectionModel;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for Anime-related pages
|
* Controller for Anime-related pages
|
||||||
@ -22,12 +21,6 @@ class Anime extends BaseController {
|
|||||||
*/
|
*/
|
||||||
protected $model;
|
protected $model;
|
||||||
|
|
||||||
/**
|
|
||||||
* The anime collection model
|
|
||||||
* @var object $collection_model
|
|
||||||
*/
|
|
||||||
private $collection_model;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data to ve sent to all routes in this controller
|
* Data to ve sent to all routes in this controller
|
||||||
* @var array $base_data
|
* @var array $base_data
|
||||||
@ -44,7 +37,6 @@ class Anime extends BaseController {
|
|||||||
parent::__construct($container);
|
parent::__construct($container);
|
||||||
|
|
||||||
$this->model = new AnimeModel($container);
|
$this->model = new AnimeModel($container);
|
||||||
$this->collection_model = new AnimeCollectionModel($container);
|
|
||||||
$this->base_data = array_merge($this->base_data, [
|
$this->base_data = array_merge($this->base_data, [
|
||||||
'menu_name' => 'anime_list',
|
'menu_name' => 'anime_list',
|
||||||
'message' => '',
|
'message' => '',
|
||||||
|
@ -53,7 +53,7 @@ class Anime extends API {
|
|||||||
'body' => $data
|
'body' => $data
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return json_decode($result->getBody(), TRUE);
|
return json_decode($response->getBody(), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +44,7 @@ class AnimeCollection extends DB {
|
|||||||
{
|
{
|
||||||
if ( ! file_exists($db_file_name))
|
if ( ! file_exists($db_file_name))
|
||||||
{
|
{
|
||||||
$this->valid_data = FALSE;
|
$this->valid_database = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user