public function watchOutput()
	{
		$arguments = $_SERVER['argv'];
		unset($arguments[0]);
		$argumentsCount = $_SERVER['argc'] - 1;
		$arguments = array_values($arguments);

		if ($argumentsCount > 0) {
			$commandId = $arguments[0];

			if (!Command::hasCommand($commandId)) {
				return $this->env->sendOutput(sprintf('[%s] is not a valid runnable id', $commandId), 'red');
			}

			$command = Command::getCommandById($commandId);
			$runnableCmds = $command->runnableCommands();

			if (isset($arguments[1])) {
				if (!isset($runnableCmds[$arguments[1]])) {
					return $this->error(sprintf('Command %s is an invalid command', $arguments[1]), 'red');
				}

				unset($arguments[0]);
			}

			$arguments = array_values($arguments);

			if (count($arguments) > 0 && isset($runnableCmds[$arguments[0]])) {
				// Check number of arguments passed to command and validate.
				$commandArgumentLength = $runnableCmds[$arguments[0]];

				// validate command with infinite arguments.
				if ($commandArgumentLength == ':i' && (count($arguments) - 1) == 0) {
					return $this->error(sprintf('[%s] command requires at least one argument', $arguments[0]), 'red');
				}

				// validate command with no arguments.
				if ($commandArgumentLength == ':none' && (count($arguments) - 1) > 0) {
					return $this->error(sprintf('[%s] command may not accept any argument', $arguments[0]), 'red');
				}

				if (is_integer($commandArgumentLength) && (count($arguments) - 1) > $commandArgumentLength) {
					$this->error(sprintf('[%s] command requires exactly [%d] argument(s)', $arguments[0], $commandArgumentLength));
				}
			}

			return $command->run($arguments, $argumentsCount);
		}
	}
public function watchOutput()
	{
		$arguments = $_SERVER['argv'];
		unset($arguments[0]);
		$argumentsCount = $_SERVER['argc'] - 1;
		$arguments = array_values($arguments);

		if ($argumentsCount > 0) {
			$commandId = $arguments[0];

			if (!Command::hasCommand($commandId)) {
				return $this->env->sendOutput(sprintf('[%s] is not a valid runnable id', $commandId), 'red');
			}

			$command = Command::getCommandById($commandId);
			$runnableCmds = $command->runnableCommands();

			if (isset($arguments[1])) {
				if (!isset($runnableCmds[$arguments[1]])) {
					return $this->error(sprintf('Command %s is an invalid command', $arguments[1]), 'red');
				}

				unset($arguments[0]);
			}

			$arguments = array_values($arguments);

			if (count($arguments) > 0 && isset($runnableCmds[$arguments[0]])) {
				// Check number of arguments passed to command and validate.
				$commandArgumentLength = $runnableCmds[$arguments[0]];

				// validate command with infinite arguments.
				if ($commandArgumentLength == ':i' && (count($arguments) - 1) == 0) {
					return $this->error(sprintf('[%s] command requires at least one argument', $arguments[0]), 'red');
				}

				// validate command with no arguments.
				if ($commandArgumentLength == ':none' && (count($arguments) - 1) > 0) {
					return $this->error(sprintf('[%s] command may not accept any argument', $arguments[0]), 'red');
				}

				if (is_integer($commandArgumentLength) && (count($arguments) - 1) > $commandArgumentLength) {
					$this->error(sprintf('[%s] command requires exactly [%d] argument(s)', $arguments[0], $commandArgumentLength));
				}
			}

			return $command->run($arguments, $argumentsCount);
		}
	}
public function watchOutput ( ) { $ arguments = $ _SERVER [ 'argv' ] ; unset ( $ arguments [ 0 ] ) ; $ argumentsCount = $ _SERVER [ 'argc' ] - 1 ; $ arguments = array_values ( $ arguments ) ; if ( $ argumentsCount > 0 ) { $ commandId = $ arguments [ 0 ] ; if ( ! Command :: hasCommand ( $ commandId ) ) { return $ this -> env -> sendOutput ( sprintf ( '[%s] is not a valid runnable id' , $ commandId ) , 'red' ) ; } $ command = Command :: getCommandById ( $ commandId ) ; $ runnableCmds = $ command -> runnableCommands ( ) ; if ( isset ( $ arguments [ 1 ] ) ) { if ( ! isset ( $ runnableCmds [ $ arguments [ 1 ] ] ) ) { return $ this -> error ( sprintf ( 'Command %s is an invalid command' , $ arguments [ 1 ] ) , 'red' ) ; } unset ( $ arguments [ 0 ] ) ; } $ arguments = array_values ( $ arguments ) ; if ( count ( $ arguments ) > 0 && isset ( $ runnableCmds [ $ arguments [ 0 ] ] ) ) { // Check number of arguments passed to command and validate. $ commandArgumentLength = $ runnableCmds [ $ arguments [ 0 ] ] ; // validate command with infinite arguments. if ( $ commandArgumentLength == ':i' && ( count ( $ arguments ) - 1 ) == 0 ) { return $ this -> error ( sprintf ( '[%s] command requires at least one argument' , $ arguments [ 0 ] ) , 'red' ) ; } // validate command with no arguments. if ( $ commandArgumentLength == ':none' && ( count ( $ arguments ) - 1 ) > 0 ) { return $ this -> error ( sprintf ( '[%s] command may not accept any argument' , $ arguments [ 0 ] ) , 'red' ) ; } if ( is_integer ( $ commandArgumentLength ) && ( count ( $ arguments ) - 1 ) > $ commandArgumentLength ) { $ this -> error ( sprintf ( '[%s] command requires exactly [%d] argument(s)' , $ arguments [ 0 ] , $ commandArgumentLength ) ) ; } } return $ command -> run ( $ arguments , $ argumentsCount ) ; } }
Processes called command and returns it's output.

@access 	public
@return 	<void>
Processes called command and returns it s output .