A view interface for large object/array dumps
- by user685107
I want to embed in a page a detailed structure report of my model objects, like print_r() or var_export() produce (now I’m doing this with running var_export() on get_object_vars()). But what I actually want to see is only some properties (in most cases), but at this moment I have to use Ctrl+F and seek the variable I want, instead of just staring at it right after the page completes loading. So I’m embedding buttons to show/hide large arrays etc. but thought: ‘What if there already is the thing I do right now?’ So is there?
Update:
What would your ideal interface look like?
First of all, dumped models fit in the first screen. All the properties can be seen at the first look at the screen (there are not many of them, around 10 per each, three models total, so it is possible). Small arrays can be shown unrolled too. Let the size of the array to count it as ‘small’ be definable. Ideally, the user can see values of the properties without doing any click, scrolling the screen or typing something.
There must be some improvements to representing the values, say, if an array is empty, show
array ‘My_big_array’ is empty
and if a boolean variable starting with is_, has_, had_ has a false as the value, make the variable (let us take is_available for example) shown as
is_NOT_available
in red, and if it has true as the value, show
is_available
in green. Without any value shown. The same goes for defined constants.
That would be ideal.
I want to make focus on this kind of switches.
Krumo seems useful, but since it always closes up the variable without making difference of how large it is, I cannot use it as is, but there might appear something similar on github soon :)
Second update starts here:
Any programmer who sees is_available = false will know what it means, no need to do more
Bringing in color indication I forgot about one thing: the ‘switches’ let’s call them so, may me important or not. So I have right now some of them that will show in green or red, this is for something global, like caching, which is shown as
Caching is… ON
with ‘ON’ written in green, (and ‘OFF’ in red when disabled) while the words about what it is, i.e. ‘Caching is… ’ are written in black.
And some which are not so important, for example I haven’t defined
REVEAL_TIES is… not set
with ‘not set’ written in gray, while the words describing what it is stay in black. And if it would be set the whole phrase would be in black since there is nothing important: if this small utility for showing some undercover things is working, I will see some messages after it, if it isn’t — site will be working independently of its state.
Dividing switches into important ones and not with corresponding color match should improve readability, especially for those users who are not programmers and just enabled debug mode because some guy from bugzilla said do that — for them it would help to understand what is important and what is not.