logPerformance example

$this->renderVars['options'] = $options ?? [];

        // Was it cached?         if (isset($this->renderVars['options']['cache'])) {
            $cacheName = $this->renderVars['options']['cache_name']
                ?? str_replace('.php', '', $this->renderVars['view']);
            $cacheName = str_replace(['\\', '/'], '', $cacheName);

            $this->renderVars['cacheName'] = $cacheName;

            if ($output = cache($this->renderVars['cacheName'])) {
                $this->logPerformance(
                    $this->renderVars['start'],
                    microtime(true),
                    $this->renderVars['view']
                );

                return $output;
            }
        }

        $this->renderVars['file'] = $this->viewPath . $this->renderVars['view'];

        
if ($saveData === null) {
            $saveData = $this->config->saveData;
        }

        $fileExt = pathinfo($view, PATHINFO_EXTENSION);
        $view    = empty($fileExt) ? $view . '.php' : $view; // allow Views as .html, .tpl, etc (from CI3)
        $cacheName = $options['cache_name'] ?? str_replace('.php', '', $view);

        // Was it cached?         if (isset($options['cache']) && ($output = cache($cacheName))) {
            $this->logPerformance($startmicrotime(true)$view);

            return $output;
        }

        $file = $this->viewPath . $view;

        if (is_file($file)) {
            $fileOrig = $file;
            $file     = $this->loader->locateFile($view, 'Views');

            // locateFile will return an empty string if the file cannot be found.
Home | Imprint | This part of the site doesn't use cookies.