# Khan

class Khan

Class Core Run Project

## Properties

`static protected` | `$instance` |  |

## Methods

`public static` | `[object]` | `create()` | [create get instance in singleton] |
`protected` | `` | `__construct()` | No description |
`public` | `` | `apps()` | No description |
`public` | `[void` | `services()` | [services Load all services] |
`public` | `` | `dispatch()` | No description |

## Details

at line 32

### `create()`

`public static [object] create()`

[create get instance in singleton]

#### Return Value

`[object]` | [Return khan instance]

at line 39

### `__construct()`

`protected __construct()`
at line 52

### `apps()`

`public apps()`
at line 69

### `services()`

`public [void services()`

[services Load all services]

#### Return Value

`[void` | [load and run services in framework]

at line 76

### `dispatch()`

`public dispatch()`

## Source code

    <?php

    /**
     * RouterKhan (Khan.php) - A fast, easy and flexible router system for PHP
     *
     * @author      PaulaoDev <jskhanframework@gmail.com>
     * @copyright   (c) PaulaoDev
     * @link        https://github.com/PaulaoDev/router-khan
     * @license     MIT
     */

    namespace App\Khan;

    $dotenv = new \Dotenv\Dotenv(ROOT_FOLDER);
    $dotenv->load();

    define("ROOT_CORE", __DIR__);

    /**
     * Class Core Run Project
     */

    class Khan {

    	protected static $instance = null;

    	/**
    	 * [create get instance in singleton]
    	 * @return [object] [Return khan instance]
    	 */

    	public static function create() {
    		if (self::$instance == null) {
    			self::$instance = new Khan();
    		}
    		return self::$instance;
    	}

    	protected function __construct() {}

    	/**
    	 * Load Aliases in project
    	 */

    	private function aliases() {
    		$aliases = require ROOT_FOLDER . '/config/aliases.php';
    		foreach ($aliases as $key => $value) {
    			class_alias($value, $key);
    		}
    	}

    	public function apps(){
    		include_once __DIR__ . '/Component/Functions/Helpers.php';
    		include_once __DIR__ . '/Bootstrap/Config.php';
    		$callTo = $app::resolve('app');
    		$callTo = (array) $callTo();
    		foreach ($callTo as $key => $value) {
    			if (is_closure($value)) {
    				$value();
    			}
    		}
    	}

    	/**
    	 * [services Load all services]
    	 * @return [void [load and run services in framework]
    	 */

    	public function services() {

    		$this->aliases();
    		$this->apps();

    	}

    	public function dispatch() {

    		$this->services();

    	}

    }