protected function buildRunnable(StdClass $runnable)
	{
		$template = __DIR__ . '/template' . '/RunnableTemplate.phx';
		if (!file_exists($template)) {
			$this->cmd->error(sprinf('Template file [%s] does not exist', $template), 'red');
			exit;
		}

		$content = file_get_contents($template);
		$hasLang = $this->hasLang($content);
		$hasName = $this->hasName($content);
		$hasId = $this->hasId($content);
		$hasRunnableCommands = $this->hasRunnableCommands($content);
		$hasNamespace = $this->hasNamespace($content);

		if (!$hasLang || !$hasName || !$hasId || !$hasRunnableCommands | !$hasNamespace) {
			$this->cmd->error('Cannot build runnable from invalid template.');
		}

		$runnableCommands = '[]';
		$location = $this->cmd->getConfigOpt('runnables_path');
		$namespace = '';

		if ($runnable->namespace !== '') {
			$namespace = 'namespace ' . $runnable->namespace . ';';
		}

		if ($runnable->runnableCommands !== '') {
			$runnableCommands = "[";
				$commands = explode(',', $runnable->runnableCommands);
				foreach($commands as $commandString) {
					$cmdArray = explode(':', $commandString);
					$command = ltrim(rtrim($cmdArray[0]));
					$commandArgumentLength = $this->validateArgumentLengthType($cmdArray[1]);

					$runnableCommands .= "\n" . $this->env->addTab() .  "\"" . $command . "\"" . ' => ' . $commandArgumentLength . ',';
				}
			$runnableCommands .= "\n]"; 
		}

		$replaces = [
			'[phx:lang]' => '<?php',
			'[phx:name]' => $runnable->name,
			'[phx:id]' => $runnable->id,
			'[phx:commands]' => $runnableCommands,
			'[phx:namespace]' => $namespace
		];

		$runnableContent = str_replace(
			array_keys($replaces),
			array_values($replaces),
			$content
		);

		if ($runnable->location !== '') {
			$location = $runnable->location;
		}

		$fileLocation = $location . '/' . $runnable->name . '.php';
		file_put_contents($fileLocation, $runnableContent);

		return true;
	}