You are here

protected function SqliteProfilerStorage::buildCriteria in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Profiler/SqliteProfilerStorage.php \Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage::buildCriteria()

Build SQL criteria to fetch records by ip and url.

Parameters

string $ip The IP:

string $url The URL:

string $start The start period to search from:

string $end The end period to search to:

string $limit The maximum number of tokens to return:

string $method The request method:

Return value

array An array with (criteria, args)

Overrides PdoProfilerStorage::buildCriteria

File

vendor/symfony/http-kernel/Profiler/SqliteProfilerStorage.php, line 100

Class

SqliteProfilerStorage
SqliteProfilerStorage stores profiling information in a SQLite database.

Namespace

Symfony\Component\HttpKernel\Profiler

Code

protected function buildCriteria($ip, $url, $start, $end, $limit, $method) {
  $criteria = array();
  $args = array();
  if ($ip = preg_replace('/[^\\d\\.]/', '', $ip)) {
    $criteria[] = 'ip LIKE :ip';
    $args[':ip'] = '%' . $ip . '%';
  }
  if ($url) {
    $criteria[] = 'url LIKE :url ESCAPE "\\"';
    $args[':url'] = '%' . addcslashes($url, '%_\\') . '%';
  }
  if ($method) {
    $criteria[] = 'method = :method';
    $args[':method'] = $method;
  }
  if (!empty($start)) {
    $criteria[] = 'time >= :start';
    $args[':start'] = $start;
  }
  if (!empty($end)) {
    $criteria[] = 'time <= :end';
    $args[':end'] = $end;
  }
  return array(
    $criteria,
    $args,
  );
}