public function renderCommand($type, $data = null, $context = null)
{
if (is_object($type)) {
$context = $type;
$data = $context->export($this);
$type = $context->type();
}
if (!isset($this->_strings[$type])) {
throw new InvalidArgumentException("Invalid query type `{$type}`.");
}
$template = $this->_strings[$type];
$data = array_filter($data);
$placeholders = array();
foreach ($data as $key => $value) {
$placeholders[$key] = "{{$key}}";
}
$template = String::insert($template, $placeholders, array('clean' => true));
return trim(String::insert($template, $data, array('before' => '{')));
}