Skip to content

Commit 7233ef1

Browse files
disposable email utility added
1 parent 5876254 commit 7233ef1

File tree

10 files changed

+84
-83
lines changed

10 files changed

+84
-83
lines changed

src/Collections/Traits/RelatedTrait.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,15 @@ public function only(...$keys)
308308
{
309309
$keys = Str::flatten($keys);
310310

311-
$data = [];
311+
$array = [];
312312

313313
foreach($keys as $key){
314314
if(in_array($key, array_keys($this->items))){
315-
$data[$key] = $this->items[$key];
315+
$array[$key] = $this->items[$key];
316316
}
317317
}
318318

319-
return new static($data);
319+
return new static($array);
320320
}
321321

322322
/**
@@ -1537,19 +1537,19 @@ private function convertOnInit(mixed $items = null)
15371537
/**
15381538
* Check if data is not a valid array
15391539
*
1540-
* @param mixed $data
1540+
* @param mixed $array
15411541
* @return bool
15421542
*/
1543-
private function isNotValidArray(mixed $data = null)
1543+
private function isNotValidArray(mixed $array = null)
15441544
{
1545-
if (!is_array($data)) {
1545+
if (!is_array($array)) {
15461546
return true;
15471547
}
15481548

15491549
// array filter
1550-
$filteredArray = array_filter($data, 'is_array');
1550+
$filteredArray = array_filter($array, 'is_array');
15511551

1552-
return count($filteredArray) === count($data);
1552+
return count($filteredArray) === count($array);
15531553
}
15541554

15551555
/**

src/ImageToText.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,16 @@ private static function ocrspace(string $imagePath, string $language, string $ap
355355
throw new CustomException('OCR request failed: ' . $err);
356356
}
357357

358-
$data = json_decode($response, true);
359-
if (!is_array($data)) {
358+
$array = json_decode($response, true);
359+
if (!is_array($array)) {
360360
throw new CustomException('Invalid OCR response.');
361361
}
362-
if (!empty($data['IsErroredOnProcessing'])) {
363-
$msg = (string)($data['ErrorMessage'][0] ?? 'OCR error');
362+
if (!empty($array['IsErroredOnProcessing'])) {
363+
$msg = (string)($array['ErrorMessage'][0] ?? 'OCR error');
364364
throw new CustomException(is_array($msg) ? implode(', ', $msg) : $msg);
365365
}
366366

367-
$parsed = $data['ParsedResults'][0]['ParsedText'] ?? '';
367+
$parsed = $array['ParsedResults'][0]['ParsedText'] ?? '';
368368
return (string)$parsed;
369369
}
370370

src/Process/SessionManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Tamedevelopers\Support\Process\Concerns\SessionInterface as BaseSessionInterface;
1010
use Tamedevelopers\Support\Process\Session\Handlers\DatabaseSessionHandler;
1111
use Tamedevelopers\Support\Process\Session\Handlers\RedisSessionHandler;
12+
use Redis;
1213

1314
/**
1415
* Configurable session manager supporting file, database, and redis drivers.
@@ -115,7 +116,7 @@ private function configureDatabaseDriver(?int $lifetime = null): void
115116

116117
private function configureRedisDriver(?int $lifetime = null): void
117118
{
118-
if (!class_exists(\Redis::class)) {
119+
if (!class_exists('\Redis')) {
119120
throw new \RuntimeException('Redis extension (phpredis) is required for redis session driver.');
120121
}
121122
$cfg = (array) ($this->config['redis'] ?? []);

src/Server.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,20 @@ public static function config($key, $default = null, string $base_folder = 'conf
102102
/**
103103
* Create Template File
104104
*
105-
* @param array $data
105+
* @param array $array
106106
* @param string|null $filename
107107
* - [base path will be automatically added]
108108
*
109109
* @return void
110110
*/
111-
public static function createTemplateFile(?array $data = [], ?string $filename = null)
111+
public static function createTemplateFile(?array $array = [], ?string $filename = null)
112112
{
113113
// removing default base directory path if added by default
114114
$filename = Str::replace(self::formatWithBaseDirectory(), '', $filename);
115115
$filePath = Server::formatWithBaseDirectory($filename);
116116

117117
// Generate PHP code
118-
$exported = var_export($data, true);
118+
$exported = var_export($array, true);
119119
$string = explode("\n", $exported);
120120
$string = array_map('trim', $string);
121121
$string = implode("\n ", $string);
@@ -215,24 +215,24 @@ public static function toJson($value)
215215
/**
216216
* Check if data is not a valid array
217217
*
218-
* @param mixed $data
218+
* @param mixed $array
219219
* @return bool
220220
*/
221-
private static function isNotValidArray(mixed $data = null)
221+
private static function isNotValidArray(mixed $array = null)
222222
{
223-
// Return true if $data is not an array
224-
if (!is_array($data)) {
223+
// Return true if $array is not an array
224+
if (!is_array($array)) {
225225
return true;
226226
}
227227

228-
// Check if $data contains any non-array values
229-
foreach ($data as $value) {
228+
// Check if $array contains any non-array values
229+
foreach ($array as $value) {
230230
if (!is_array($value)) {
231231
return true; // Return true if a non-array value is found
232232
}
233233
}
234234

235-
// Return false if $data is a valid array
235+
// Return false if $array is a valid array
236236
return false;
237237
}
238238

src/Tame.php

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -633,119 +633,119 @@ public static function calPercentageBetweenNumbers(float|int $number = 0, float|
633633
/**
634634
* Check if array has duplicate value
635635
*
636-
* @param array $data
636+
* @param array $array
637637
* @return bool
638638
* - true|false
639639
*/
640-
public static function isArrayDuplicate(?array $data = [])
640+
public static function isArrayDuplicate(?array $array = [])
641641
{
642-
return Str::arrayDuplicate($data);
642+
return Str::arrayDuplicate($array);
643643
}
644644

645645
/**
646646
* Check if all values of array is same
647647
*
648-
* @param array $data
648+
* @param array $array
649649
* @return bool
650650
* - true|false
651651
*/
652-
public static function isArraySame(?array $data = [])
652+
public static function isArraySame(?array $array = [])
653653
{
654-
return Str::arraySame($data);
654+
return Str::arraySame($array);
655655
}
656656

657657
/**
658658
* For sorting array
659659
*
660-
* @param array $data
660+
* @param array $array
661661
* @param string $type
662662
* - [rsort|asort|ksort|arsort|krsort|sort]
663663
*
664664
* @return array
665665
*/
666-
public static function sortArray(&$data = [], $type = 'sort')
666+
public static function sortArray(&$array = [], $type = 'sort')
667667
{
668-
// Validate that $data is an array
669-
if (!is_array($data)) {
668+
// Validate that $array is an array
669+
if (!is_array($array)) {
670670
return [];
671671
}
672672

673673
// Perform sorting based on the specified type
674674
switch ($type) {
675675
case 'rsort':
676-
rsort($data); // Sort arrays in descending order
676+
rsort($array); // Sort arrays in descending order
677677
break;
678678

679679
case 'asort':
680-
asort($data); // Sort associative arrays in ascending order, according to the value
680+
asort($array); // Sort associative arrays in ascending order, according to the value
681681
break;
682682

683683
case 'ksort':
684-
ksort($data); // Sort associative arrays in ascending order, according to the key
684+
ksort($array); // Sort associative arrays in ascending order, according to the key
685685
break;
686686

687687
case 'arsort':
688-
arsort($data); // Sort associative arrays in descending order, according to the value
688+
arsort($array); // Sort associative arrays in descending order, according to the value
689689
break;
690690

691691
case 'krsort':
692-
krsort($data); // Sort associative arrays in descending order, according to the value
692+
krsort($array); // Sort associative arrays in descending order, according to the value
693693
break;
694694

695695
default:
696-
sort($data); // Sort arrays in ascending order
696+
sort($array); // Sort arrays in ascending order
697697
break;
698698
}
699699

700-
return $data;
700+
return $array;
701701
}
702702

703703
/**
704704
* For sorting muti-dimentional array
705705
*
706-
* @param array $data
706+
* @param array $array
707707
* @param string|null $key
708708
* @param string $type
709709
* - [asc|desc|snum]
710710
*
711711
* @return array
712712
*/
713-
public static function sortMultipleArray(?array &$data = [], $key = null, ?string $type = 'asc')
713+
public static function sortMultipleArray(&$array = [], $key = null, $type = 'asc')
714714
{
715-
// Check if $data is an array and not empty
716-
if (!is_array($data) || empty($data)) {
715+
// Check if $array is an array and not empty
716+
if (!is_array($array) || empty($array)) {
717717
return [];
718718
}
719719

720720
// Check if $key is provided
721721
// If $key is not provided, return without sorting
722722
if (is_null($key)) {
723-
return $data;
723+
return $array;
724724
}
725725

726726
// Extract values of the specified key from each sub-array
727-
$id = array_column($data, $key);
727+
$id = array_column($array, $key);
728728

729-
// Ensure $id and $data have the same size before sorting
730-
if (count($id) !== count($data)) {
729+
// Ensure $id and $array have the same size before sorting
730+
if (count($id) !== count($array)) {
731731
return;
732732
}
733733

734734
switch ($type) {
735735
case 'desc':
736-
array_multisort($id, SORT_DESC, $data); //sort associative arrays in descending order
736+
array_multisort($id, SORT_DESC, $array); //sort associative arrays in descending order
737737
break;
738738

739739
case 'snum':
740-
array_multisort($id, SORT_NUMERIC, $data); //sort associative arrays in numeric order
740+
array_multisort($id, SORT_NUMERIC, $array); //sort associative arrays in numeric order
741741
break;
742742

743743
default:
744-
array_multisort($id, SORT_ASC, $data); //sort arrays in ascending order
744+
array_multisort($id, SORT_ASC, $array); //sort arrays in ascending order
745745
break;
746746
}
747747

748-
return $data;
748+
return $array;
749749
}
750750

751751
/**
@@ -1263,21 +1263,21 @@ public static function decryptStr($jsonString = null)
12631263
$openSSL = self::openSSLEncrypt();
12641264

12651265
// Decode the JSON string
1266-
$data = Server::toArray($jsonString);
1266+
$array = Server::toArray($jsonString);
12671267

1268-
if (empty($data)) {
1268+
if (empty($array)) {
12691269
return;
12701270
}
12711271

12721272
// Decode base64-encoded IV and encrypted string
1273-
$iv = base64_decode($data['e']);
1274-
$encryptedString = base64_decode($data['s']);
1273+
$iv = base64_decode($array['e']);
1274+
$encryptedString = base64_decode($array['s']);
12751275

12761276
// Get encryption settings
12771277
$openSSL = self::openSSLEncrypt();
12781278

12791279
// Store the encryption key
1280-
$key = $data['k'];
1280+
$key = $array['k'];
12811281

12821282
// Decryption
12831283
return openssl_decrypt(

src/Traits/CountryTrait.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,17 @@ public static function getWeeks($mode = null)
8080
*/
8181
public static function getTimeZone($mode = null, ?string $default = 'UTC')
8282
{
83-
$data = self::timeZone();
83+
$array = self::timeZone();
8484

8585
// check if mode is numeric
8686
if(is_numeric($mode)){
87-
return $data[(int) $mode] ?? $default;
87+
return $array[(int) $mode] ?? $default;
8888
}
8989

9090
// flip array to get position num
91-
$flip = array_flip($data);
91+
$flip = array_flip($array);
9292

93-
return $data[$flip[$mode] ?? null] ?? $default;
93+
return $array[$flip[$mode] ?? null] ?? $default;
9494
}
9595

9696
/**
@@ -101,10 +101,10 @@ public static function getTimeZone($mode = null, ?string $default = 'UTC')
101101
*/
102102
public static function getCaptchaLocale($mode = null)
103103
{
104-
$data = self::captchaLocale();
104+
$array = self::captchaLocale();
105105

106-
return $data[$mode]
107-
?? array_flip($data)[$mode]
106+
return $array[$mode]
107+
?? array_flip($array)[$mode]
108108
?? null;
109109
}
110110

src/Traits/EmailUtilityTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,12 @@ protected static function loadProvidersChildren()
227227

228228
$collection = new Collection(self::$providers);
229229

230-
$data = [];
231-
$collection->each(function($item) use (&$data) {
232-
$data = array_merge($data, $item);
230+
$array = [];
231+
$collection->each(function($item) use (&$array) {
232+
$array = array_merge($array, $item);
233233
});
234234

235-
self::$providersChildren = $data;
235+
self::$providersChildren = $array;
236236
}
237237

238238
/**

0 commit comments

Comments
 (0)