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

Already on GitHub? Sign in to your account

[Console] Add FormatterHelper::truncate docs #6186

Conversation

marek-pietrzak-tg
Copy link
Contributor

Q A
Doc fix? no
New docs? yes (symfony/symfony#16652)
Applies to 3.1
Fixed tickets -

Negative String Length
~~~~~~~~~~~~~~~~~~~~~~

If the length is negative, number of letters to truncate is counted from the end of the message::
Copy link
Member

Choose a reason for hiding this comment

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

I'd replace letters by characters to be more precise. And I'd replace end of the message by end of the string to be more "agnostic".

@javiereguiluz
Copy link
Member

I left some comments but overall it looks OK. @mheki thanks for providing this feature and for providing its docs too!

@marek-pietrzak-tg
Copy link
Contributor Author

Thanks for the feedback @javiereguiluz all changed now

@OskarStark
Copy link
Contributor

Status: Reviewed

Thank you @mheki


This is...

Message is truncated to the given length, then the suffix is appended to end
Copy link
Member

Choose a reason for hiding this comment

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

The message [...]

@xabbuh
Copy link
Member

xabbuh commented Feb 6, 2016

I think I would not add several code blocks for the different ways to configure the suffix, but instead add a large code block which contains several examples and comments that explain what the result of each example will be.

@marek-pietrzak-tg
Copy link
Contributor Author

I've applied your suggestions @xabbuh

@wouterj wouterj added this to the 3.1 milestone Feb 7, 2016
@wouterj
Copy link
Member

wouterj commented Feb 7, 2016

👍

$truncatedMessage = $formatter->truncate($message, 7, ''); // result: This is
$truncatedMessage = $formatter->truncate('test', 10));
/* result: test
because length of the "test..." string is shorter than 10 */
Copy link
Member

Choose a reason for hiding this comment

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

Is this right? I think only the length of the string test is taken into account when deciding whether or not to truncate.

Copy link
Member

Choose a reason for hiding this comment

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

ah no, looking at the code, you are right

@xabbuh
Copy link
Member

xabbuh commented Feb 7, 2016

Thank you @mheki.

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

Successfully merging this pull request may close these issues.

None yet

5 participants