<?php
namespace App\Imports;
use Maatwebsite\Excel\Facades\Excel;
use Exception;
class LanguageImport
{
protected $array;
protected $column_data = false;
protected const KEY_STRING = 'key';
public function toArray($file) {
$array = Excel::toArray($this,$file);
$this->array = $array;
return $this;
}
public function columnData() {
if(!is_array($this->array)) throw new Exception('Please Call toArray() Function Before Calling columnData()');
$array = $this->array;
$languages = [];
if(count($array) > 0) {
$header = $array[0][0];
if(strtolower($header[0]) != self::KEY_STRING) {
throw new Exception('File upload with wrong format. Make sure the file have language key and key title is "Key"');
}
foreach($header as $key => $item) {
if($item == null) break;
foreach($array as $sheet) {
array_shift($sheet);
foreach($sheet as $row) {
$value = $row[$key] ?? "";
$languages[$item][] = trim($value);
}
}
}
}
$this->array = $languages;
$this->column_data = true;
return $this;
}
public function keyValue() {
if($this->column_data == false) throw new Exception('Please Call columnData() Function Before Calling keyValue()');
$data = $this->array;
$languages_keys = array_shift($data);
$language_key_value = [];
foreach($languages_keys as $key => $item) {
foreach($data as $language_code => $values) {
$language_key_value[$language_code][$item] = $values[$key];
}
}
return $language_key_value;
}
public function getArray() {
if(is_array($this->array)) return $this->array;
throw new Exception('Please Call columnData() Function Before Calling getArray()');
}
public static function getKeys() {
$file_name = "predefined_keys.json";
$file_dir_location = base_path('lang');
$file_path = $file_dir_location . "/" . $file_name;
$get_keys = file_get_contents($file_path);
try{
$keys_array = json_decode($get_keys,true);
}catch(Exception $e) {
throw new Exception($e->getMessage());
}
return $keys_array;
}
}
At NFC Pay, your privacy is of utmost importance to us. This Privacy Policy outlines how we collect, use, share, and protect your personal information when you use our services, including our website and mobile applications.
1. Information We Collect
2. How We Use Your Information
We use the information we collect for the following purposes:
3. Sharing Your Information
We may share your personal information in the following circumstances:
4. Security of Your Information
We take the security of your personal information seriously and implement a variety of security measures, including encryption, secure servers, and access controls, to protect your data from unauthorized access, disclosure, alteration, or destruction. However, no method of transmission over the internet or electronic storage is completely secure, and we cannot guarantee its absolute security.
5. Your Privacy Rights
Depending on your location, you may have certain rights regarding your personal information, such as:
6. Third-Party Links
Our services may contain links to third-party websites or services. We are not responsible for the privacy practices or the content of these third-party sites. We encourage you to review the privacy policies of those third parties.
7. Children’s Privacy
Our services are not intended for individuals under the age of 13. We do not knowingly collect personal information from children under 13. If we become aware that we have collected personal information from a child under 13, we will take steps to delete that information.
8. Changes to This Privacy Policy
We may update this Privacy Policy from time to time to reflect changes in our practices or for other operational, legal, or regulatory reasons. We will notify you of any significant changes by posting the new Privacy Policy on our website and updating the effective date.
9. Contact Us
If you have any questions or concerns about this Privacy Policy or our data practices, please contact us at:
Email: support@nfcpay.com