function NoProxyPattern::ipGetMask
Returns the binary network mask mapped to IPv6
Parameters
int $prefix CIDR prefix-length:
int $size Byte size of in_addr:
1 call to NoProxyPattern::ipGetMask()
- NoProxyPattern::ipGetNetwork in vendor/
composer/ composer/ src/ Composer/ Util/ NoProxyPattern.php - Calculates and returns the network and mask
File
-
vendor/
composer/ composer/ src/ Composer/ Util/ NoProxyPattern.php, line 257
Class
- NoProxyPattern
- Tests URLs against NO_PROXY patterns
Namespace
Composer\UtilCode
private function ipGetMask(int $prefix, int $size) : string {
$mask = '';
if ($ones = floor($prefix / 8)) {
$mask = str_repeat(chr(255), (int) $ones);
}
if ($remainder = $prefix % 8) {
$mask .= chr(0xff ^ 0xff >> $remainder);
}
$mask = str_pad($mask, $size, chr(0));
return $this->ipMapTo6($mask, $size);
}