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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameter to allow customization of indentation #1

Merged
merged 2 commits into from Aug 27, 2013

Conversation

Projects
None yet
2 participants
@hglattergotz
Contributor

hglattergotz commented Aug 27, 2013

The indentation is hard coded as a tab ("\t") character, which is not
always desirable. The prettify method should have a parameter that
allows the caller to pass the indentation string to be used.
Add parameter with default value so any existing code is not broken.

Add parameter to allow customization of indentation
The indentation is hard coded as a tab ("\t") character, which is not
always desirable. The prettify method should have a parameter that
allows the caller to pass the indentation string to be used.
* @return string The prettified json string
*/
protected function process($json)
protected function process($json, $indentation = "\t")

This comment has been minimized.

@camspiers

camspiers Aug 27, 2013

Owner

Minor change. Can you name this $indent?

@camspiers

This comment has been minimized.

Owner

camspiers commented Aug 27, 2013

Thanks @hglattergotz this is a great change. I will merge if you can make that minor change 👍

@hglattergotz

This comment has been minimized.

Contributor

hglattergotz commented Aug 27, 2013

That change would conflict with the internal $indent variable in the process method. Would you be ok to rename the variable to $indentCount so we can rename the parameter from $indentation to $indent as you requested?

@camspiers

This comment has been minimized.

Owner

camspiers commented Aug 27, 2013

That would be perfect. It is just consistency that I am wanting, so any way to make is consistent is fine.

camspiers added a commit that referenced this pull request Aug 27, 2013

Merge pull request #1 from hglattergotz/indentfix
Add parameter to allow customization of indentation

@camspiers camspiers merged commit 7ea1c76 into camspiers:master Aug 27, 2013

1 check passed

default The Travis CI build passed
Details

@hglattergotz hglattergotz deleted the hglattergotz:indentfix branch Aug 27, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment