mirror of
https://github.com/predis/predis.git
synced 2026-08-25 07:19:40 +00:00
dc14c29676
Now we follow a Symfony2-like naming convention for namespaces, interfaces and classes sticking with one clear rule. - Renamed namespaces: - Predis\Network - Predis\Profiles - Predis\Iterators - Predis\Options - Predis\Commands - Predis\Commands\Processors - Renamed interfaces: - Predis\IReplyObject - Predis\IRedisServerError - Predis\IConnectionFactory - Predis\IConnectionParameters - Predis\Options\IOption - Predis\Options\IClientOptions - Predis\Profile\IServerProfile - Predis\Pipeline\IPipelineExecutor - Predis\Distribution\INodeKeyGenerator - Predis\Distribution\IDistributionStrategy - Predis\Protocol\IProtocolProcessor - Predis\Protocol\IResponseReader - Predis\Protocol\IResponseHandler - Predis\Protocol\ICommandSerializer - Predis\Protocol\IComposableProtocolProcessor - Predis\Network\IConnection - Predis\Network\IConnectionSingle - Predis\Network\IConnectionComposable - Predis\Network\IConnectionCluster - Predis\Network\IConnectionReplication - Predis\Commands\ICommand - Predis\Commands\IPrefixable - Predis\Command\Processor\ICommandProcessor - Predis\Command\Processor\ICommandProcessorChain - Predis\Command\Processor\IProcessingSupport - Renamed Classes: - Predis\Commands\Command - Predis\Network\ConnectionBase - Classes moved to different namespaces: - Predis\MonitorContext Meh
61 lines
1.4 KiB
PHP
61 lines
1.4 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Predis package.
|
|
*
|
|
* (c) Daniele Alessandri <suppakilla@gmail.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Predis\Command;
|
|
|
|
/**
|
|
* @link http://redis.io/commands/info
|
|
* @author Daniele Alessandri <suppakilla@gmail.com>
|
|
*/
|
|
class ServerInfoV26x extends ServerInfo
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function parseResponse($data)
|
|
{
|
|
$info = array();
|
|
$current = null;
|
|
$infoLines = preg_split('/\r?\n/', $data);
|
|
|
|
if (isset($infoLines[0]) && $infoLines[0][0] !== '#') {
|
|
return parent::parseResponse($data);
|
|
}
|
|
|
|
foreach ($infoLines as $row) {
|
|
if ($row === '') {
|
|
continue;
|
|
}
|
|
|
|
if (preg_match('/^# (\w+)$/', $row, $matches)) {
|
|
$info[$matches[1]] = array();
|
|
$current = &$info[$matches[1]];
|
|
continue;
|
|
}
|
|
|
|
list($k, $v) = explode(':', $row);
|
|
|
|
if (!preg_match('/^db\d+$/', $k)) {
|
|
if ($k === 'allocation_stats') {
|
|
$current[$k] = $this->parseAllocationStats($v);
|
|
continue;
|
|
}
|
|
$current[$k] = $v;
|
|
}
|
|
else {
|
|
$current[$k] = $this->parseDatabaseStats($v);
|
|
}
|
|
}
|
|
|
|
return $info;
|
|
}
|
|
}
|