Closed dominics closed 3 years ago
What if the response had methods for each row?
$info->getDisqueVersion(), $info->getRegisteredJobs()...
?
Or at the very least it could define all known keys as constants, so that the developer can access them by $info[InfoResponse::DISQUE_VERSION]
.
What do you think about it?
I like both approaches
On Sat, Mar 11, 2017 at 12:12 Revisor notifications@github.com wrote:
What if the response had methods for each row?
$info->getDisqueVersion(), $info->getRegisteredJobs()...?
Or at the very least it could define all known keys as constants, so that the developer can access them by $info[InfoResponse::DISQUE_VERSION].
What do you think about it?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mariano/disque-php/pull/43#issuecomment-285872521, or mute the thread https://github.com/notifications/unsubscribe-auth/AABIps2JvW25s-LUcgsGPLphi6vjCZ_eks5rkrnCgaJpZM4MaNuK .
Instead of responding to
->info()
with a large string (# Server\r\ndisque_version:1.0-rc1\r\ndisque_git_sha1:00000000\r\netc..
), lets parse the information nicely. The output is divided into sections by headings, so those end up as keys in an associative array.This approach is largely based on the Predis
ServerInfoV26x.php
class - so, thank @nrk for this.This is a breaking change; anyone relying on
$client->info()
returning a string would be affected. So, this should probably wait until we have a 3.0 branch. (Happy to rebase the PR at that point.) Breaking change noted in the CHANGELOG.Here's a
json_encode($client->info())
: