flight\Engine::register PHP Метод

register() публичный Метод

Registers a class to a framework method.
public register ( string $name, string $class, array $params = [], callback $callback = null )
$name string Method name
$class string Class name
$params array Class initialization parameters
$callback callback Function to call after object instantiation
    public function register($name, $class, array $params = array(), $callback = null)
    {
        if (method_exists($this, $name)) {
            throw new \Exception('Cannot override an existing framework method.');
        }
        $this->loader->register($name, $class, $params, $callback);
    }

Usage Example

Пример #1
0
 function testMissingClass()
 {
     $test = null;
     $this->app->register('test', 'NonExistentClass');
     if (class_exists('NonExistentClass')) {
         $test = $this->app->test();
     }
     $this->assertEquals(null, $test);
 }
All Usage Examples Of flight\Engine::register