Check whether another server is running at an address.

@param string $address

@return bool|int
545684
protected function isServerRunningForAddress($address)
    {
        $pidFile = $this->getPidFile($address);
        $serverInfo = $this->getServerInfo();
        if (file_exists($pidFile)) {
            $pid = file_get_contents($pidFile);
        } elseif (isset($serverInfo[$address])) {
            $pid = $serverInfo[$address]['pid'];
        }

        if (!empty($pid) && !$this->isProcessDead($pid)) {
            return $pid;
        } elseif (!empty($pid)) {
            // The PID is no longer valid. Delete the lock file and
            // continue.
            $this->stopServer($address);
        }

        list($hostname, $port) = explode(':', $address);

        return PortUtil::isPortInUse($port, $hostname);
    }
137917
public function setLocalIpAddress($address)
    {
        if (!filter_var($address, FILTER_VALIDATE_IP)) {
            throw new \InvalidArgumentException('Invalid ip address');
        }

        $this->networkIpVersion = (strpos($address, ':') ===
                                   false) ? NetworkNodeInterface::IP_V4 : NetworkNodeInterface::IP_V6;
        $this->networkLocalIp = $address;
    }
463815
private function validateAddress($ip_address)
    {
        return filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ||
            filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
    }
1263522
private function canUserDeleteShippingAddress($address)
    {
        $canDelete = false;
        $user = $this->getUser();
        if ($address->oxaddress__oxuserid->value === $user->getId()) {
            $canDelete = true;
        }

        return $canDelete;
    }
249448
public function checkAddress($address)
    {
        $addr = $this->decodeBase58($address);
        if (strlen($addr) != 50) {
            return false;
        }
        $check = substr($addr, 0, strlen($addr) - 8);
        $check = pack('H*', $check);
        $check = strtoupper(hash('sha256', hash('sha256', $check, true)));
        $check = substr($check, 0, 8);

        return $check == substr($addr, strlen($addr) - 8);
    }
513300
protected function _isGroup($address)
    {
        // First comma not in quotes, angles or escaped:
        $parts  = explode(',', $address);
        $string = $this->_splitCheck($parts, ',');

        // Now we have the first address, we can reliably check for a
        // group by searching for a colon that's not escaped or in
        // quotes or angle brackets.
        if (count($parts = explode(':', $string)) > 1) {
            $string2 = $this->_splitCheck($parts, ':');
            return ($string2 !== $string);
        } else {
            return false;
        }
    }
1111202
private function lookupIP($address)
    {
        // Create the responses storage array
        $responses = [];

        // Query every server in the IP list
        foreach ($this->servers->ip as $server) {
            // Check if we haven't queried this server yet
            if (array_key_exists($server, $responses)) {
                continue;
            }

            // Query the server
            $responses[$server] = $this->query($address, $server);
        }

        // Create a result object
        $result = new Result();

        // Set target
        $result->target = $address;

        // Set the type
        $result->type = 'ip';

        // Set response count
        $result->count = count($responses);

        // Set responses
        $result->responses = array_reverse($responses);

        // Return the Result object
        return $result;
    }
137758
protected function validateAddress($address)
    {
        if ($address == 'any') {
            return;
        }
        $extractIp = preg_match('#^([^/]+)(/([0-9]{1,2}))?$#', $address, $matches);
        if (!$extractIp || !filter_var($matches[1], FILTER_VALIDATE_IP) || (isset($matches[3]) && $matches[3] > 32)) {
            $message = sprintf('The address "<error>%s</error>" is not a valid IP address or CIDR', $address);
            throw new InvalidArgumentException($message);
        }
    }
995315
public static function verifyFormatting($p_address)
    {
        if (strstr($p_address, "@") == false) {
            return false;
        } else {
            list($user, $domain) = explode('@', $p_address);
            if (strstr($domain, '.') == false) {
                return false;
            } else {
                return true;
            }
        }
    }
902523
static public function fromAddress($address)
    {
        if ($address instanceof Address) {
            $addr = $address->toClean();
            $prefix = substr($addr, 0, 1);
        }
        elseif (is_string($address)) {
            $prefix = substr($address, 0, 1);
        }
        else {
            throw new \InvalidArgumentException("Could not identify address format: " . var_export($address, true));
        }

        foreach (self::$networkInfos as $name => $spec) {
            $netChar = $spec['char'];

            if ($prefix == $netChar)
                return $spec["id"];
        }

        throw new \InvalidArgumentException("Could not identify network from provided address: " . var_export($address, true));
    }
247122
public function connect($address)
    {
        $factory = new Factory($this->eventLoop);

        return $factory->createClient($address)
            ->then(function (Client $client) {
                $this->amiClient = $client;
                $this->actionSender = new ActionSender($client);
                $this->actionSender->events(true);
                $client->on('close', function () {
                    $this->logger->debug('AMI connection closed');
                });
                $client->on('event', function (Event $event) {
                    $this->wsClient->emit($event->getName(), (array)$event);
                });
            }, function (\Exception $e) {
                $this->logger->err('Connection error: '.$e->getMessage());
            });
    }
449274
public static function verifyDomain($p_address)
    {
        $record              = 'MX';
        list($user, $domain) = explode('@', $p_address);
        
        return checkdnsrr($domain, $record);
    }
519157
public function hasAddress($email)
    {
        foreach ($this->addresses as $addr) {
            if (strcasecmp($addr->getEmail(), $email) === 0) {
                return true;
            }
        }
        return false;
    }
62143
public function getEntry(Address $address)
    {
        $events = array_filter($this->events, function (Entry $entry) use ($address) {
            return $entry->getAddress()->isMatch($address);
        });
        $last_matching_entry = null;
        foreach ($events as $entry) {
            if ($entry->getAddress()->isEntireCache() || $entry->getAddress()->isEntireBin()) {
                $last_matching_entry = null;
            } elseif (!is_null($entry->expiration) && $entry->expiration < $_SERVER['REQUEST_TIME']) {
                $last_matching_entry = null;
            } else {
                $last_matching_entry = clone $entry;
            }
        }
        // Last event was a deletion, so miss.
        if (is_null($last_matching_entry) || is_null($last_matching_entry->value)) {
            $this->misses++;
            return null;
        }

        $unserialized_value = @unserialize($last_matching_entry->value);

        // If unserialization failed, miss.
        if (false === $unserialized_value && serialize(false) !== $last_matching_entry->value) {
            throw new UnserializationException($address, $last_matching_entry->value);
        }

        $last_matching_entry->value = $unserialized_value;

        $this->hits++;
        return $last_matching_entry;
    }
565116
public function trimAddress($address)
    {
        $address = trim($address);

        return (($address[0] == '<') && (substr($address, -1) == '>'))
            ? substr($address, 1, -1)
            : $address;
    }
735095
private function checkHost(string $host): bool
    {
        return '' !== $host && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')));
    }
1333732
public function contains(AddressInterface $address)
    {
        $result = false;
        if ($address->getAddressType() === $this->getAddressType()) {
            if ($address->toString(false) === $this->address->toString(false)) {
                $result = true;
            }
        }

        return $result;
    }