rtrim
symfony/var-dumper
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Strip whitespace (or other characters) from the end of a string
Alias
chop
rtrim
(
string $string
,
string $characters
=
" \n\r\t\v\x00"
):
string
$format
.=
$i
->
h
||
$i
->
i
||
$i
->
s
||
$i
->
f
?
'%H:%I:'
.
self
::
formatSeconds
(
$i
->
s
,
substr
(
$i
->
f
,
2
)) :
''
;
$format
=
'%R '
===
$format
?
'0s'
:
$format
;
return
$i
->
format
(
rtrim
(
$format
));
}
public static function
castTimeZone
(
\DateTimeZone $timeZone
, array
$a
,
Stub $stub
,
bool $isNested
,
int $filter
)
Caster/DateCaster.php
private static function
formatSeconds
(
string $s
,
string $us
):
string
{
return
sprintf
(
'%02d.%s'
,
$s
,
0
=== (
$len
=
\strlen
(
$t
=
rtrim
(
$us
,
'0'
))) ?
'0'
: (
$len
<=
3
?
str_pad
(
$t
,
3
,
'0'
) :
$us
));
}
}
Caster/DateCaster.php
$this
->
lastIdentifier
=
$request
[
'identifier'
];
$section
=
sprintf
(
'%s %s'
,
$request
[
'method'
],
$request
[
'uri'
]);
if (
$controller
=
$request
[
'controller'
]) {
$rows
[] = [
'controller'
,
rtrim
(
$this
->
dumper
->
dump
(
$controller
,
true
),
"\n"
)];
}
} elseif (isset(
$context
[
'cli'
])) {
$this
->
lastIdentifier
=
$context
[
'cli'
][
'identifier'
];
Command/Descriptor/CliDescriptor.php
return
null
;
}
return
rtrim
(
$dumper
->
dump
(
$data
,
true
));
}
private function
prepareExpectation
(
$expected
,
int $filter
):
string
Test/VarDumperTestTrait.php
$expected
=
$this
->
getDump
(
$expected
,
null
,
$filter
);
}
return
rtrim
(
$expected
);
}
}
Test/VarDumperTestTrait.php