is_string
laravel/octane
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Find whether the type of a variable is string
is_string
(
mixed $value
):
bool
$basePath
=
$_SERVER
[
'APP_BASE_PATH'
] ??
$_ENV
[
'APP_BASE_PATH'
] ??
$serverState
[
'octaneConfig'
][
'base_path'
] ??
null
;
if (!
is_string
(
$basePath
)) {
fwrite
(
STDERR
,
'Cannot find application base path.'
.
PHP_EOL
);
exit(
11
);
bin/bootstrap.php
public function
warm
(
Application $app
, array
$services
= []):
Application
{
foreach (
$services
?:
$app
->
make
(
'config'
)->
get
(
'octane.warm'
, []) as
$service
) {
if (
is_string
(
$service
) &&
$app
->
bound
(
$service
)) {
$app
->
make
(
$service
);
}
}
src/ApplicationFactory.php
$store
->
interval
(
'foo'
, fn () =>
Str
::
random
(
10
),
1
);
$this
->
assertTrue
(
is_string
(
$first
=
$store
->
get
(
'foo'
)));
Carbon
::
setTestNow
(
now
()->
addMinutes
(
1
));
tests/OctaneStoreTest.php
$store
->
refreshIntervalCaches
();
$this
->
assertTrue
(
is_string
(
$second
=
$store
->
get
(
'foo'
)));
$this
->
assertNotEquals
(
$first
,
$second
);
Carbon
::
setTestNow
();
tests/OctaneStoreTest.php