This question has been answered by multiple community members. See the first response.
if (is_numeric($this->props['template'])) { /* user sent a number */
$t = $this->modx->getObject('modTemplate',
(integer) $this->props['template']);
/* make sure it exists */
if (! $t) {
$this->SetError($this->modx->lexicon('np_no_template_name') .
$this->props['template']);
}
} else { /* user sent a template name */
$t = $this->modx->getObject('modTemplate',
array(
'templatename' => $this->props['template']
));
if (!$t) {
$this->setError($this->modx->lexicon('np_no_template_name') .
$this->props['template']);
}
}