Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NoProxyPattern.php

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\Util

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal