Fix more scrutinizer issues

This commit is contained in:
Timothy Warren 2015-10-06 12:15:19 -04:00
parent 83f1a9afd9
commit f9b3d64eca
5 changed files with 9 additions and 34 deletions

View File

@ -7,9 +7,6 @@ namespace Aviat\AnimeClient;
/** /**
* Wrapper for configuration values * Wrapper for configuration values
*
* @property Database Config $database
* @property Menu Config $menus
*/ */
class Config { class Config {

View File

@ -98,10 +98,10 @@ class Controller {
* *
* @param HtmlView $view * @param HtmlView $view
* @param string $template * @param string $template
* @param array|object $data * @param array $data
* @return string * @return string
*/ */
public function load_partial($view, $template, $data = []) public function load_partial($view, $template, array $data = [])
{ {
$errorHandler = $this->container->get('error-handler'); $errorHandler = $this->container->get('error-handler');
$errorHandler->addDataTable('Template Data', $data); $errorHandler->addDataTable('Template Data', $data);
@ -123,7 +123,7 @@ class Controller {
throw new \InvalidArgumentException("Invalid template : {$template}"); throw new \InvalidArgumentException("Invalid template : {$template}");
} }
return $view->render_template($template_path, $data); return $view->render_template($template_path, (array)$data);
} }
/** /**
@ -182,21 +182,6 @@ class Controller {
$http->redirect($url, $code); $http->redirect($url, $code);
} }
/**
* Add a message box to the page
*
* @param string $type
* @param string $message
* @return string
*/
public function show_message($type, $message)
{
return $this->load_partial('message', [
'stat_class' => $type,
'message' => $message
]);
}
/** /**
* Clear the api session * Clear the api session
* *
@ -217,7 +202,7 @@ class Controller {
{ {
$message = ""; $message = "";
if ($status != "") /*if ($status != "")
{ {
$message = $this->show_message('error', $status); $message = $this->show_message('error', $status);
} }
@ -225,7 +210,7 @@ class Controller {
$this->outputHTML('login', [ $this->outputHTML('login', [
'title' => 'Api login', 'title' => 'Api login',
'message' => $message 'message' => $message
]); ]);*/
} }
/** /**

View File

@ -35,7 +35,7 @@ class MenuGenerator extends RoutingBase {
public function __construct(ContainerInterface $container) public function __construct(ContainerInterface $container)
{ {
parent::__construct($container); parent::__construct($container);
$this->menus = $this->config->menus; $this->menus = $this->config->get('menus');
$this->helper = $container->get('html-helper'); $this->helper = $container->get('html-helper');
} }

View File

@ -50,7 +50,7 @@ class Router extends RoutingBase {
/** /**
* Generate routes based on controller methods * Generate routes based on controller methods
* *
* @return [type] [description] * @return void
*/ */
protected function generate_convention_routes() protected function generate_convention_routes()
{ {
@ -106,7 +106,7 @@ class Router extends RoutingBase {
* Handle the current route * Handle the current route
* *
* @codeCoverageIgnore * @codeCoverageIgnore
* @param [object] $route * @param object $route
* @return void * @return void
*/ */
public function dispatch($route = NULL) public function dispatch($route = NULL)

View File

@ -94,7 +94,6 @@ class UrlGenerator extends RoutingBase {
$config_default_route = $this->__get("default_{$type}_path"); $config_default_route = $this->__get("default_{$type}_path");
// Remove beginning/trailing slashes // Remove beginning/trailing slashes
$config_path = trim($config_path, '/');
$path = trim($path, '/'); $path = trim($path, '/');
// Remove any optional parameters from the route // Remove any optional parameters from the route
@ -110,13 +109,7 @@ class UrlGenerator extends RoutingBase {
if ($this->__get('default_to_list_view')) $path .= '/list'; if ($this->__get('default_to_list_view')) $path .= '/list';
} }
// Set an leading folder
/*if ($config_path !== '')
{
$path = "{$config_path}/{$path}";
}*/
return "//{$host}/{$path}"; return "//{$host}/{$path}";
} }
} }
// End of UrlGenerator.php // End of UrlGenerator.php