src/Phone_telco.php
public function carrier_data($carrier = '', $field_output = '')
    {
        $inputParams  = array(
            'carrier'      => $carrier,
            'field_output' => $field_output
        );
        $field_output = strtolower($field_output);
        $this->debug->info(__FUNCTION__, 'Input Params: ', $inputParams);
        try {
            $vnCarrierData = DataRepository::getData('vn_carrier_data');
            $this->debug->debug(__FUNCTION__, 'VN Carrier All Data: ', $vnCarrierData);
            if (array_key_exists($carrier, $vnCarrierData)) {
                $isCarrier = $vnCarrierData[$carrier];
                $this->debug->debug(__FUNCTION__, 'Is Carrier Data: ', $isCarrier);
                if (array_key_exists($field_output, $isCarrier)) {
                    $result = $isCarrier[$field_output];
                    $this->debug->info(__FUNCTION__, 'Final Result get Field : ' . $field_output, $result);

                    return $result;
                }
                if ($field_output = 'full') {
                    $this->debug->info(__FUNCTION__, 'Final Result get Field : ' . $field_output, $isCarrier);

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

            return NULL;
        }

        return NULL;
    }
public function carrier_data($carrier = '', $field_output = '')
    {
        $inputParams  = array(
            'carrier'      => $carrier,
            'field_output' => $field_output
        );
        $field_output = strtolower($field_output);
        $this->debug->info(__FUNCTION__, 'Input Params: ', $inputParams);
        try {
            $vnCarrierData = DataRepository::getData('vn_carrier_data');
            $this->debug->debug(__FUNCTION__, 'VN Carrier All Data: ', $vnCarrierData);
            if (array_key_exists($carrier, $vnCarrierData)) {
                $isCarrier = $vnCarrierData[$carrier];
                $this->debug->debug(__FUNCTION__, 'Is Carrier Data: ', $isCarrier);
                if (array_key_exists($field_output, $isCarrier)) {
                    $result = $isCarrier[$field_output];
                    $this->debug->info(__FUNCTION__, 'Final Result get Field : ' . $field_output, $result);

                    return $result;
                }
                if ($field_output = 'full') {
                    $this->debug->info(__FUNCTION__, 'Final Result get Field : ' . $field_output, $isCarrier);

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

            return NULL;
        }

        return NULL;
    }
Function Get Data VN Carrier

@author: 713uk13m <dev@nguyenanhung.com>
@time  : 10/9/18 14:18

@param string $carrier      Full Name of Carrier: Viettel, Vinaphone, MobiFone, Vietnamobile
@param string $field_output Field Output: name, id, short_name

@return mixed|null Field if exists, full data if field_output = full,  null if not or error