-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
[Console] Add FormatterHelper::truncate docs #6186
Conversation
marek-pietrzak-tg
commented
Jan 26, 2016
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:: |
There was a problem hiding this comment.
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".
I left some comments but overall it looks OK. @mheki thanks for providing this feature and for providing its docs too! |
Thanks for the feedback @javiereguiluz all changed now |
Status: Reviewed Thank you @mheki |
|
||
This is... | ||
|
||
Message is truncated to the given length, then the suffix is appended to end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message [...]
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. |
I've applied your suggestions @xabbuh |
👍 |
$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 */ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Thank you @mheki. |