Skip to content
This repository was archived by the owner on Apr 21, 2022. It is now read-only.

Add parameter to allow customization of indentation #1

Merged
merged 2 commits into from
Aug 27, 2013

Conversation

hglattergotz
Copy link
Contributor

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.

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")
Copy link
Owner

Choose a reason for hiding this comment

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

Minor change. Can you name this $indent?

@camspiers
Copy link
Owner

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

@hglattergotz
Copy link
Contributor Author

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
Copy link
Owner

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
Add parameter to allow customization of indentation
@camspiers camspiers merged commit 7ea1c76 into camspiers:master Aug 27, 2013
@hglattergotz hglattergotz deleted the indentfix branch August 27, 2013 15:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants