implode
brefphp/bref
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Join array elements with a string
Alias
join
implode
(
string $separator
, array
$array
):
string
if (
strpos
(
$layer
,
'php-8'
) ===
false
) {
exec
(
"docker run --rm -v \${PWD}/helpers:/var/task/ --entrypoint /var/task/extensions-test.sh
$layer
"
,
$output
,
$exitCode
);
if (
$exitCode
!==
0
) {
throw new
Exception
(
implode
(
PHP_EOL
,
$output
),
$exitCode
);
}
echo
'.'
;
}
runtime/layers/tests.php
$notLoaded
=
array_diff
(
$devExtensions
,
$output
);
if (
$exitCode
!==
0
||
count
(
$notLoaded
) >
0
) {
throw new
Exception
(
implode
(
PHP_EOL
,
array_map
(function (
$extension
) {
return
"Extension
$extension
is not loaded"
;
},
$notLoaded
)),
$exitCode
);
}
echo
'.'
;
}
runtime/layers/tests.php
},
$arguments
);
try {
$result
=
$lambda
->
invoke
(
$function
,
json_encode
(
implode
(
' '
,
$arguments
)));
} catch (
InvocationFailed $e
) {
$io
->
getErrorStyle
()->
writeln
(
'<info>'
.
$e
->
getInvocationLogs
() .
'</info>'
);
$io
->
error
(
$e
->
getMessage
());
src/Console/Command/Cli.php
parse_str
(
implode
(
'&'
,
$queryParameterStr
),
$queryParameters
);
return
http_build_query
(
$queryParameters
);
}
src/Event/Http/HttpRequestEvent.php
if (! empty(
$this
->
event
[
'cookies'
]) &&
$this
->
isFormatV2
()) {
$cookieHeader
=
implode
(
'; '
,
$this
->
event
[
'cookies'
]);
$headers
[
'cookie'
] = [
$cookieHeader
];
}
src/Event/Http/HttpRequestEvent.php
$expectedHeader
=
array_map
(function (
string $value
,
string $key
):
string
{
return
$key
.
'='
.
urlencode
(
$value
);
},
$expected
,
array_keys
(
$expected
));
$this
->
assertEquals
(
implode
(
'; '
,
$expectedHeader
),
$this
->
event
->
getHeaders
()[
'cookie'
][
0
] ??
''
);
}
protected function
assertHeaders
(array
$expected
):
void
tests/Event/Http/HttpRequestEventTest.php
{
$string
=
''
;
foreach (
$response
->
getHeaders
() as
$name
=>
$values
) {
$string
.=
$name
.
': '
.
implode
(
', '
,
$values
) .
"\n"
;
}
$string
.=
"\n"
.
$this
->
getBody
(
$response
) .
"\n"
;
tests/Functional/FpmRuntimeTest.php
{
$string
=
''
;
foreach (
$response
->
getHeaders
() as
$name
=>
$values
) {
$string
.=
$name
.
': '
.
implode
(
', '
,
$values
) .
"\n"
;
}
$string
.=
"\n"
.
$this
->
getBody
(
$response
) .
"\n"
;
tests/Sam/PhpFpmRuntimeTest.php
throw new
\Exception
(
'Invalid response given.'
);
}
$headers
=
array_map
(function (
$h
) {
return
implode
(
' ,'
,
$h
);
},
$response
->
getHeaders
());
$data
[] = [
'status'
=> (string)
$response
->
getStatusCode
(),
tests/Server.php