<?php

namespace modules\input;

class main extends \moduleMain {

	use traits {
			traits::__construct as __ConstructInput;
		}
	
	public function __construct() {
		$this->__ConstructInput();
	}
	
	public function Activate() {
		hook_add('execute', [$this, '__execute']);
	}

	public function __execute(&$current, $segment) {
		if ($current === FALSE) {
			$loader = $GLOBALS['loader'];
			// get action
			$info = $loader->Route($segment, $this->method());
			if ($info === FALSE) $info = $loader->Route($segment, $this->method(), TRUE);		// __call
			$current = $info;		// we have a command;  return to main thread to execute it
		}
	}

}