@artilingo/artiframe-cli 1.2.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core-stubs/bin/SystemMethod.php +106 -10
- package/core-stubs/bin/ViewMethod.php +16 -0
- package/core-stubs/docs/de.html +4310 -4432
- package/core-stubs/docs/en.html +4309 -4432
- package/core-stubs/docs/es.html +4310 -4432
- package/core-stubs/docs/fr.html +4309 -4432
- package/core-stubs/docs/tr.html +4307 -4991
- package/package.json +1 -1
- package/src/App.php +48 -1
- package/src/Commands/AuthCommand.php +219 -0
- package/src/Commands/IssuesCommand.php +174 -0
- package/src/Commands/SuggestCommand.php +143 -0
- package/src/Commands/TableCommand.php +82 -0
- package/src/Lang/de.php +14 -0
- package/src/Lang/en.php +14 -0
- package/src/Lang/es.php +14 -0
- package/src/Lang/fr.php +14 -0
- package/src/Lang/tr.php +15 -1
- package/stubs/sql.stub +46 -0
|
@@ -312,19 +312,31 @@ class SystemMethod
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
/**
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
* @param string $
|
|
319
|
-
* @return string
|
|
315
|
+
* Bi-directional UUID formatter (String <-> Binary)
|
|
316
|
+
*
|
|
317
|
+
* @param string $value 16-byte binary string OR 36-character UUID string
|
|
318
|
+
* @param string $to 'auto', 'binary', or 'string'
|
|
319
|
+
* @return string
|
|
320
320
|
*/
|
|
321
|
-
public static function formatId(string $
|
|
321
|
+
public static function formatId(string $value, string $to = 'auto'): string
|
|
322
322
|
{
|
|
323
|
-
|
|
323
|
+
// Target: Binary conversion (String -> Binary)
|
|
324
|
+
if ($to === 'binary' || ($to === 'auto' && strlen($value) !== 16)) {
|
|
325
|
+
$cleanHex = str_replace('-', '', $value);
|
|
326
|
+
|
|
327
|
+
if (strlen($cleanHex) !== 32) {
|
|
328
|
+
throw new \InvalidArgumentException("Invalid UUID string format.");
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return hex2bin($cleanHex);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// Target: String conversion (Binary -> String)
|
|
335
|
+
if (strlen($value) !== 16) {
|
|
324
336
|
throw new \InvalidArgumentException("Invalid binary UUID length. Expected 16 bytes.");
|
|
325
337
|
}
|
|
326
338
|
|
|
327
|
-
$hex = bin2hex($
|
|
339
|
+
$hex = bin2hex($value);
|
|
328
340
|
|
|
329
341
|
return sprintf(
|
|
330
342
|
'%s-%s-%s-%s-%s',
|
|
@@ -378,6 +390,72 @@ class SystemMethod
|
|
|
378
390
|
return $asString ? (string) $result : $result;
|
|
379
391
|
}
|
|
380
392
|
|
|
393
|
+
/**
|
|
394
|
+
* Sadece sayılardan oluşan rastgele bir OTP (One-Time Password) kodu üretir.
|
|
395
|
+
* @param int $length Hanelerin sayısı (Varsayılan 6)
|
|
396
|
+
*/
|
|
397
|
+
public static function otpInt(int $length = 6): int
|
|
398
|
+
{
|
|
399
|
+
if ($length < 1) $length = 1;
|
|
400
|
+
if ($length > 18) $length = 18; // PHP 64-bit safe max length
|
|
401
|
+
|
|
402
|
+
$min = (int) str_pad('1', $length, '0');
|
|
403
|
+
$max = (int) str_pad('9', $length, '9');
|
|
404
|
+
|
|
405
|
+
return random_int($min, $max);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Sadece harflerden oluşan rastgele bir OTP kodu üretir.
|
|
410
|
+
* @param int $length Hanelerin sayısı (Varsayılan 6)
|
|
411
|
+
* @param string $case 'c': Sadece küçük, 'C': Sadece büyük, 'cC'/'Cc': Karışık
|
|
412
|
+
*/
|
|
413
|
+
public static function otpStr(int $length = 6, string $case = 'C'): string
|
|
414
|
+
{
|
|
415
|
+
$lower = 'abcdefghijklmnopqrstuvwxyz';
|
|
416
|
+
$upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
417
|
+
|
|
418
|
+
$chars = match (strtolower($case)) {
|
|
419
|
+
'c' => $lower,
|
|
420
|
+
'cc' => $lower . $upper,
|
|
421
|
+
default => $upper,
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
$otp = '';
|
|
425
|
+
$maxIndex = strlen($chars) - 1;
|
|
426
|
+
for ($i = 0; $i < $length; $i++) {
|
|
427
|
+
$otp .= $chars[random_int(0, $maxIndex)];
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
return $otp;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Harf ve sayılardan (Alphanumeric) oluşan rastgele bir OTP kodu üretir.
|
|
435
|
+
* @param int $length Hanelerin sayısı (Varsayılan 6)
|
|
436
|
+
* @param string $case 'c': Küçük+Sayı, 'C': Büyük+Sayı, 'cC'/'Cc': Karışık+Sayı
|
|
437
|
+
*/
|
|
438
|
+
public static function otpMix(int $length = 6, string $case = 'C'): string
|
|
439
|
+
{
|
|
440
|
+
$numbers = '0123456789';
|
|
441
|
+
$lower = 'abcdefghijklmnopqrstuvwxyz';
|
|
442
|
+
$upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
443
|
+
|
|
444
|
+
$chars = match (strtolower($case)) {
|
|
445
|
+
'c' => $numbers . $lower,
|
|
446
|
+
'cc' => $numbers . $lower . $upper,
|
|
447
|
+
default => $numbers . $upper,
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
$otp = '';
|
|
451
|
+
$maxIndex = strlen($chars) - 1;
|
|
452
|
+
for ($i = 0; $i < $length; $i++) {
|
|
453
|
+
$otp .= $chars[random_int(0, $maxIndex)];
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
return $otp;
|
|
457
|
+
}
|
|
458
|
+
|
|
381
459
|
/**
|
|
382
460
|
* Gelen veriyi (özellikle BigInt ID'leri) güvenli bir şekilde string'e çevirir.
|
|
383
461
|
* Javascript'te 15 haneyi aşan sayılardaki veri kaybını engellemek için
|
|
@@ -517,8 +595,8 @@ if (!function_exists(__NAMESPACE__ . '\\byteId')) {
|
|
|
517
595
|
}
|
|
518
596
|
|
|
519
597
|
if (!function_exists(__NAMESPACE__ . '\\formatId')) {
|
|
520
|
-
function formatId(string $
|
|
521
|
-
return \Bin\SystemMethod::formatId($
|
|
598
|
+
function formatId(string $value, string $to = 'auto'): string {
|
|
599
|
+
return \Bin\SystemMethod::formatId($value, $to);
|
|
522
600
|
}
|
|
523
601
|
}
|
|
524
602
|
|
|
@@ -545,3 +623,21 @@ if (!function_exists(__NAMESPACE__ . '\\stringer')) {
|
|
|
545
623
|
return \Bin\SystemMethod::stringer($value);
|
|
546
624
|
}
|
|
547
625
|
}
|
|
626
|
+
|
|
627
|
+
if (!function_exists(__NAMESPACE__ . '\\otpInt')) {
|
|
628
|
+
function otpInt(int $length = 6): int {
|
|
629
|
+
return \Bin\SystemMethod::otpInt($length);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
if (!function_exists(__NAMESPACE__ . '\\otpStr')) {
|
|
634
|
+
function otpStr(int $length = 6, string $case = 'C'): string {
|
|
635
|
+
return \Bin\SystemMethod::otpStr($length, $case);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
if (!function_exists(__NAMESPACE__ . '\\otpMix')) {
|
|
640
|
+
function otpMix(int $length = 6, string $case = 'C'): string {
|
|
641
|
+
return \Bin\SystemMethod::otpMix($length, $case);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
@@ -345,6 +345,16 @@ class ViewMethod
|
|
|
345
345
|
$masked = $start . str_repeat('*', max($len - 5, 3)) . $end;
|
|
346
346
|
return self::display($masked);
|
|
347
347
|
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Veritabanından gelen 16 byte'lık binary UUID verisini 36 karakterlik
|
|
351
|
+
* okunabilir (HEX) formata dönüştürür ve ekrana basar.
|
|
352
|
+
*/
|
|
353
|
+
public static function uuid(?string $binaryId): string
|
|
354
|
+
{
|
|
355
|
+
if (empty($binaryId)) return '-';
|
|
356
|
+
return self::display(\Bin\SystemMethod::formatId($binaryId));
|
|
357
|
+
}
|
|
348
358
|
}
|
|
349
359
|
|
|
350
360
|
// Geliştiriciler (Özellikle Juniorlar) için kullanımı en kolay global yardımcı fonksiyonlar
|
|
@@ -461,3 +471,9 @@ if (!function_exists(__NAMESPACE__ . '\\maskPhone')) {
|
|
|
461
471
|
return \Bin\ViewMethod::maskPhone($phone);
|
|
462
472
|
}
|
|
463
473
|
}
|
|
474
|
+
|
|
475
|
+
if (!function_exists(__NAMESPACE__ . '\\uuid')) {
|
|
476
|
+
function uuid(?string $binaryId): string {
|
|
477
|
+
return \Bin\ViewMethod::uuid($binaryId);
|
|
478
|
+
}
|
|
479
|
+
}
|