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

View File

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

View File

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

View File

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