private function prepareFilePath(string $file, bool $fileCheck = true): string
    {
        $file = str_replace(["\0", "\r", "\n"], '', trim($file));
        if ($file == '') {
            throw new ViewException('No valid file given');
        }

        // custom
        if ($file[0] == '.') {
            $fileCheck = false;
            if (!file_exists($file)) {
                throw new ViewException("Custom view file '{$file}' not found");
            }
        } elseif ($file[0] == '@') {
            // custom in default view folder
            $file = sprintf('%s/app/service/_default/view/%s.php', APP_DIR, substr($file, 1));
            $fileCheck = false;
            if (!file_exists($file)) {
                throw new ViewException("Default view file '{$file}' not found");
            }
        } else {
            $file = sprintf('%s/app/service/%s/view/%s.php', APP_DIR, $this->service->getName(), $file);
        }

        if ($fileCheck && !file_exists($file)) {
            // look up default folder
            if ($this->service->isDefaultService()) {
                $file = sprintf('%s/app/service/_default/%s/view/%s', APP_DIR,
                    $this->service->getName(), basename($file));
            }

            if (!file_exists($file)) {
                throw new ViewException("View file '{$file}' not found");
            }
        }

        return $file;
    }