Skip to content

Commit

Permalink
Added method for render
Browse files Browse the repository at this point in the history
  • Loading branch information
VeeeneX committed Aug 11, 2015
1 parent 739ac29 commit ac2e374
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 56 deletions.
60 changes: 7 additions & 53 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@

class Application
{
/**
* Namespace used for application
* @var string
*/
public static $namespace;

/**
* Instance of Dependency resolver with ProviderInterface
Expand Down Expand Up @@ -50,47 +45,6 @@ public function setApplicationConfig(Config $Config)
$this->ApplicationConfig = $Config;
}

/**
* Set the namespace, which will be use for
* whole application
*
* @param $namespace Namespace to use
* @return \Aurora\App Returns concurrent instance of App
*/
public static function useNamespace($namespace = null)
{
self::$namespace = $namespace;
}

/**
* Set the namespace, which will be use for
* whole application
*
* @param $namespace Namespace to use
* @return \Aurora\App Returns concurrent instance of App
*/
public static function setNamespace($namespace = null)
{
self::$namespace = $namespace;
}

/**
* getNamespace
* Returns namespace
*
* @param string $namespace Get namespace
* @return string Namespace
*/
public static function getNamespace($namespace = null)
{

if ($namespace[0] !== "\\") {
$namespace = self::$namespace.$namespace;
}

return (string) $namespace;
}

/**
* Run
*
Expand Down Expand Up @@ -127,15 +81,15 @@ public function run($callable, $params = array())

$Rule->Instance = $Instance;
$this->Resolver->addRule($Rule);

$return = "";
$return .= (string) $this->Resolver->callMethod($controllerClass, "onConstruct");
$return .= (string) $this->Resolver->callMethod($controllerClass, "before");
$return .= (string) $this->Resolver->callMethod($controllerClass, $controllermethod);
$return .= (string) $this->Resolver->callMethod($controllerClass, "after");

$this->Resolver->callMethod($controllerClass, "onConstruct");
$this->Resolver->callMethod($controllerClass, "before");
$this->Resolver->callMethod($controllerClass, $controllermethod);

$Instance->Response->content = $this->Resolver->callMethod($controllerClass, "render");
$Instance->Response->send();
echo $return;

$this->Resolver->callMethod($controllerClass, "after");
}

} else if (is_callable($callable)) {
Expand Down
5 changes: 2 additions & 3 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Aurora;

use Aurora\Helper\StatefulTrait;
use Aurora\Helper\ObjectTrait;
use Aurora\Application;

class Model
{
use StatefulTrait;
use ObjectTrait;
private $Connection;

public function __construct($Connection = null)
Expand All @@ -28,7 +28,6 @@ public function getConnection()
public function create($model, $name = null)
{
$name = ($name) ? $name : $model;
$model = Application::getNamespace($model);

return $this->data[$name] = new $model($this->Connection);
}
Expand Down

0 comments on commit ac2e374

Please sign in to comment.