/** * Method to test mark(). * * @return void * * @covers \Windwalker\Helper\ProfilerHelper::mark */ public function testMark() { $namespace = 'unit-test'; ProfilerHelper::mark('foo', $namespace); ProfilerHelper::mark('bar', $namespace); ProfilerHelper::mark('foobar', $namespace); $app = Container::getInstance()->get('app'); $buffer = $app->getUserState('windwalker.system.profiler.' . $namespace); $regexpPattern = '/^unit-test [0-9]+\\.[0-9]{3} seconds \\([0-9]+\\.[0-9]{3}\\); [0-9]+\\.[0-9]{2} MB \\([0-9]+\\.[0-9]{3}\\) - %s/'; // Assert $buffer[0] $regexp = sprintf($regexpPattern, 'foo'); $this->assertTrue((bool) preg_match($regexp, $buffer[0])); // Assert $buffer[1] $regexp = sprintf($regexpPattern, 'bar'); $this->assertTrue((bool) preg_match($regexp, $buffer[1])); // Assert $buffer[2] $regexp = sprintf($regexpPattern, 'foobar'); $this->assertTrue((bool) preg_match($regexp, $buffer[2])); }
/** * Method to get a JDatabaseQuery object for retrieving the data set from a database. * * @return JDatabaseQuery A JDatabaseQuery object to retrieve the data set. */ protected function getListQuery() { $query = $this->db->getQuery(true); $queryHelper = $this->getQueryHelper(); // Prepare $this->prepareGetQuery($query); // Build filter query $this->processFilters($query, ArrayHelper::flatten((array) $this->get('filter'))); // Build search query $this->processSearches($query, ArrayHelper::flatten((array) $this->get('search'))); // Ordering $this->processOrdering($query); // Custom Where foreach ((array) $this->state->get('query.where', array()) as $k => $v) { $query->where($v); } // Custom Having foreach ((array) $this->state->get('query.having', array()) as $k => $v) { $query->having($v); } // Build query // ======================================================================== // Get select columns $select = $this->state->get('query.select'); if (!$select) { $select = $queryHelper->getSelectFields(); } $query->select($select); // Build Selected tables query $queryHelper->registerQueryTables($query); $this->postGetQuery($query); // Debug if (JDEBUG) { ProfilerHelper::mark(QueryHelper::highlightQuery($this->db->replacePrefix((string) $query))); } return $query; }
<?php /** * Part of ihealth project. * * @copyright Copyright (C) 2011 - 2014 SMS Taiwan, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ $tpl = \TplLyrasoft\LyrasoftTemplate::getInstance(); $tmpl = $displayData['tmpl']; $layout = $tpl::isHome() ? 'landing' : $tpl->getTemplate()->params->get('layout', 'default'); \Windwalker\Helper\ProfilerHelper::mark('Template Layout: ' . $layout, 'Application'); $menuParams = \Astra\Helper\DocumentHelper::getMenuParams(); ?> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->tpl->language; ?> " lang="<?php echo $this->tpl->language; ?> " dir="<?php echo $this->tpl->direction; ?> "> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="shortcut icon" href="<?php echo $this->tpl->baseurl; ?> /templates/<?php
/** * Method to get a JDatabaseQuery object for retrieving the data set from a database. * * @return JDatabaseQuery A JDatabaseQuery object to retrieve the data set. */ protected function getListQuery() { $query = $this->db->getQuery(true); $queryHelper = $this->container->get('model.' . $this->getName() . '.helper.query'); // Prepare $this->prepareGetQuery($query); // Build filter query $this->processFilters($query, $this->state->get('filter', array())); // Build search query $this->processSearches($query, $this->state->get('search', array())); // Ordering $this->processOrdering($query); // Custom Where foreach ((array) $this->state->get('query.where', array()) as $k => $v) { $query->where($v); } // Custom Having foreach ((array) $this->state->get('query.having', array()) as $k => $v) { $query->having($v); } // Build query // ======================================================================== // Get select columns $select = $this->state->get('query.select'); if (!$select) { $selectType = $this->selectType ?: QueryHelper::COLS_WITH_FIRST | QueryHelper::COLS_PREFIX_WITH_FIRST; $select = $queryHelper->getSelectFields($selectType); } $query->select($select); // Build Selected tables query $queryHelper->registerQueryTables($query); $this->postGetQuery($query); // Debug if (JDEBUG) { ProfilerHelper::mark(QueryHelper::highlightQuery($this->db->replacePrefix((string) $query))); } return $query; }