Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON Compat Library #614

Merged
merged 2 commits into from May 15, 2014
Merged

JSON Compat Library #614

merged 2 commits into from May 15, 2014

Conversation

mal
Copy link
Contributor

@mal mal commented May 13, 2014

Adds a Elastica\JSON class which provides wrappers for json_encode and json_decode.

parse (json_decode)
  • Default to decoding into associative arrays
  • Convert parse errors to exceptions that can be caught and dealt with more intuitively
stringify (json_encode)
Other
  • Removes global constant definitions 馃槍
  • Two commits, in case you don't wish to use the lib everywhere (done for consistency)

If you're happy with this approach, I'll add some additional tests; just didn't want to spend time writing them if you opt not to go this route. Cheers!

$args = func_get_args();

// default to decoding into an assoc array
if (sizeof($args) < 2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use brackets please (like line 37).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@damienalexandre
Copy link
Contributor

I like this 馃憤

@mal
Copy link
Contributor Author

mal commented May 14, 2014

@ruflin Looks like that weird runaway test error is still happening sometimes 馃槮, the majority of the matrix passed normally in under 5 minutes, but two ran the clock out [25142839].

mal added 2 commits May 14, 2014 15:01
- Removes need for global constant definitions
- Allows easier handling of JSON parse errors
@ruflin
Copy link
Owner

ruflin commented May 14, 2014

Yeah, Travis sometimes does that. Not sure why :-( I will restart the build.

I also like this, especially because everything still seems to work :-)

ruflin added a commit that referenced this pull request May 15, 2014
@ruflin ruflin merged commit 58b0928 into ruflin:master May 15, 2014
@ruflin
Copy link
Owner

ruflin commented May 15, 2014

Almost all builds went green. I merged it. Thx. Will be part of the next release.

@mal mal deleted the feature/json-compat branch September 11, 2014 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants