Fix some sonarqube issues

This commit is contained in:
Timothy Warren 2015-11-11 14:53:09 -05:00
parent 406c7c13cb
commit 8343fa9182
4 changed files with 16 additions and 9 deletions

View File

@ -223,7 +223,7 @@ class Dispatcher extends RoutingBase {
*/ */
public function _setup_routes() public function _setup_routes()
{ {
$output_routes = []; $routes = [];
$route_type = $this->get_controller(); $route_type = $this->get_controller();
@ -254,20 +254,20 @@ class Dispatcher extends RoutingBase {
// Add the route to the router object // Add the route to the router object
if ( ! array_key_exists('tokens', $route)) if ( ! array_key_exists('tokens', $route))
{ {
$output_routes[] = $this->router->$add($name, $path)->addValues($route); $routes[] = $this->router->$add($name, $path)->addValues($route);
} }
else else
{ {
$tokens = $route['tokens']; $tokens = $route['tokens'];
unset($route['tokens']); unset($route['tokens']);
$output_routes[] = $this->router->$add($name, $path) $routes[] = $this->router->$add($name, $path)
->addValues($route) ->addValues($route)
->addTokens($tokens); ->addTokens($tokens);
} }
} }
return $output_routes; return $routes;
} }
} }
// End of Dispatcher.php // End of Dispatcher.php

View File

@ -63,8 +63,8 @@ class API extends BaseModel {
'User-Agent' => "Tim's Anime Client/2.0", 'User-Agent' => "Tim's Anime Client/2.0",
'Accept-Encoding' => 'application/json' 'Accept-Encoding' => 'application/json'
], ],
'timeout' => 5, 'timeout' => 25,
'connect_timeout' => 5 'connect_timeout' => 25
] ]
]); ]);
} }

View File

@ -50,8 +50,15 @@ class AnimeCollection extends DB {
$db_file_name = $this->db_config['collection']['file']; $db_file_name = $this->db_config['collection']['file'];
if ($db_file_name !== ':memory:') if ($db_file_name !== ':memory:')
{ {
$db_file = @file_get_contents($db_file_name); if (file_exists($db_file_name))
$this->valid_database = (strpos($db_file, 'SQLite format 3') === 0); {
$db_file = file_get_contents($db_file_name);
$this->valid_database = (strpos($db_file, 'SQLite format 3') === 0);
}
else
{
$this->valid_database = FALSE;
}
} }
else else
{ {

View File

@ -51,7 +51,7 @@ class HtmlView extends HttpView {
ob_start(); ob_start();
extract($data); extract($data);
include $path; include_once $path;
$buffer = ob_get_contents(); $buffer = ob_get_contents();
ob_end_clean(); ob_end_clean();