public function getCpuCoreCount()
{
if ('darwin' === strtolower(PHP_OS)) {
$sysctl = `/usr/sbin/sysctl hw.ncpu`;
$matches = array();
preg_match('/hw.ncpu: ([0-9\\.]*)/', $sysctl, $matches);
if (!$matches) {
return 0;
}
return $matches[1] + 0;
} else {
if ('linux' === strtolower(PHP_OS)) {
return `nproc` + 0;
}
}
return 1;
}