Converts the routing code zipcode.

@param string $zipcode
@return string BCNumber
169178
private static function conversionRoutingCode($zipcode) {
        $number = $zipcode;
        switch (strlen($zipcode)) {
            case 11:
                $number = bcadd($number, '1000000000', 0);
            case 9:
                $number = bcadd($number, '100000', 0);
            case 5:
                $number = bcadd($number, '1', 0);
            default:
                return $number;
        }
    }
1374450
private function _getAddress($addressCode, $birthdayCode)
    {
        $address = '';
        if (isset($this->_addressCodeTimeline[$addressCode])) {
            $timeline = $this->_addressCodeTimeline[$addressCode];
            $year = substr($birthdayCode, 0, 4);
            foreach ($timeline as $key => $val) {
                if (($key == 0 && $year < $val['start_year']) || $year >= $val['start_year']) {
                    $address = $val['address'];
                }
            }
        }

        return $address;
    }
288477
public static function builtInFormatCodeIndex($formatCode)
	{
		// Ensure built-in format codes are available
		self::fillBuiltInFormatCodes();

		// Lookup format code
		if (isset(self::$_flippedBuiltInFormats[$formatCode])) {
			return self::$_flippedBuiltInFormats[$formatCode];
		}

		return false;
	}
953061
public function addZip(Zip $zip): string {

        $id = UniqueId::generate(32);
        $this->zip_archives[$id] = $zip;
        return $id;

    }
823824
public static function code($code = 200) : String
    {
        $messages = Datatype::multikey(self::$messages);

        if( isset($messages[$code]) )
        {
            return $messages[$code];
        }

        return false;
    }
382906
protected function fetchZipCodeAddress()
    {
        $address = $this->parsedXML['consultaCEPResponse']['return'];
        $zipcode = preg_replace('/^([0-9]{5})([0-9]{3})$/', '${1}-${2}', $address['cep']);
        $complement = $this->getComplement($address);

        return [
            'zipcode' => $zipcode,
            'street' => $address['end'],
            'complement' => $complement,
            'district' => $address['bairro'],
            'city' => $address['cidade'],
            'uf' => $address['uf'],
        ];
    }
1078041
public function suggest($zipcode, $number, $addition = null)
    {
      // Concat url
      $url = self::API_URL . '/suggest?q=' . $zipcode . '-' . $number . (!empty($addition) ? '-' . $addition : '');

      // Create a REST request
      $request = new \LibX\Net\Rest\Request($url, \LibX\Net\Rest\Request::REQUEST_METHOD_GET);

      // Create a REST response
      $response = new \LibX\Net\Rest\Response();

      // Make the call
      $data = $this->call($request, $response);

      if($data->response->numFound > 1)
        throw new Exception('More then one document found');

      // Get document
      $document = array_pop($data->response->docs);

      // Check type
      if($document->type !== 'adres')
        throw new Exception('Invalid document type found (' . $doc->type . ')');

      // Get address id
      $id = $document->id;

      return $id;
    }
53240
public static function guess(string $code) : string
    {
        switch (strtolower(trim($code))) {
            case SportMapperInterface::RUNNING:
            case 'run':
                return SportMapperInterface::RUNNING;
            case SportMapperInterface::CYCLING_SPORT:
            case 'cycling':
                return SportMapperInterface::CYCLING_SPORT;
            case SportMapperInterface::CYCLING_TRANSPORT:
                return SportMapperInterface::CYCLING_TRANSPORT;
            case SportMapperInterface::SWIMMING:
                return SportMapperInterface::SWIMMING;
            default:
                return SportMapperInterface::OTHER;
        }
    }
1067790
public function setZipcode($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->zipcode !== $v) {
            $this->zipcode = $v;
            $this->modifiedColumns[DealerVersionTableMap::ZIPCODE] = true;
        }


        return $this;
    }
354196
public function setZipCode($zipCode): Hybrid
    {
        self::validateSetLength('zipCode', $zipCode);
        $this->data['zipCode'] = $zipCode;

        return $this;
    }
87937
public static function BKB($code)
    {
        $r = '';
        for ($i = 0; $i < 40; $i++)
        {
            if ($i % 8 == 0 && $i != 0)
            {
                $r .= '-';
            }
            $r .= $code[$i];
        }
        return $r;
    }
1274364
private function urlEncode6bit($b)
    {
        if ($b < 10) {
            return chr(48 + $b);
        }
        $b -= 10;
        if ($b < 26) {
            return chr(65 + $b);
        }
        $b -= 26;
        if ($b < 26) {
            return chr(97 + $b);
        }
        $b -= 26;
        if ($b == 0) {
            return '-';
        }
        if ($b == 1) {
            return '_';
        }

        return '?';
    }
454860
public static function chr(int $code): string
    {
        $char = pack('N', $code);

        return (string) mb_convert_encoding($char, 'UTF-8', 'UTF-32BE');
    }
300883
public static function unichr($code) {
        if($code > 1114111 or $code < 0 or
          ($code >= 55296 and $code <= 57343) ) {
            // bits are set outside the "valid" range as defined
            // by UNICODE 4.1.0
            return '';
        }

        $x = $y = $z = $w = 0;
        if ($code < 128) {
            // regular ASCII character
            $x = $code;
        } else {
            // set up bits for UTF-8
            $x = ($code & 63) | 128;
            if ($code < 2048) {
                $y = (($code & 2047) >> 6) | 192;
            } else {
                $y = (($code & 4032) >> 6) | 128;
                if($code < 65536) {
                    $z = (($code >> 12) & 15) | 224;
                } else {
                    $z = (($code >> 12) & 63) | 128;
                    $w = (($code >> 18) & 7)  | 240;
                }
            }
        }
        // set up the actual character
        $ret = '';
        if($w) $ret .= chr($w);
        if($z) $ret .= chr($z);
        if($y) $ret .= chr($y);
        $ret .= chr($x);

        return $ret;
    }
1029873
protected function mb_chr($code)
    {
        if (function_exists('mb_chr')) {
            return mb_chr($code);
        } else {
            if (0x80 > $code %= 0x200000) {
                $s = chr($code);
            } elseif (0x800 > $code) {
                $s = chr(0xc0 | $code >> 6) . chr(0x80 | $code & 0x3f);
            } elseif (0x10000 > $code) {
                $s = chr(0xe0 | $code >> 12) . chr(0x80 | $code >> 6 & 0x3f) . chr(0x80 | $code & 0x3f);
            } else {
                $s = chr(0xf0 | $code >> 18) . chr(0x80 | $code >> 12 & 0x3f) . chr(0x80 | $code >> 6 & 0x3f) . chr(0x80 | $code & 0x3f);
            }

            return $s;
        }
    }
628004
public function fromCodePoint($c)
    {
        if ($c < 0x7F) // U+0000-U+007F - 1 byte
            return chr($c);
        if ($c < 0x7FF) // U+0080-U+07FF - 2 bytes
            return chr(0xC0 | ($c >> 6)) . chr(0x80 | ($c & 0x3F));
        if ($c < 0xFFFF) // U+0800-U+FFFF - 3 bytes
            return chr(0xE0 | ($c >> 12)) . chr(0x80 | (($c >> 6) & 0x3F)) . chr(0x80 | ($c & 0x3F));
        // U+010000-U+10FFFF - 4 bytes
        return chr(0xF0 | ($c >> 18)) . chr(0x80 | ($c >> 12) & 0x3F) .chr(0x80 | (($c >> 6) & 0x3F)) . chr(0x80 | ($c & 0x3F));
    }
150209
public function getCode($code, $cardId = null)
    {
        $params = array(
            'code' => $code,
            'card_id' => $cardId,
        );

        return new Bag($this->http->jsonPost(self::API_CODE_GET, $params));
    }