Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4792930
Environment.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
671 B
Referenced Files
None
Subscribers
None
Environment.php
View Options
<?php
namespace
Keruald\OmniTools\OS
;
use
InvalidArgumentException
;
class
Environment
{
public
static
function
has
(
string
$key
)
:
bool
{
return
array_key_exists
(
$key
,
$_ENV
)
||
array_key_exists
(
$key
,
$_SERVER
);
}
/**
* @throws InvalidArgumentException
*/
public
static
function
get
(
string
$key
)
:
string
{
if
(!
self
::
has
(
$key
))
{
throw
new
InvalidArgumentException
(
"Key not found: $key"
);
}
return
$_ENV
[
$key
]
??
$_SERVER
[
$key
];
}
public
static
function
getOr
(
string
$key
,
string
$default
)
:
string
{
return
$_ENV
[
$key
]
??
$_SERVER
[
$key
]
??
$default
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 21:39 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2435869
Default Alt Text
Environment.php (671 B)
Attached To
Mode
rKOT Keruald OmniTools
Attached
Detach File
Event Timeline
Log In to Comment