Skip to content

Commit

Permalink
pass app name to makeControllerName
Browse files Browse the repository at this point in the history
  • Loading branch information
jenleelind committed Nov 7, 2014
1 parent 2183912 commit 7c88949
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/SparkLib/Application.php
Expand Up @@ -524,15 +524,19 @@ public function controller() { return $this->_controller; }
* @param string name of a controller
* @return string name of a controller class
*/
public function makeControllerName ($controller)
public function makeControllerName ($controller, $app_name_str = '')
{
$parts = explode('_', $controller);
foreach ($parts as &$part) {
$part = ucfirst($part);
}

if (! $app_name_str) {
$app_name_str = get_class($this);
}

// this lives in Application\Controller
$namespaced = get_class($this) . '\\' . implode('', $parts);
$namespaced = $app_name_str . '\\' . implode('', $parts);

// this tells us everything will be namespaced, so we can
// shortcut right to using that one
Expand All @@ -541,7 +545,7 @@ public function makeControllerName ($controller)

// this lives in Application\ApplicationController
// it is the old way and we hates it
$un_namespaced = get_class($this) . implode('', $parts);
$un_namespaced = $app_name_str . implode('', $parts);

if (class_exists($un_namespaced)) {
return $un_namespaced;
Expand Down

0 comments on commit 7c88949

Please sign in to comment.