tweaked previous merge

This commit is contained in:
Fabien Potencier 2012-12-16 09:41:40 +01:00
parent cbef9c2837
commit b1f2c2b9e9
6 changed files with 18 additions and 24 deletions

View File

@ -64,7 +64,7 @@ abstract class BaseMemcacheProfilerStorage implements ProfilerStorageInterface
list($itemToken, $itemIp, $itemMethod, $itemUrl, $itemTime, $itemParent) = explode("\t", $item, 6);
$itemTime = (int)$itemTime;
$itemTime = (int) $itemTime;
if ($ip && false === strpos($itemIp, $ip) || $url && false === strpos($itemUrl, $url) || $method && false === strpos($itemMethod, $method)) {
continue;

View File

@ -20,7 +20,6 @@ use Memcache;
*/
class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage
{
/**
* @var Memcache
*/
@ -106,5 +105,4 @@ class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage
return $memcache->set($key, $content . $value, false, $expiration);
}
}

View File

@ -20,7 +20,6 @@ use Memcached;
*/
class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage
{
/**
* @var Memcached
*/
@ -101,5 +100,4 @@ class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage
return $result;
}
}

View File

@ -163,29 +163,27 @@ class Profiler
* @param string $url The URL
* @param string $limit The maximum number of tokens to return
* @param string $method The request method
* @param int $start The start period to search from
* @param int $end The end period to search to
* @param string $start The start date to search from
* @param string $end The end date to search to
*
* @return array An array of tokens
*
* @see http://fr2.php.net/manual/en/datetime.formats.php for the supported date/time formats
*/
public function find($ip, $url, $limit, $method, $start, $end)
{
if ($start != '' && null !== $start) {
if (is_integer($start)) {
$start = '@' . $start;
}
if ('' != $start && null !== $start) {
$start = new \DateTime($start);
$start = $start->getTimestamp();
} else {
$start = null;
}
if ($end != '' && null !== $end) {
if (is_integer($end)) {
$end = '@' . $end;
}
if ('' != $end && null !== $end) {
$end = new \DateTime($end);
$end = $end->getTimestamp();
} else {
$end = null;
}
return $this->storage->find($ip, $url, $limit, $method, $start, $end);

View File

@ -21,12 +21,12 @@ interface ProfilerStorageInterface
/**
* Finds profiler tokens for the given criteria.
*
* @param string $ip The IP
* @param string $url The URL
* @param string $limit The maximum number of tokens to return
* @param string $method The request method
* @param int $start The start period to search from
* @param int $end The end period to search to
* @param string $ip The IP
* @param string $url The URL
* @param string $limit The maximum number of tokens to return
* @param string $method The request method
* @param int|null $start The start date to search from
* @param int|null $end The end date to search to
*
* @return array An array of tokens
*/

View File

@ -74,7 +74,7 @@ class RedisProfilerStorage implements ProfilerStorageInterface
list($itemToken, $itemIp, $itemMethod, $itemUrl, $itemTime, $itemParent) = explode("\t", $item, 6);
$itemTime = (int)$itemTime;
$itemTime = (int) $itemTime;
if ($ip && false === strpos($itemIp, $ip) || $url && false === strpos($itemUrl, $url) || $method && false === strpos($itemMethod, $method)) {
continue;