Ignore:
Timestamp:
Apr 6, 2020, 11:56:19 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Do not use parenthesis around returned value.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/NetworkAddress.php

    r873 r874  
    1616  function GetNetMask()
    1717  {
    18     return (((1 << IPV4_BIT_WIDTH) - 1) ^ ((1 << (IPV4_BIT_WIDTH - $this->Prefix)) - 1));
     18    return ((1 << IPV4_BIT_WIDTH) - 1) ^ ((1 << (IPV4_BIT_WIDTH - $this->Prefix)) - 1);
    1919  }
    2020
    2121  function AddressToString()
    2222  {
    23     return (implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255))));
     23    return implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255)));
    2424  }
    2525
     
    3939    $To->Address = $From->Address + $HostMask;
    4040    $To->Prefix = IPV4_BIT_WIDTH;
    41     return (array('From' => $From, 'To' => $To));
     41    return array('From' => $From, 'To' => $To);
    4242  }
    4343
     
    5555    if (($this->Prefix < $Address->Prefix) and (($Address->Address & $UpperNetmask) == ($this->Address & $UpperNetmask))) $Result = true;
    5656      else $Result = false;
    57     return ($Result);
     57    return $Result;
    5858  }
    5959}
     
    7474  function GetNetMask()
    7575  {
    76     return (Int128Xor(Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH)), IntToInt128(1)),
    77       Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH - $this->Prefix)), IntToInt128(1))));
     76    return Int128Xor(Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH)), IntToInt128(1)),
     77      Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH - $this->Prefix)), IntToInt128(1)));
    7878  }
    7979
    8080  function AddressToString()
    8181  {
    82     return (inet_ntop($this->Address));
     82    return inet_ntop($this->Address);
    8383  }
    8484
     
    106106      $Result[] = dechex(($Item >> 4) & 15);
    107107    }
    108     return ($Result);
     108    return $Result;
    109109  }
    110110
     
    129129    if (($this->Prefix < $Address->Prefix) and ((Int128Equal(Int128And($Address->Address, $UpperNetmask), Int128And($this->Address, $UpperNetmask))))) $Result = true;
    130130      else $Result = false;
    131     return ($Result);
     131    return $Result;
    132132  }
    133133}
Note: See TracChangeset for help on using the changeset viewer.