Checks for a group at the start of the string.

@param string $address The address to check.
@return boolean Whether or not there is a group at the start of the string.
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;
        }
    }
1271302
public function geocode($address)
    {
        $query = $this->buildQuery('address', $address);

        $response = $this->validateResponse(
            $this->getResponse($query)
        );

        return $this->buildResults($response['results']);
    }
807146
public function cleanAddress($address)
    {
        $response = $this->query($this->prepareUri('clean/address'), [$address]);
        $result = $this->populate(new Address, $response);
        if (!$result instanceof Address) {
            throw new RuntimeException('Unexpected populate result: ' . get_class($result). '. Expected: ' . Address::class);
        }

        return $result;
    }
147545
public static function isAccountAddressValid(string $address): bool
    {
        // validate format
        if (1 === preg_match('/^[0-9a-fA-F]{4}-[0-9a-fA-F]{8}-([0-9a-fA-F]{4}|XXXX)$/', $address)) {
            // validate checksum
            $checksum = strtoupper(substr($address, -4));
            if ('XXXX' === $checksum) {
                // 'XXXX' is allowed as checksum replacement
                return true;
            }
            $nodeId = substr($address, 0, 4);
            $userId = substr($address, 5, 8);
            $checksumComputed = AdsChecksumGenerator::getAccountChecksum(hexdec($nodeId), hexdec($userId));
            return $checksum === $checksumComputed;
        }
        return false;
    }
813822
public static function locate($address)
	{
		$ip = false;
		if (filter_var($address, FILTER_VALIDATE_IP))
		{
			$ip = true;
		}

		$adapter  = new \Geocoder\HttpAdapter\CurlHttpAdapter();

		$p = array();

		// Get a list of providers
		if ($providers = \Event::trigger('geocode.onGeocodeProvider', array('geocode.locate', $adapter, $ip)))
		{
			foreach ($providers as $provider)
			{
				if ($provider)
				{
					$p[] = $provider;
				}
			}
		}

		if (!count($p))
		{
			return '';
		}

		// Instantiate the Geocoder service and pass it the list of providers
		$geocoder = new \Geocoder\Geocoder();
		$geocoder->registerProvider(new \Geocoder\Provider\ChainProvider($p));

		// Try to get some data...
		return $geocoder->geocode($address);
	}
259391
public function getGroupsForAddress($address)
    {
        $groupTitles = [];

        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_category');
        $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
        $result = $queryBuilder
            ->select('c.*')
            ->from('sys_category', 'c')
            ->join(
                'c',
                'sys_category_record_mm',
                'mm',
                $queryBuilder->expr()->eq(
                    'c.uid',
                    $queryBuilder->quoteIdentifier('mm.uid_local')
                )
            )
            ->where(
                $queryBuilder->expr()->eq('mm.uid_foreign', $queryBuilder->createNamedParameter((int)$address['uid'], \PDO::PARAM_INT)),
                $queryBuilder->expr()->eq('mm.tablenames', $queryBuilder->createNamedParameter('tt_address', \PDO::PARAM_STR)),
                $queryBuilder->expr()->eq('mm.fieldname', $queryBuilder->createNamedParameter('categories', \PDO::PARAM_STR))
            )
            ->orderBy('mm.sorting_foreign')
            ->execute();
        while ($groupRecord = $result->fetch()) {
            if ($this->getTypoScriptFrontendController()->sys_language_content) {
                $groupRecord = $this->getTypoScriptFrontendController()->sys_page->getRecordOverlay('sys_category',
                    $groupRecord, $this->getTypoScriptFrontendController()->sys_language_content);
            }
            if ($groupRecord) {
                $address['groups'][] = $groupRecord;
                $groupTitles[] = $groupRecord['title'];
            }
        }

        $groupList = implode(', ', $groupTitles);
        $address['groupList'] = $groupList;
        return $address;
    }
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));
    }
1249274
protected function _execute($address) {
		/** @var \Geo\Model\Table\GeocodedAddressesTable|null $GeocodedAddresses */
		$GeocodedAddresses = null;
		if ($this->getConfig('cache')) {
			$GeocodedAddresses = TableRegistry::get('Geo.GeocodedAddresses');
			/** @var \Geo\Model\Entity\GeocodedAddress $result */
			$result = $GeocodedAddresses->find()->where(['address' => $address])->first();
			if ($result) {
				/** @var \Geocoder\Model\Address|null $data */
				$data = $result->data;
				return $data ?: null;
			}
		}

		try {
			$addresses = $this->_Geocoder->geocode($address);
		} catch (InconclusiveException $e) {
			$addresses = null;
		} catch (NotAccurateEnoughException $e) {
			$addresses = null;
		}
		$result = null;
		if ($addresses && $addresses->count() > 0) {
			$result = $addresses->first();
		}

		if ($this->getConfig('cache')) {
			/** @var \Geo\Model\Entity\GeocodedAddress $addressEntity */
			$addressEntity = $GeocodedAddresses->newEntity([
				'address' => $address
			]);
			if ($result) {
				$formatter = new StringFormatter();
				$addressEntity->formatted_address = $formatter->format($result, '%S %n, %z %L');
				$addressEntity->lat = $result->getLatitude();
				$addressEntity->lng = $result->getLongitude();
				$addressEntity->country = $result->getCountry()->getCode();
				$addressEntity->data = $result;
			}

			if (!$GeocodedAddresses->save($addressEntity, ['atomic' => false])) {
				throw new RuntimeException('Could not store geocoding cache data');
			}
		}

		return $result;
	}
1183187
public function getCoordinatesByString(string $address) : CoordinatesInterface
    {
        $url = $this->addressQuery($address);
        $json = $this->fetchUrl($url);

        // convert google data to coordinates
        $coordinates = CoordinatesBuild::create($json->results[0]);

        return $coordinates;
    }
1312000
public function getPrivateKeyByAddress($address)
    {
        $args = [
            (string)$address
        ];

        $priv_key = null;
        try {
            $priv_key = $this->rpc->query("dumpPrivKey", $args);
        } catch (Exceptions\RPCException $e) {
            if ($e->getCode() != RPCErrorCodes::WALLET_ERROR) {
                throw $e;
            }
        }

        return $priv_key;
    }
1252143
public function get(Address $address)
    {
        $entry = $this->getEntry($address);
        if (is_null($entry)) {
            return null;
        }
        return $entry->value;
    }
528733
public function setAddress($address)
    {
        if (null === $address) {
            $this->address = null;
        } elseif ('' == $address) {
            $this->address = '';
        } else {
            $this->assertValidAddress($address);
            $this->address = $address;
        }
        $this->setCachedValue(null);
    }
445727
protected function formatAddress($address, $port)
    {
        if ($port !== 0) {
            if (strpos($address, ':') !== false) {
                $address = '[' . $address . ']';
            }
            $address .= ':' . $port;
        }
        return $address;
    }
1011048
public function at($address)
    {
        if (AddressValidator::validate($address) === false) {
            throw new InvalidArgumentException('Please make sure address is valid.');
        }
        $this->toAddress = AddressFormatter::format($address);

        return $this;
    }
503633
public static function isIP($address)
    {

        //Split the IP address of the form  into parts
        $parts = explode('.', $address);
        //=4 parts
        if (sizeof($parts) != 4) {
            return false;
        }
        foreach ($parts as $part):
            if (empty($part) || !static::number($part) || $part > 255) {
                return false;
            }
        endforeach;

        return true;
    }
565116
public function trimAddress($address)
    {
        $address = trim($address);

        return (($address[0] == '<') && (substr($address, -1) == '>'))
            ? substr($address, 1, -1)
            : $address;
    }
202671
protected function _validateAddress($address)
    {
        $is_group = false;
        $addresses = array();

        if ($address['group']) {
            $is_group = true;

            // Get the group part of the name
            $parts     = explode(':', $address['address']);
            $groupname = $this->_splitCheck($parts, ':');
            $structure = array();

            // And validate the group part of the name.
            if (!$this->_validatePhrase($groupname)){
                $this->error = 'Group name did not validate.';
                return false;
            } else {
                // Don't include groups if we are not nesting
                // them. This avoids returning invalid addresses.
                if ($this->nestGroups) {
                    $structure = new stdClass;
                    $structure->groupname = $groupname;
                }
            }

            $address['address'] = ltrim(substr($address['address'], strlen($groupname . ':')));
        }

        // If a group then split on comma and put into an array.
        // Otherwise, Just put the whole address in an array.
        if ($is_group) {
            while (strlen($address['address']) > 0) {
                $parts       = explode(',', $address['address']);
                $addresses[] = $this->_splitCheck($parts, ',');
                $address['address'] = trim(substr($address['address'], strlen(end($addresses) . ',')));
            }
        } else {
            $addresses[] = $address['address'];
        }

        // Trim the whitespace from all of the address strings.
        array_map('trim', $addresses);

        // Validate each mailbox.
        // Format could be one of: name <geezer@domain.com>
        //                         geezer@domain.com
        //                         geezer
        // ... or any other format valid by RFC 822.
        for ($i = 0; $i < count($addresses); $i++) {
            if (!$this->validateMailbox($addresses[$i])) {
                if (empty($this->error)) {
                    $this->error = 'Validation failed for: ' . $addresses[$i];
                }
                return false;
            }
        }

        // Nested format
        if ($this->nestGroups) {
            if ($is_group) {
                $structure->addresses = $addresses;
            } else {
                $structure = $addresses[0];
            }

        // Flat format
        } else {
            if ($is_group) {
                $structure = array_merge($structure, $addresses);
            } else {
                $structure = $addresses;
            }
        }

        return $structure;
    }