Sha256: eeb8aa77d84f03b5a175cad8c0057997b948861e2d869b61bcacbc72d30e6008

Contents?: true

Size: 1022 Bytes

Versions: 7

Compression:

Stored size: 1022 Bytes

Contents

<?php

namespace Predis\Commands;

class ServerClient extends Command {
    public function getId() {
        return 'CLIENT';
    }

    protected function onPrefixKeys(Array $arguments, $prefix) {
        /* NOOP */
    }

    protected function canBeHashed() {
        return false;
    }

    public function parseResponse($data) {
        $args = array_change_key_case($this->getArguments(), CASE_UPPER);
        switch (strtoupper($args[0])) {
            case 'LIST':
                return $this->parseClientList($data);
            case 'KILL':
            default:
                return $data;
        }
    }

    protected function parseClientList($data) {
        $clients = array();
        foreach (explode("\n", $data, -1) as $clientData) {
            $client = array();
            foreach (explode(' ', $clientData) as $kv) {
                @list($k, $v) = explode('=', $kv);
                $client[$k] = $v;
            }
            $clients[] = $client;
        }
        return $clients;
    }
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
appstats-0.25.1 doc/benchmarks/Predis/Commands/ServerClient.php
appstats-0.25.0 doc/benchmarks/Predis/Commands/ServerClient.php
appstats-0.24.0 doc/benchmarks/Predis/Commands/ServerClient.php
appstats-0.23.5 doc/benchmarks/Predis/Commands/ServerClient.php
appstats-0.23.4 doc/benchmarks/Predis/Commands/ServerClient.php
appstats-0.23.3 doc/benchmarks/Predis/Commands/ServerClient.php
appstats-0.23.2 doc/benchmarks/Predis/Commands/ServerClient.php