Skip to content

Commit

Permalink
typo and licence update
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Aug 22, 2012
1 parent bd70cab commit ef3e647
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
23 changes: 12 additions & 11 deletions Dumping-PHP-Data-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ JSON convention to dump any PHP variable with high accuracy
===========================================================

Nicolas Grekas - nicolas.grekas, gmail.com
October 4, 2011 - Last updated on jan. 17, 2012
October 4, 2011 - Last updated on aug. 22, 2012

English version: https://github.com/nicolas-grekas/Patchwork-Doc/blob/master/Dumping-PHP-Data-en.md
Version française : https://github.com/nicolas-grekas/Patchwork-Doc/blob/master/Dumping-PHP-Data-fr.md
Expand Down Expand Up @@ -85,8 +85,8 @@ For example: `echo (string) opendir('.');` may display `Resource id #2`, where
Resources are therefore very similar to PHP objects: they are passed "by
reference", have a type and properties.

Warning: in the general case, the `is_resource()` function is not reliable to
detect variables of type `resource`.
Warning: in the general case, the `is_resource()` function is not reliable for
detecting variables of type `resource`.
See [this comment](http://php.net/is_resource#103942) in the PHP doc.

References
Expand Down Expand Up @@ -237,8 +237,11 @@ added rules:
* keys for protected properties of objects are prefixed by `*:`
* keys for private properties of objects are prefixed by the class name they are
bind to followed by a `:`
* other keys are prefixed by a `:` when they collide with a reserved key or when
they contain a `:`
* keys for public properties of objects are prefixed by a `:` when they collide
with a reserved key or when they contain a `:`
* keys for meta-data of objects are prefixed by `~:`. Meta-data can be anything
that is relevant to the understanding of one object: static property, special
state for internal classes (e.g. a closure's start and end line), etc.

Reserved keys have semantics defined as follows:

Expand All @@ -252,7 +255,7 @@ Reserved keys have semantics defined as follows:
* `"__cutBy"` contains the number of truncated elements when the local structure
has been cut by a depth or a length limit e.g.
* `"__refs"` contains a map of internal references of the main structure (see
later). It should be present only at the last position at the lowest depth
below). It should be present only at the last position at the lowest depth
* `"__proto__"` has no special semantics but is reserved for compatibility with
some browsers

Expand All @@ -265,7 +268,7 @@ references into account.

When a reference to a previous position is encountered, it is possible to avoid
repeating its value a second time by inserting a ``"R`"`` if the two positions
are aliases of each other, and ``"r`"`` if both contain the same object or
are aliases of each other, and a ``"r`"`` if both contain the same object or
resource. The substitution by ``"R`"`` is only required for recursive references
because it is sometimes more interesting to dump the local value instead. This
is for example the case when the first occurrence of an object was cut due to a
Expand Down Expand Up @@ -423,7 +426,7 @@ class extracted from the [Patchwork](https://github.com/nicolas-grekas/Patchwork
framework provides JSON representations that follow the format described above.

This class inherits from the `Dumper` class, itself inheriting from the `Walker`
class, all three distributed under the LGPL terms.
class, all three distributed under the Apache 2.0 / GPLv2.0 terms.

`Walker` is an abstract class that implements the mechanism to generically
traverse any PHP variable, taking internal references into account, recursive
Expand Down Expand Up @@ -606,9 +609,7 @@ especially errors and displays for debugging. Patchwork also adds a JavaScript
client that allows keen visual display of this specific kind of JSON.

If other frameworks wish to exploit this convention, they are welcomed reusing
the current implementation under the LGPL terms. If this license or the
implementation does not suit them, they are also welcomed to make another
implementation (Xdebug?).
the current implementation under the Apache 2.0 / GPLv2.0 terms.

On the other hand, there is still work to be done to enhance the displaying
of the JSON. Many other clients could also be made: integrated to an IDE,
Expand Down
19 changes: 12 additions & 7 deletions Dumping-PHP-Data-fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Convention pour représenter avec fidélité une variable PHP en JSON
==================================================================

Nicolas Grekas - nicolas.grekas, gmail.com
4 octobre 2011 - Dernière mise à jour le 17 jan. 2012
4 octobre 2011 - Dernière mise à jour le 22 août 2012

Version française : https://github.com/nicolas-grekas/Patchwork-Doc/blob/master/Dumping-PHP-Data-fr.md
English version: https://github.com/nicolas-grekas/Patchwork-Doc/blob/master/Dumping-PHP-Data-en.md
Expand Down Expand Up @@ -268,8 +268,13 @@ JSON, selon les règles suivantes :
par `*:`
* les clefs correspondant à des propriétés privées d'objets sont préfixées par
le nom de la classe qui leur est associée suivie d'un `:`,
* les autres clefs sont préfixées par un `:` lorsqu'elles entrent en collision
avec une clef réservée ou qu'elles contiennent un `:`.
* les clefs clefs correspondant à des propriétés publiques d'objets sont
préfixées par un `:` lorsqu'elles entrent en collision avec une clef réservée
ou qu'elles contiennent un `:`,
* les clefs correspondant à des méta-données sont préfixées par `~:`. N'importe
quelle méta-donnée peut-être associée à un objet pour faciliter sa
compréhension : propriété statique, état spécial géré par une classe interne
(les lignes de début et de fin d'une closure par ex.), etc.

Les clefs réservées ont une sémantique définie ainsi :

Expand Down Expand Up @@ -464,7 +469,8 @@ permet d'obtenir des représentations JSON qui respectent le format décrit
précédemment.

C'est une classe dérivée de la class `Dumper`, elle même dérivée de la classe
`Walker`, toutes les trois distribuées selon les termes de la LGPL.
`Walker`, toutes les trois distribuées selon les termes, au choix, des licenses
Apache 2.0 ou GPLv2.0.

`Walker` est une classe abstraite qui implémente le mécanisme nécessaire pour
parcourir de façon générique n'importe quelle variable PHP, en tenant compte des
Expand Down Expand Up @@ -653,9 +659,8 @@ Patchwork ajoute également un client JavaScript, qui permet de représenter
visuellement l'information contenue dans le JSON, pour plus d'ergonomie.

Si d'autres frameworks souhaitent exploiter cette convention, ils sont libres de
réutiliser l'implémentation actuelle selon les termes de la LGPL. Si cette
licence ou cette implémentation ne leur convenait pas, ils sont libres également
de réaliser une autre implémentation (Xdebug ?).
réutiliser l'implémentation actuelle selon les termes, au choix, des licenses
Apache 2.0 ou GPLv2.0.

D'un autre côté, il reste encore du travail pour rendre plus ergonomique le
client de représentation visuelle des JSON. Mais de nombreux autres clients
Expand Down

0 comments on commit ef3e647

Please sign in to comment.