[overwrite] default notFound handler
@return mixed
481089
protected function notFound()
    {
        $errmsg = sprintf('[%s][%s]method not found: %s:%s. handlers: %s', $this->request->getMethod(), UriHelper::getCurrentUrl(), get_class($this), $this->getLongName(), implode('|', $this->getHandleStack()));
        Ioc::logger('router')->error($errmsg);
        
        $handler = Ioc::get('notFoundHandler');
        return $handler($this->request, $this->response);
    }
100190
protected function notFound(NotFoundException $e)
    {
        if (isset($this->hooks['not.found'])) {
            return $this->hooks['not.found']($e);
        } else {
            return (new Response())
                ->setStatusCode(404)
                ->setBody($e->getMessage());
        }
    }
647870
protected function determineHandler()
    {
        $handler = collect($this->config->get('handlers'))
            ->map(function (string $handlerClassName) {
                if (! class_exists($handlerClassName)) {
                    throw InvalidHandler::handlerDoesNotExist($handlerClassName);
                }

                return new $handlerClassName($this->request);
            })
            ->filter(function (HandlesSlashCommand $handler) {
                return $handler->canHandle($this->request);
            })
            ->first();

        if (! $handler) {
            throw RequestCouldNotBeHandled::noHandlerFound($this->request);
        }

        return $handler;
    }
318038
public function getDefault()
    {
        if ($this->default) {
            return $this->default;
        }
        if (!empty($this->values)) {
            return reset($this->values);
        }
        return null;
    }
308675
public function getVarDumper()
    {
        if ($this->varDumper === null) {
            $this->varDumper = self::getDefaultVarDumper();
        }
        return $this->varDumper;
    }
322600
function undo() {
		if ($this->flag) {
			if ($this->count)
				$this->count--;
			return $this->restore($this->count);
		}
		return $this;
	}
979686
public function notfound() {
        $router = Router::driver();
        quit('Cli Not Found:' .  $router->module. '/' .$router->controller . '/' . $router->function."\n");
    }
350667
protected function loadDefaultHandlers()
    {
        $filter = $this->htmlCleaner;

        // INT / INTEGER
        $this->handlers[static::INTEGER] = $this->handlers['INT'] = function ($source) {
            // Only use the first integer value
            preg_match('/-?[0-9]+/', (string) $source, $matches);

            return isset($matches[0]) ? (int) $matches[0] : null;
        };

        // UINT
        $this->handlers[static::UINT] = function ($source) {
            // Only use the first integer value
            preg_match('/-?[0-9]+/', (string) $source, $matches);

            return isset($matches[0]) ? abs((int) $matches[0]) : null;
        };

        // FLOAT / DOUBLE
        $this->handlers[static::FLOAT] = $this->handlers['DOUBLE'] = function ($source) {
            // Only use the first floating point value
            preg_match('/-?[0-9]+(\.[0-9]+)?/', (string) $source, $matches);

            return isset($matches[0]) ? (float) $matches[0] : null;
        };

        // BOOLEAN / BOOL
        $this->handlers[static::BOOLEAN] = $this->handlers['BOOL'] = function ($source) {
            return (bool) $source;
        };

        // WORD
        $this->handlers[static::WORD] = function ($source) {
            return (string) preg_replace('/[^A-Z_]/i', '', $source);
        };

        // ALNUM
        $this->handlers[static::ALNUM] = function ($source) {
            return (string) preg_replace('/[^A-Z0-9]/i', '', $source);
        };

        // CMD
        $this->handlers[static::CMD] = function ($source) {
            $result = (string) preg_replace('/[^A-Z0-9_\.-]/i', '', $source);

            return ltrim($result, '.');
        };

        // BASE64
        $this->handlers[static::BASE64] = function ($source) {
            return (string) preg_replace('/[^A-Z0-9\/+=]/i', '', $source);
        };

        // STRING
        $this->handlers[static::STRING] = function ($source) use ($filter) {
            return (string) $filter->remove($filter->decode((string) $source));
        };

        // HTML
        $this->handlers[static::HTML] = function ($source) use ($filter) {
            return (string) $filter->remove((string) $source);
        };

        // ARRAY
        $this->handlers[static::ARRAY_TYPE] = function ($source) {
            return (array) $source;
        };

        // PATH
        $this->handlers[static::PATH] = function ($source) {
            $pattern = '/^[A-Za-z0-9_-]+[A-Za-z0-9_\.-]*([\\\\\/][A-Za-z0-9_-]+[A-Za-z0-9_\.-]*)*$/';
            preg_match($pattern, (string) $source, $matches);

            return isset($matches[0]) ? (string) $matches[0] : null;
        };

        // USERNAME
        $this->handlers[static::USERNAME] = function ($source) {
            return (string) preg_replace('/[\x00-\x1F\x7F<>"\'%&]/', '', $source);
        };

        // EMAIL
        $this->handlers[static::EMAIL] = function ($source) {
            return (string) filter_var($source, FILTER_SANITIZE_EMAIL);
        };

        // HTML
        $this->handlers[static::URL] = function ($source) {
            return (string) filter_var(
                $source,
                FILTER_SANITIZE_URL,
                FILTER_FLAG_QUERY_REQUIRED | FILTER_FLAG_PATH_REQUIRED
            );
        };

        // RAW
        $this->handlers[static::RAW] = function ($source) {
            return $source;
        };

        // UNKNOWN
        $this->defaultHandler = function ($source) use ($filter) {
            // Are we dealing with an array?
            if (is_array($source)) {
                foreach ($source as $key => $value) {
                    // Filter element for XSS and other 'bad' code etc.
                    if (is_string($value)) {
                        $source[$key] = $filter->remove($filter->decode($value));
                    }
                }

                return $source;
            } else {
                // Or a string?
                if (is_string($source) && !empty($source)) {
                    // Filter source for XSS and other 'bad' code etc.
                    return $filter->remove($filter->decode($source));
                } else {
                    // Not an array or string.. return the passed parameter
                    return $source;
                }
            }
        };
    }
226449
protected function initDefault()
    {
        if ($this->isCli()) {
            return null;
        }

        $uri = (empty($_SERVER['HTTPS']) ? 'http' : 'https')
            . '://'
            . $_SERVER['HTTP_HOST']
            . $_SERVER['REQUEST_URI'];
        return  rtrim(preg_replace('/\?.*/', '', $uri), '/');
    }
657330
public function reset()
    {
        $this->pathRegistered = false;

        if ($this->renderer instanceof PhpRenderer) {
            $this->renderer->reset();
        }

        $this->renderer->setPaths(new PriorityQueue());

        return $this;
    }
1331082
public function setDefaultsFromConfiguration()
    {
        $this->ignoreCache = isset($this->config["ignoreCache"])
            ? $this->config["ignoreCache"]
            : $this->ignoreCache;

        return $this;
    }
1355629
protected function onBeforeWrite()
    {
        // Set default owner
        if (!$this->isInDB() && !$this->OwnerID && Security::getCurrentUser()) {
            $this->OwnerID = Security::getCurrentUser()->ID;
        }

        $currentname = $name = $this->getField('Name');
        $title = $this->getField('Title');

        $changed = $this->isChanged('Name');

        // Name can't be blank, default to Title or singular name
        if (!$name) {
            $name = $title ?: $this->i18n_singular_name();
        }
        $name = $this->filterFilename($name);
        if ($name !== $currentname) {
            $changed = true;
        }

        // Check for duplicates when the name has changed (or is set for the first time)
        if ($changed) {
            $nameGenerator = $this->getNameGenerator($name);
            // Defaults to returning the original filename on first iteration
            foreach ($nameGenerator as $newName) {
                // This logic is also used in the Folder subclass, but we're querying
                // for duplicates on the File base class here (including the Folder subclass).

                // TODO Add read lock to avoid other processes creating files with the same name
                // before this process has a chance to persist in the database.
                $existingFile = File::get()->filter(array(
                    'Name' => $newName,
                    'ParentID' => (int) $this->ParentID
                ))->exclude(array(
                    'ID' => $this->ID
                ))->first();
                if (!$existingFile) {
                    $name = $newName;
                    break;
                }
            }
        }

        // Update actual field value
        $this->setField('Name', $name);

        // Update title
        if (!$title) {
            // Generate a readable title, dashes and underscores replaced by whitespace,
            // and any file extensions removed.
            $this->setField(
                'Title',
                str_replace(array('-','_'), ' ', preg_replace('/\.[^.]+$/', '', $name))
            );
        }

        // Propagate changes to the AssetStore and update the DBFile field
        $this->updateFilesystem();

        parent::onBeforeWrite();
    }
623936
public function dispatchNotFound()
    {
        if (isset($this->notFoundHandler)) {
            $notFoundHandler = $this->notFoundHandler;
            $controllerName  = implode(
                '\\',
                [
                    $this->baseNamespace,
                    $this->controllerName,
                    $notFoundHandler['controler']
                ]
            );

            $controllerInstance = new $controllerName();

            return call_user_func(
                [
                    $controllerInstance,
                    $this->actionName.$notFoundHandler['action']
                ]
            );
        }

        return null;
    }
1028633
public function defaults()
	{
		// Reset filters.
        foreach ($this->getProfileConfig('filters') as $filter) {
        	$this->addFilter(new $filter);
        }

        // Reset hooks.
        foreach ($this->getProfileConfig('hooks') as $hook => $config) {
        	$this->addHook(new $hook($config));
        }

        // Reset black & white list.
        $this->whitelist($this->getProfileConfig('whitelist'));
        $this->blacklist($this->getProfileConfig('blacklist'));

        // Add configs dir as path.
        $this->addPath($this->_configs->get('bbcoder::cpath'));

        return $this;
	}
1195551
protected function getPageNotFound()
    {
        $this->debug('Controller and action changed to: ' . implode("/", $this->pageNotFound));
        $this->request()->setController($this->pageNotFound[0]);
        $this->request()->setAction($this->pageNotFound[1]);
        if (isset($this->pageNotFound[3]))
            $this->request()->setModule($this->pageNotFound[3]);
        if (isset($this->pageNotFound[2]) && is_string($this->pageNotFound[2]))
            $this->request()->setModule($this->pageNotFound[2]);
        elseif (isset($this->pageNotFound[2]) && is_array($this->pageNotFound[2]) && !empty($this->pageNotFound[2]))
            $this->request()->setParams($this->pageNotFound[2]);
        return $this->getControllerClassFromNameAndModule($this->pageNotFound[0], $this->request()->getModule());
    }
145850
public function beforeDetach()
    {
        $handler = $this->get('handler');
        if (class_exists($handler)) {
            $handler = new $handler();

            return $handler->beforeDetach($this);
        }
    }
112237
public function isIgnoredRoute() {
        if ($this->ignoreRoute === null) {
            $this->ignoreRoute = ($this->route = $this->routes->matchIgnore($this)) !== null;
        }

        return $this->ignoreRoute;
    }