Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
6 changed files with 42 additions and 44 deletions
Showing only changes of commit e5db6bebe8 - Show all commits

View File

@ -21,10 +21,8 @@ namespace Aviat\AnimeClient\Command;
*/ */
class ClearCache extends BaseCommand { class ClearCache extends BaseCommand {
/** /**
* Run the image conversion script * Clear the API cache
* *
* @param array $args
* @param array $options
* @return void * @return void
* @throws \ConsoleKit\ConsoleException * @throws \ConsoleKit\ConsoleException
*/ */

View File

@ -77,7 +77,7 @@ class Controller {
* Common data to be sent to views * Common data to be sent to views
* @var array * @var array
*/ */
protected $base_data = [ protected $baseData = [
'url_type' => 'anime', 'url_type' => 'anime',
'other_type' => 'manga', 'other_type' => 'manga',
'menu_name' => '' 'menu_name' => ''
@ -97,10 +97,10 @@ class Controller {
$this->config = $container->get('config'); $this->config = $container->get('config');
$this->request = $container->get('request'); $this->request = $container->get('request');
$this->response = $container->get('response'); $this->response = $container->get('response');
$this->base_data['url'] = $auraUrlGenerator; $this->baseData['url'] = $auraUrlGenerator;
$this->base_data['urlGenerator'] = $urlGenerator; $this->baseData['urlGenerator'] = $urlGenerator;
$this->base_data['auth'] = $container->get('auth'); $this->baseData['auth'] = $container->get('auth');
$this->base_data['config'] = $this->config; $this->baseData['config'] = $this->config;
$this->urlGenerator = $urlGenerator; $this->urlGenerator = $urlGenerator;
$session = $container->get('session'); $session = $container->get('session');
@ -114,7 +114,7 @@ class Controller {
} }
// Set a message box if available // Set a message box if available
$this->base_data['message'] = $this->session->getFlash('message'); $this->baseData['message'] = $this->session->getFlash('message');
} }
/** /**
@ -225,9 +225,9 @@ class Controller {
{ {
$router = $this->container->get('dispatcher'); $router = $this->container->get('dispatcher');
if (isset($this->base_data)) if (isset($this->baseData))
{ {
$data = array_merge($this->base_data, $data); $data = array_merge($this->baseData, $data);
} }
$route = $router->getRoute(); $route = $router->getRoute();
@ -338,19 +338,19 @@ class Controller {
/** /**
* Display a generic error page * Display a generic error page
* *
* @param int $http_code * @param int $httpCode
* @param string $title * @param string $title
* @param string $message * @param string $message
* @param string $long_message * @param string $long_message
* @return void * @return void
*/ */
public function errorPage($http_code, $title, $message, $long_message = "") public function errorPage($httpCode, $title, $message, $long_message = "")
{ {
$this->outputHTML('error', [ $this->outputHTML('error', [
'title' => $title, 'title' => $title,
'message' => $message, 'message' => $message,
'long_message' => $long_message 'long_message' => $long_message
], NULL, $http_code); ], NULL, $httpCode);
} }
/** /**

View File

@ -39,9 +39,9 @@ class Anime extends BaseController {
/** /**
* Data to be sent to all routes in this controller * Data to be sent to all routes in this controller
* @var array $base_data * @var array $baseData
*/ */
protected $base_data; protected $baseData;
/** /**
* Data cache * Data cache
@ -60,7 +60,7 @@ class Anime extends BaseController {
$this->model = $container->get('anime-model'); $this->model = $container->get('anime-model');
$this->base_data = array_merge($this->base_data, [ $this->baseData = array_merge($this->baseData, [
'menu_name' => 'anime_list', 'menu_name' => 'anime_list',
'url_type' => 'anime', 'url_type' => 'anime',
'other_type' => 'manga', 'other_type' => 'manga',
@ -179,13 +179,13 @@ class Anime extends BaseController {
public function edit($id, $status = "all") public function edit($id, $status = "all")
{ {
$item = $this->model->getLibraryItem($id, $status); $item = $this->model->getLibraryItem($id, $status);
$raw_status_list = AnimeWatchingStatus::getConstList(); $rawStatusList = AnimeWatchingStatus::getConstList();
$statuses = []; $statuses = [];
foreach ($raw_status_list as $status_item) foreach ($rawStatusList as $statusItem)
{ {
$statuses[$status_item] = (string) $this->string($status_item) $statuses[$statusItem] = (string) $this->string($statusItem)
->underscored() ->underscored()
->humanize() ->humanize()
->titleize(); ->titleize();

View File

@ -29,21 +29,21 @@ class Collection extends BaseController {
/** /**
* The anime collection model * The anime collection model
* @var AnimeCollectionModel $anime_collection_model * @var AnimeCollectionModel $animeCollectionModel
*/ */
private $anime_collection_model; private $animeCollectionModel;
/** /**
* The anime API model * The anime API model
* @var AnimeModel $anime_model * @var AnimeModel $animeModel
*/ */
private $anime_model; private $animeModel;
/** /**
* Data to ve sent to all routes in this controller * Data to be sent to all routes in this controller
* @var array $base_data * @var array $baseData
*/ */
protected $base_data; protected $baseData;
/** /**
* Url Generator class * Url Generator class
@ -61,9 +61,9 @@ class Collection extends BaseController {
parent::__construct($container); parent::__construct($container);
$this->urlGenerator = $container->get('url-generator'); $this->urlGenerator = $container->get('url-generator');
$this->anime_model = $container->get('anime-model'); $this->animeModel = $container->get('anime-model');
$this->anime_collection_model = $container->get('anime-collection-model'); $this->animeCollectionModel = $container->get('anime-collection-model');
$this->base_data = array_merge($this->base_data, [ $this->baseData = array_merge($this->baseData, [
'menu_name' => 'collection', 'menu_name' => 'collection',
'url_type' => 'anime', 'url_type' => 'anime',
'other_type' => 'manga', 'other_type' => 'manga',
@ -80,7 +80,7 @@ class Collection extends BaseController {
{ {
$queryParams = $this->request->getQueryParams(); $queryParams = $this->request->getQueryParams();
$query = $queryParams['query']; $query = $queryParams['query'];
$this->outputJSON($this->anime_model->search($query)); $this->outputJSON($this->animeModel->search($query));
} }
/** /**
@ -96,12 +96,12 @@ class Collection extends BaseController {
'list' => 'list' 'list' => 'list'
]; ];
$data = $this->anime_collection_model->get_collection(); $data = $this->animeCollectionModel->get_collection();
$this->outputHTML('collection/' . $view_map[$view], [ $this->outputHTML('collection/' . $view_map[$view], [
'title' => $this->config->get('whose_list') . "'s Anime Collection", 'title' => $this->config->get('whose_list') . "'s Anime Collection",
'sections' => $data, 'sections' => $data,
'genres' => $this->anime_collection_model->get_genre_list() 'genres' => $this->animeCollectionModel->get_genre_list()
]); ]);
} }
@ -121,8 +121,8 @@ class Collection extends BaseController {
'action' => $action, 'action' => $action,
'action_url' => $this->urlGenerator->full_url('collection/' . strtolower($action)), 'action_url' => $this->urlGenerator->full_url('collection/' . strtolower($action)),
'title' => $this->config->get('whose_list') . " Anime Collection · {$action}", 'title' => $this->config->get('whose_list') . " Anime Collection · {$action}",
'media_items' => $this->anime_collection_model->get_media_type_list(), 'media_items' => $this->animeCollectionModel->get_media_type_list(),
'item' => ($action === "Edit") ? $this->anime_collection_model->get($id) : [] 'item' => ($action === "Edit") ? $this->animeCollectionModel->get($id) : []
]); ]);
} }
@ -136,7 +136,7 @@ class Collection extends BaseController {
$data = $this->request->getParsedBody(); $data = $this->request->getParsedBody();
if (array_key_exists('hummingbird_id', $data)) if (array_key_exists('hummingbird_id', $data))
{ {
$this->anime_collection_model->update($data); $this->animeCollectionModel->update($data);
$this->set_flash_message('Successfully updated collection item.', 'success'); $this->set_flash_message('Successfully updated collection item.', 'success');
} }
else else
@ -157,7 +157,7 @@ class Collection extends BaseController {
$data = $this->request->getParsedBody(); $data = $this->request->getParsedBody();
if (array_key_exists('id', $data)) if (array_key_exists('id', $data))
{ {
$this->anime_collection_model->add($data); $this->animeCollectionModel->add($data);
$this->set_flash_message('Successfully added collection item', 'success'); $this->set_flash_message('Successfully added collection item', 'success');
} }
else else
@ -181,7 +181,7 @@ class Collection extends BaseController {
$this->redirect("/collection/view", 303); $this->redirect("/collection/view", 303);
} }
$this->anime_collection_model->delete($data); $this->animeCollectionModel->delete($data);
$this->set_flash_message("Successfully removed anime from collection.", 'success'); $this->set_flash_message("Successfully removed anime from collection.", 'success');
$this->redirect("/collection/view", 303); $this->redirect("/collection/view", 303);

View File

@ -39,9 +39,9 @@ class Manga extends Controller {
/** /**
* 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 $baseData
*/ */
protected $base_data; protected $baseData;
/** /**
* Constructor * Constructor
@ -53,7 +53,7 @@ class Manga extends Controller {
parent::__construct($container); parent::__construct($container);
$this->model = $container->get('manga-model'); $this->model = $container->get('manga-model');
$this->base_data = array_merge($this->base_data, [ $this->baseData = array_merge($this->baseData, [
'menu_name' => 'manga_list', 'menu_name' => 'manga_list',
'config' => $this->config, 'config' => $this->config,
'url_type' => 'manga', 'url_type' => 'manga',

View File

@ -28,13 +28,13 @@ class Menu {
/** /**
* Create the html for the selected menu * Create the html for the selected menu
* *
* @param string $menu_name * @param string $menuName
* @return string * @return string
*/ */
public function __invoke($menu_name) public function __invoke($menuName)
{ {
$generator = new MenuGenerator($this->container); $generator = new MenuGenerator($this->container);
return $generator->generate($menu_name); return $generator->generate($menuName);
} }
} }