Function getRawMsisdn

@author: 713uk13m <dev@nguyenanhung.com>
@time  : 10/7/18 08:58

@return bool|null|string
977465
public function getRawMsisdn()
    {
        try {
            $vn_telco_msisdn_header = Repository\DataRepository::getData('vn_telco_msisdn_header');
            $this->debug->debug(__FUNCTION__, 'MSISDN Header Key', $vn_telco_msisdn_header);
            foreach ($vn_telco_msisdn_header as $key) {
                if (array_key_exists($key, $_SERVER) === TRUE) {
                    foreach (explode(',', $_SERVER[$key]) as $key => $msisdn) {
                        $this->debug->info(__FUNCTION__, 'MSISDN Key: ' . json_encode($key));
                        $this->debug->info(__FUNCTION__, 'MSISDN Value: ' . json_encode($msisdn));

                        return trim($msisdn);
                    }
                }
            }

            return FALSE;
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return NULL;
        }
    }
652893
public function getDsn()
    {
        if (!$this->config) {
            return '';
        }
        $dsn = array();
        $path = null;

        if ($this->config->getName()) {
            $path = $this->config->getName();
        }

        if ($this->config->getPath()) {
            $path = $this->config->getPath();
        }

        if ($this->config->getHost()) {
            if ($this->config->getPort()) {
                $dsn[] = sprintf('dbname=%s/%s:%s',
                    $this->config->getHost(),
                    $this->config->getPort(),
                    $path
                );
            } else {
                $dsn[] = sprintf('dbname=%s:%s',
                    $this->config->getHost(),
                    $path
                );
            }
        } else {
            $dsn[] = 'dbname='.$path;
        }

        if ($this->config->getRole()) {
            $dsn[] = 'role='.$this->config->getRole();
        }

        if ($this->config->getChar()) {
            $dsn[] = 'charset='.$this->config->getChar();
        }

        return $this->getPrefix().implode(';', $dsn);
    }
166197
public function getDsn(): string
  {
    # Build the DSN
    $_dsn = $this->driver.':host='.$this->host.';port='.$this->port.';dbname='.$this->schema.';charset='.$this->charset;
    # Set it
    $this->setDsn($_dsn);

    return $this->pdo_dsn;
  }
587947
public function chanCidNum()
    {
        try
        {
            return $this->getSNMP()->walk1d( self::OID_ASTERISK_CHANNEL_CID_NUM );
        }
        catch( \Cityware\Snmp\Exception $e )
        {
            return null;
        }
    }
421976
public static function getCurrentArch(): string
    {
        $arch = php_uname('m');

        if ($arch === "x86_64") {
            $arch = "amd64";
        } elseif ($arch === "i386") {
            $arch = "386";
        } else {
            // TODO: Whats here?
            printf('ERROR: Unexpected, please contact the maintainer or provide a pull request :)%s', PHP_EOL);
            exit(1);
        }

        return $arch;
    }
956458
public function getDSN () {
        $dsn = [];

        // Pick $data_source parameters that make up the DSN string.
        $map = [
            'host' => 'host',
            'port' => 'port',
            'dbname' => 'database',
            'unix_socket' => 'unix_socket',
            'charset' => 'charset'
        ];

        foreach ($map as $dsn_name => $data_source_parameter_name) {
            if (isset($this->data_source[$data_source_parameter_name])) {
                $dsn[] = $dsn_name . '=' . $this->data_source[$data_source_parameter_name];
            }
        }

        if ($dsn) {
            $dsn = $this->data_source['driver'] . ':' . implode(';', $dsn);
        } else {
            $dsn = $this->data_source['driver'];
        }

        return $dsn;
    }
896745
function getDN($format = FILE_X509_DN_ARRAY, $dn = NULL)
    {
        if (!isset($dn)) {
            $dn = isset($this->currentCert['tbsCertList']) ? $this->currentCert['tbsCertList']['issuer'] : $this->dn;
        }

        switch ((int) $format) {
            case FILE_X509_DN_ARRAY:
                return $dn;
            case FILE_X509_DN_ASN1:
                $asn1 = new File_ASN1();
                $asn1->loadOIDs($this->oids);
                $filters = array();
                $filters['rdnSequence']['value'] = array('type' => FILE_ASN1_TYPE_UTF8_STRING);
                $asn1->loadFilters($filters);
                return $asn1->encodeDER($dn, $this->Name);
            case FILE_X509_DN_OPENSSL:
                $dn = $this->getDN(FILE_X509_DN_STRING, $dn);
                if ($dn === false) {
                    return false;
                }
                $attrs = preg_split('#((?:^|, *|/)[a-z][a-z0-9]*=)#i', $dn, -1, PREG_SPLIT_DELIM_CAPTURE);
                $dn = array();
                for ($i = 1; $i < count($attrs); $i += 2) {
                    $prop = trim($attrs[$i], ', =/');
                    $value = $attrs[$i + 1];
                    if (!isset($dn[$prop])) {
                        $dn[$prop] = $value;
                    } else {
                        $dn[$prop] = array_merge((array) $dn[$prop], array($value));
                    }
                }
                return $dn;
            case FILE_X509_DN_CANON:
                //  No SEQUENCE around RDNs and all string values normalized as
                // trimmed lowercase UTF-8 with all spacing  as one blank.
                $asn1 = new File_ASN1();
                $asn1->loadOIDs($this->oids);
                $filters = array();
                $filters['value'] = array('type' => FILE_ASN1_TYPE_UTF8_STRING);
                $asn1->loadFilters($filters);
                $result = '';
                foreach ($dn['rdnSequence'] as $rdn) {
                    foreach ($rdn as &$attr) {
                        if (is_array($attr['value'])) {
                            foreach ($attr['value'] as $type => $v) {
                                $type = array_search($type, $asn1->ANYmap, true);
                                if ($type !== false && isset($asn1->stringTypeSize[$type])) {
                                    $v = $asn1->convert($v, $type);
                                    if ($v !== false) {
                                        $v = preg_replace('/\s+/', ' ', $v);
                                        $attr['value'] = strtolower(trim($v));
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    $result .= $asn1->encodeDER($rdn, $this->RelativeDistinguishedName);
                }
                return $result;
            case FILE_X509_DN_HASH:
                $dn = $this->getDN(FILE_X509_DN_CANON, $dn);
                if (!class_exists('Crypt_Hash')) {
                    require_once('Crypt/Hash.php');
                }
                $hash = new Crypt_Hash('sha1');
                $hash = $hash->hash($dn);
                extract(unpack('Vhash', $hash));
                return strtolower(bin2hex(pack('N', $hash)));
        }

        // Defaut is to return a string.
        $start = true;
        $output = '';
        $asn1 = new File_ASN1();
        foreach ($dn['rdnSequence'] as $field) {
            $prop = $field[0]['type'];
            $value = $field[0]['value'];

            $delim = ', ';
            switch ($prop) {
                case 'id-at-countryName':
                    $desc = 'C=';
                    break;
                case 'id-at-stateOrProvinceName':
                    $desc = 'ST=';
                    break;
                case 'id-at-organizationName':
                    $desc = 'O=';
                    break;
                case 'id-at-organizationalUnitName':
                    $desc = 'OU=';
                    break;
                case 'id-at-commonName':
                    $desc = 'CN=';
                    break;
                case 'id-at-localityName':
                    $desc = 'L=';
                    break;
                case 'id-at-surname':
                    $desc = 'SN=';
                    break;
                case 'id-at-uniqueIdentifier':
                    $delim = '/';
                    $desc = 'x500UniqueIdentifier=';
                    break;
                default:
                    $delim = '/';
                    $desc = preg_replace('#.+-([^-]+)$#', '$1',  $prop) . '=';
            }

            if (!$start) {
                $output.= $delim;
            }
            if (is_array($value)) {
                foreach ($value as $type => $v) {
                    $type = array_search($type, $asn1->ANYmap, true);
                    if ($type !== false && isset($asn1->stringTypeSize[$type])) {
                        $v = $asn1->convert($v, $type);
                        if ($v !== false) {
                            $value = $v;
                            break;
                        }
                    }
                }
                if (is_array($value)) {
                    $value = array_pop($value); // Always strip data type.
                }
            }
            $output.= $desc . $value;
            $start = false;
        }

        return $output;
    }
1018524
public function getFromId( $BssId) {
        $rest = $this->getService( self::API_WIFI_BSS . $BssId);
        $rest->GET();

        return $rest->getResult( models\WiFi\Bss\Bss::class);
    }
594273
public function unknown()
	{
		$ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20");
		if (strtolower(substr($this->file->body, $ws, 14)) === '<!doctype html'
			|| strtolower(substr($this->file->body, $ws, 5)) === '<html'
			|| strtolower(substr($this->file->body, $ws, 7)) === '<script')
		{
			return 'text/html';
		}
		elseif (substr($this->file->body, 0, 5) === '%PDF-')
		{
			return 'application/pdf';
		}
		elseif (substr($this->file->body, 0, 11) === '%!PS-Adobe-')
		{
			return 'application/postscript';
		}
		elseif (substr($this->file->body, 0, 6) === 'GIF87a'
			|| substr($this->file->body, 0, 6) === 'GIF89a')
		{
			return 'image/gif';
		}
		elseif (substr($this->file->body, 0, 8) === "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A")
		{
			return 'image/png';
		}
		elseif (substr($this->file->body, 0, 3) === "\xFF\xD8\xFF")
		{
			return 'image/jpeg';
		}
		elseif (substr($this->file->body, 0, 2) === "\x42\x4D")
		{
			return 'image/bmp';
		}
		elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00")
		{
			return 'image/vnd.microsoft.icon';
		}

		return $this->text_or_binary();
	}
1345759
public function getRaw()
    {
        $params = [
            'index' => $this->getIndex(),
            'type'  => $this->getType(),
            'body'  => $this->toDSL(),
        ];

        return $this->connection->searchStatement($params);
    }
429753
public function systype() {
		$this->connectIfNeeded();
		$res = @ftp_systype($this->handle);
		return $res == null || $res == false ? 'UNIX' : $res;
	}
1100905
public function getBuckramVersion() {
		$fullpath = realpath( $this->sass->pathToGlobals() . 'buckram.scss' );
		if ( is_file( $fullpath ) ) {
			return get_file_data(
				$fullpath,
				[
					'version' => 'Version',
				]
			)['version'];
		}
		return false; // No version available.
	}
1169658
public function getDsn()
    {
        if (!$this->config) {
            return '';
        }
        $dsn = array();
        $path = null;

        if ($this->config->getName()) {
            $path = $this->config->getName();
        }

        if ($this->config->getPath()) {
            $path = $this->config->getPath();
        }

        if ($path) {
            if (!file_exists($path)) {
                @touch($path);
            }
            $dsn[] = $path;
        } else {
            $dsn[] = ':memory:';
        }

        return $this->getPrefix().implode(';', $dsn);
    }
203781
public static function getTmpDir() {

		if (!self::$_sTmpDir) {
			$sTmpDir = Config::get('tango')['tmp_dir'];
			$sTmpDir = rtrim($sTmpDir, '/');
			if (!is_dir($sTmpDir) || !is_writable($sTmpDir)) {
				$sTmpDir = '/tmp'; // failback
			}
			self::$_sTmpDir = $sTmpDir;
		}

		return self::$_sTmpDir;
	}
1199575
function _DataLen()
    {
        if (!isset($this->_data)) {
            return 0;
        }
        if (isset($this->_PPS_FILE)) {
            fseek($this->_PPS_FILE, 0);
            $stats = fstat($this->_PPS_FILE);
            return $stats[7];
        } else {
            return strlen($this->_data);
        }
    }
1133686
public function getViewPath()
    {
        return is_null($this->_nsedModuleViewPath) ?
        parent::getViewPath()
        . DIRECTORY_SEPARATOR
        . array_pop(explode('\\', $this->controllerNamespace)) :
        parent::getViewPath();
    }
994830
public function getDsn()
    {
        if (!$this->config) {
            return '';
        }
        $dsn = array();

        if ($this->config->getHost()) {
            $dsn[] = 'host='.$this->config->getHost();
        }

        if ($this->config->getPort()) {
            $dsn[] = 'port='.$this->config->getPort();
        }

        if ($this->config->getName()) {
            $dsn[] = 'dbname='.$this->config->getName();
        }

        if ($this->config->getUser()) {
            $dsn[] = 'user='.$this->config->getUser();
        }

        if ($this->config->getPass()) {
            $dsn[] = 'password='.$this->config->getPass();
        }

        return $this->getPrefix().implode(';', $dsn);
    }