Exemplo n.º 1
0
 /**
  *
  *
  * @param string $page The page we would like to load.
  * @param array  $vars Optional. The values, the requested page requires.
  */
 public static function prepare($page, array $vars = [])
 {
     $activeFolder = './Solutions/' . Projects::get()->active() . '/Views/';
     self::loadHeader($activeFolder, $vars);
     self::loadContent($activeFolder, $page, $vars);
     self::$footer = file_get_contents($activeFolder . 'foot.master.php');
     return self::$header . self::$content . self::$footer;
 }
Exemplo n.º 2
0
 /**
  * Instantiates a given class, with an optional array of parameters.
  *
  * @param string $className The name of the class to be instantiated.
  * @return Object
  */
 private static function loadClass($className)
 {
     // We replace the "App" keyword in the namespace to the active
     // solution's name.
     $className = strtr($className, ['App' => Projects::get()->active()]);
     try {
         $reflector = new ReflectionClass($className);
     } catch (Exception $e) {
         echo $e->getMessage();
         exit;
     }
     // We get the constructor.
     $constructor = $reflector->getConstructor();
     // If the constructor is null, that means we have no dependencies
     // to resolve, and we can just instantiate the class.
     if (is_null($constructor)) {
         return $reflector->newInstance();
     }
     // If there is constructor, we need to resolve all its
     // dependencies (if any).
     $args = self::resolveParameters($constructor->getParameters());
     // Finally, instantiate the class.
     return $reflector->newInstanceArgs($args);
 }
Exemplo n.º 3
0
 /**
  * The constructor.
  */
 public function __construct()
 {
     $this->name = Projects::get()->active();
     $this->projectInfo = './Solutions/' . $this->name . '/project.info.php';
 }
Exemplo n.º 4
0
<?php

$start = microtime(true);
header('Content-Type: text/html; charset=utf-8');
include_once './System/Http/autoload.php';
use System\Config\Projects;
include_once './Solutions/' . Projects::get()->active() . '/routes.php';
$end = microtime(true);