function PEAR::getSourceDateEpoch
Get SOURCE_DATE_EPOCH environment variable See https://reproducible-builds.org/specs/source-date-epoch/
@access public
Return value
int
File
-
vendor/
pear/ pear-core-minimal/ src/ PEAR.php, line 779
Class
- PEAR
- Base class for other PEAR classes. Provides rudimentary emulation of destructors.
Code
static function getSourceDateEpoch() {
if ($source_date_epoch = getenv('SOURCE_DATE_EPOCH')) {
if (preg_match('/^\\d+$/', $source_date_epoch)) {
return (int) $source_date_epoch;
}
else {
// "If the value is malformed, the build process SHOULD exit with a non-zero error code."
self::raiseError("Invalid SOURCE_DATE_EPOCH: {$source_date_epoch}");
exit(1);
}
}
else {
return time();
}
}