Clone Nabih Pure PHP Architecture

This commit is contained in:
Hamza-Ayed
2026-08-26 17:10:57 +03:00
parent 1e21847ed0
commit df5d8dfc60
28 changed files with 2791 additions and 267 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace App\Core\Flows;
/**
* TestFlow
* A basic interactive flow for testing the multi-stage system.
*/
class TestFlow extends BaseFlow
{
public function handleStep(string $step, array $messageData, array &$context): FlowResult
{
$text = isset($messageData['body']) ? trim($messageData['body']) : '';
switch ($step) {
case 'start':
// Initiate step
return new FlowResult("أهلاً بك في اختبار المسار التفاعلي! ما هو اسمك الكريم؟", "ask_name");
case 'ask_name':
if (empty($text)) {
return new FlowResult("يرجى إدخال اسمك للاستمرار:", "ask_name");
}
$context['name'] = $text;
return new FlowResult("تشرفنا بك يا {$text}! من فضلك قم بتقييم خدمتنا من 1 إلى 5:", "ask_feedback");
case 'ask_feedback':
if (!preg_match('/^[1-5]$/', $text)) {
return new FlowResult("الرجاء إدخال رقم من 1 إلى 5 فقط للتقييم:", "ask_feedback");
}
$context['rating'] = (int)$text;
return new FlowResult("شكراً لك يا {$context['name']}! لقد تم تسجيل تقييمك ({$text}/5) بنجاح. يومك سعيد!", "finished", true);
default:
return new FlowResult("خطأ في تحديد خطوة المسار.", "finished", true);
}
}
}