Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
Scrutinizer Auto-Fixer 2015-10-06 14:24:48 +00:00
parent 5e5434d057
commit 7c5a73e73b
22 changed files with 59 additions and 59 deletions

View File

@ -33,7 +33,7 @@ $di = function() {
// Set up json handler for ajax errors
$jsonHandler = new JsonResponseHandler();
$jsonHandler->onlyForAjaxRequests(true);
$jsonHandler->onlyForAjaxRequests(TRUE);
$whoops->pushHandler($jsonHandler);
$whoops->register();

View File

@ -35,7 +35,7 @@ function _dir()
* @codeCoverageIgnore
* @return void
*/
spl_autoload_register(function ($class) {
spl_autoload_register(function($class) {
$class_parts = explode('\\', $class);
$ns_path = SRC_DIR . '/' . implode('/', $class_parts) . ".php";

View File

@ -22,7 +22,7 @@ class Config {
*
* @param array $config_files
*/
public function __construct(Array $config_files=[])
public function __construct(array $config_files=[])
{
// @codeCoverageIgnoreStart
if (empty($config_files))

View File

@ -53,7 +53,7 @@ class Controller {
/**
* Constructor
*
* @param Container $container
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{
@ -92,7 +92,7 @@ class Controller {
* @param array|object $data
* @return string
*/
public function load_partial($view, $template, $data=[])
public function load_partial($view, $template, $data = [])
{
$errorHandler = $this->container->get('error-handler');
$errorHandler->addDataTable('Template Data', $data);
@ -120,7 +120,7 @@ class Controller {
/**
* Render a template with header and footer
*
* @param HTMLView $view
* @param HtmlView $view
* @param string $template
* @param array|object $data
* @return void
@ -139,7 +139,7 @@ class Controller {
* @param array|object $data
* @return void
*/
public function outputHTML($template, $data=[])
public function outputHTML($template, $data = [])
{
$view = new HtmlView($this->container);
$this->render_full_page($view, $template, $data);
@ -151,7 +151,7 @@ class Controller {
* @param mixed $data
* @return void
*/
public function outputJSON($data=[])
public function outputJSON($data = [])
{
$view = new JsonView($this->container);
$view->setOutput($data);
@ -165,7 +165,7 @@ class Controller {
* @param string $type
* @return void
*/
public function redirect($path, $code, $type="anime")
public function redirect($path, $code, $type = "anime")
{
$url = $this->urlGenerator->full_url($path, $type);
$http = new HttpView($this->container);
@ -205,7 +205,7 @@ class Controller {
* @param string $status
* @return void
*/
public function login($status="")
public function login($status = "")
{
$message = "";

View File

@ -51,7 +51,7 @@ class Anime extends BaseController {
/**
* Constructor
*
* @param Container $container
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{
@ -73,7 +73,7 @@ class Anime extends BaseController {
]);
}
public function index($type="watching", $view='')
public function index($type = "watching", $view = '')
{
return $this->anime_list($type, $view);
}
@ -136,7 +136,7 @@ class Anime extends BaseController {
/**
* Update an anime item
*
* @return bool
* @return boolean|null
*/
public function update()
{

View File

@ -52,7 +52,7 @@ class Collection extends BaseController {
/**
* Constructor
*
* @param Container $container
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{
@ -113,11 +113,11 @@ class Collection extends BaseController {
* @param int $id
* @return void
*/
public function form($id=NULL)
public function form($id = NULL)
{
$action = (is_null($id)) ? "Add" : "Edit";
$this->outputHTML('collection/'. strtolower($action), [
$this->outputHTML('collection/' . strtolower($action), [
'action' => $action,
'action_url' => $this->urlGenerator->full_url("collection/" . strtolower($action)),
'title' => $this->config->whose_list . " Anime Collection · {$action}",

View File

@ -43,7 +43,7 @@ class Manga extends Controller {
/**
* Constructor
*
* @param Container $container
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{
@ -58,7 +58,7 @@ class Manga extends Controller {
]);
}
public function index($status="all", $view="")
public function index($status = "all", $view = "")
{
return $this->manga_list($status, $view);
}
@ -66,7 +66,7 @@ class Manga extends Controller {
/**
* Update an anime item
*
* @return bool
* @return boolean|null
*/
public function update()
{

View File

@ -63,10 +63,10 @@ class MenuGenerator extends RoutingBase {
$parsed = [];
foreach($this->menus as $name => $menu)
foreach ($this->menus as $name => $menu)
{
$parsed[$name] = [];
foreach($menu['items'] as $path_name => $partial_path)
foreach ($menu['items'] as $path_name => $partial_path)
{
$title = $this->string($path_name)->humanize()->titleize();
$parsed[$name]['items'][$title] = $this->string($menu['route_prefix'])->append($partial_path);
@ -90,7 +90,7 @@ class MenuGenerator extends RoutingBase {
*/
public function generate($menu)
{
$parsed_config = $this->parse_config();
$parsed_config = $this->parse_config();
$menu_config = $parsed_config[$menu];
// Array of list items to add to the main menu

View File

@ -29,7 +29,7 @@ class Model {
/**
* Constructor
*
* @param Container $container
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{
@ -47,7 +47,7 @@ class Model {
* @param string $type - Anime or Manga, controls cache path
* @return string - the frontend path for the cached image
*/
public function get_cached_image($api_path, $series_slug, $type="anime")
public function get_cached_image($api_path, $series_slug, $type = "anime")
{
$api_path = str_replace("jjpg", "jpg", $api_path);
$path_parts = explode('?', basename($api_path));
@ -111,7 +111,7 @@ class Model {
private function _resize($path, $width, $height)
{
$img = new SimpleImage($path);
$img->resize($width,$height)->save();
$img->resize($width, $height)->save();
}
}
// End of BaseModel.php

View File

@ -37,7 +37,7 @@ class API extends BaseModel {
/**
* Constructor
*
* @param Container $container
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{

View File

@ -73,13 +73,13 @@ class Anime extends API {
$data = $this->_get_list_from_api();
foreach($data as $datum)
foreach ($data as $datum)
{
$output[$this->const_map[$datum['watching_status']]][] = $datum;
}
// Sort anime by name
foreach($output as &$status_list)
foreach ($output as &$status_list)
{
$this->sort_by_name($status_list);
}
@ -157,7 +157,7 @@ class Anime extends API {
* @param string $status
* @return array
*/
protected function _get_list_from_api($status="all")
protected function _get_list_from_api($status = "all")
{
$config = [
'allow_redirects' => FALSE
@ -171,7 +171,7 @@ class Anime extends API {
$response = $this->client->get("users/{$this->config->hummingbird_username}/library", $config);
$output = $this->_check_cache($status, $response);
foreach($output as &$row)
foreach ($output as &$row)
{
$row['anime']['image'] = $this->get_cached_image($row['anime']['image'], $row['anime']['slug'], 'anime');
}
@ -197,7 +197,7 @@ class Anime extends API {
if ($api_data === $cached && file_exists($transformed_cache_file))
{
return json_decode(file_get_contents($transformed_cache_file),TRUE);
return json_decode(file_get_contents($transformed_cache_file), TRUE);
}
else
{
@ -219,7 +219,7 @@ class Anime extends API {
{
$sort = array();
foreach($array as $key => $item)
foreach ($array as $key => $item)
{
$sort[$key] = $item['anime']['title'];
}

View File

@ -29,7 +29,7 @@ class AnimeCollection extends DB {
/**
* Constructor
*
* @param Container $container
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{
@ -61,7 +61,7 @@ class AnimeCollection extends DB {
* @param array $filter
* @return array
*/
public function get_genre_list($filter=[])
public function get_genre_list($filter = [])
{
$this->db->select('hummingbird_id, genre')
->from('genre_anime_set_link gl')
@ -76,7 +76,7 @@ class AnimeCollection extends DB {
$output = [];
foreach($query->fetchAll(\PDO::FETCH_ASSOC) as $row)
foreach ($query->fetchAll(\PDO::FETCH_ASSOC) as $row)
{
$id = $row['hummingbird_id'];
$genre = $row['genre'];
@ -109,7 +109,7 @@ class AnimeCollection extends DB {
$collection = [];
foreach($raw_collection as $row)
foreach ($raw_collection as $row)
{
if (array_key_exists($row['media'], $collection))
{
@ -137,7 +137,7 @@ class AnimeCollection extends DB {
->from('media')
->get();
foreach($query->fetchAll(\PDO::FETCH_ASSOC) as $row)
foreach ($query->fetchAll(\PDO::FETCH_ASSOC) as $row)
{
$output[$row['id']] = $row['type'];
}
@ -154,7 +154,7 @@ class AnimeCollection extends DB {
public function get_collection_entry($id)
{
$query = $this->db->from('anime_set')
->where('hummingbird_id', (int) $id)
->where('hummingbird_id', (int)$id)
->get();
return $query->fetch(\PDO::FETCH_ASSOC);
@ -187,7 +187,7 @@ class AnimeCollection extends DB {
*/
public function add($data)
{
$anime = (object) $this->anime_model->get_anime($data['id']);
$anime = (object)$this->anime_model->get_anime($data['id']);
$this->db->set([
'hummingbird_id' => $data['id'],
@ -252,7 +252,7 @@ class AnimeCollection extends DB {
$anime = json_decode(file_get_contents("import.json"));
foreach($anime as $item)
foreach ($anime as $item)
{
$this->db->set([
'hummingbird_id' => $item->id,
@ -287,7 +287,7 @@ class AnimeCollection extends DB {
// Get api information
$anime = $this->anime_model->get_anime($anime_id);
foreach($anime['genres'] as $genre)
foreach ($anime['genres'] as $genre)
{
// Add genres that don't currently exist
if ( ! in_array($genre['name'], $genres))
@ -335,7 +335,7 @@ class AnimeCollection extends DB {
$query = $this->db->select('id, genre')
->from('genres')
->get();
foreach($query->fetchAll(\PDO::FETCH_ASSOC) as $genre)
foreach ($query->fetchAll(\PDO::FETCH_ASSOC) as $genre)
{
$genres[$genre['id']] = $genre['genre'];
}
@ -344,7 +344,7 @@ class AnimeCollection extends DB {
$query = $this->db->select('hummingbird_id, genre_id')
->from('genre_anime_set_link')
->get();
foreach($query->fetchAll(\PDO::FETCH_ASSOC) as $link)
foreach ($query->fetchAll(\PDO::FETCH_ASSOC) as $link)
{
if (array_key_exists($link['hummingbird_id'], $links))
{
@ -371,7 +371,7 @@ class AnimeCollection extends DB {
{
// Get the anime collection
$collection = $this->_get_collection();
foreach($collection as $anime)
foreach ($collection as $anime)
{
// Get api information
$this->update_genre($anime['hummingbird_id']);

View File

@ -26,7 +26,7 @@ class DB extends BaseModel {
/**
* Constructor
*
* @param Container $container
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{

View File

@ -65,7 +65,7 @@ class Manga extends API {
{
$data = $this->_get_list_from_api();
foreach($data as $key => &$val)
foreach ($data as $key => &$val)
{
$this->sort_by_name($val);
}
@ -87,7 +87,7 @@ class Manga extends API {
return $data;
}
private function _get_list_from_api($status="All")
private function _get_list_from_api($status = "All")
{
$config = [
@ -154,7 +154,7 @@ class Manga extends API {
self::COMPLETED => [],
];
foreach($data as &$entry)
foreach ($data as &$entry)
{
$entry['manga']['image'] = $this->get_cached_image($entry['manga']['image'], $entry['manga']['slug'], 'manga');
$key = $this->const_map[$entry['reading_status']];
@ -185,7 +185,7 @@ class Manga extends API {
{
$sort = array();
foreach($array as $key => $item)
foreach ($array as $key => $item)
{
$sort[$key] = $item['manga']['title'];
}

View File

@ -35,7 +35,7 @@ class Router extends RoutingBase {
/**
* Constructor
*
* @param Container $container
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{

View File

@ -32,7 +32,7 @@ class RoutingBase {
/**
* Constructor
*
* @param Container $container
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{

View File

@ -43,7 +43,7 @@ class MangaListsZipper {
$output = [];
foreach($this->manga_tracking_list as &$entry)
foreach ($this->manga_tracking_list as &$entry)
{
$id = $entry['manga_id'];
$entry['manga'] = $this->manga_series_list[$id];
@ -65,7 +65,7 @@ class MangaListsZipper {
$orig_list = $this->manga_series_list;
$indexed_list = [];
foreach($orig_list as $manga)
foreach ($orig_list as $manga)
{
$id = $manga['id'];
$indexed_list[$id] = $manga;

View File

@ -32,7 +32,7 @@ class UrlGenerator extends RoutingBase {
* @param string $type - (optional) The controller
* @return string
*/
public function base_url($type="anime")
public function base_url($type = "anime")
{
$config_path = trim($this->__get("{$type}_path"), "/");
@ -88,7 +88,7 @@ class UrlGenerator extends RoutingBase {
* @param string $type - (optional) The controller (anime or manga), defaults to anime
* @return string
*/
public function full_url($path="", $type="anime")
public function full_url($path = "", $type = "anime")
{
$config_path = trim($this->__get("{$type}_path"), "/");
$config_default_route = $this->__get("default_{$type}_path");

View File

@ -23,7 +23,7 @@ class Container implements ContainerInterface {
*/
public function __construct(array $values = [])
{
$this->container = new ArrayObject($values);
$this->container = new ArrayObject($values);
}
/**

View File

@ -99,7 +99,7 @@ class Friend {
$property->setAccessible(TRUE);
return $property;
}
catch(\Exception $e) {}
catch (\Exception $e) {}
return NULL;
}

View File

@ -22,7 +22,7 @@ abstract class AbstractTransformer implements TransformerInterface {
*/
public function transform_collection($collection)
{
$list = (array) $collection;
$list = (array)$collection;
return array_map([$this, 'transform'], $list);
}
}

View File

@ -59,7 +59,7 @@ class ArrayType {
*
* @param array $arr
*/
public function __construct(Array $arr)
public function __construct(array $arr)
{
$this->arr =& $arr;
}