// Set resolver instance
$controllerInstance->setResolverInstance($resolverInstance);
+ // Generate some pre/post filters
+ $controllerInstance->addDoFormPrePostFilters();
+
// Return the prepared instance
return $controllerInstance;
}
public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
// Run all pre filters
$this->executePreFilters($requestInstance, $responseInstance);
+ $requestInstance->debugInstance();
// Get command instance from resolver
$commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance);
// Do something more here
die("OK");
}
+
+ /**
+ * Add some default pre/post filters for this controller to the matching
+ * filter chains
+ *
+ * @return void
+ */
+ protected function addDoFormPrePostFilters () {
+ // Add a filter to check for missing user name
+ $this->addPreFilter(UserNameValidatorFilter::createUserNameValidatorFilter());
+ }
}
// [EOF]
// RECURSIVE PROTECTION! BE CAREFUL HERE!
if ((!isset($this->loadedRawData[$template])) && (!in_array($template, $this->loadedTemplates))) {
- // Then try to search for code-templates first
- try {
- // Load the code template and remember it's contents
- $this->loadCodeTemplate($template);
- $this->loadedRawData[$template] = $this->getRawTemplateData();
+ // Template not found, but maybe variable assigned?
+ if ($this->isVariableAlreadySet($template) !== false) {
+ // Use that content here
+ $this->loadedRawData[$template] = $this->readVariable($template);
- // Remember this template for recursion detection
- // RECURSIVE PROTECTION!
+ // Recursive protection:
$this->loadedTemplates[] = $template;
- } catch (FilePointerNotOpenedException $e) {
- // Template not found, but maybe variable assigned?
- if ($this->isVariableAlreadySet($template) !== false) {
- // Use that content here
- $this->loadedRawData[$template] = $this->readVariable($template);
-
- // Recursive protection:
+ } else {
+ // Then try to search for code-templates
+ try {
+ // Load the code template and remember it's contents
+ $this->loadCodeTemplate($template);
+ $this->loadedRawData[$template] = $this->getRawTemplateData();
+
+ // Remember this template for recursion detection
+ // RECURSIVE PROTECTION!
$this->loadedTemplates[] = $template;
- } else {
+ } catch (FilePointerNotOpenedException $e) {
// Even this is not done... :/
$this->rawTemplates[] = $template;
}