Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion apps/testing/lib/Provider/FakeTextProcessingProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,21 @@ public function getName(): string {
}

public function process(string $prompt): string {
return strrev($prompt) . ' (done with FakeTextProcessingProvider)';
return $this->mb_strrev($prompt) . ' (done with FakeTextProcessingProvider)';
}

public function getTaskType(): string {
return FreePromptTaskType::class;
}

/**
* Reverse a miltibyte string.
*
* @param string $string The string to be reversed.
* @return string The reversed string
*/
private function mb_strrev(string $string): string {
$chars = mb_str_split($string, 1);
return implode('', array_reverse($chars));
}
}
13 changes: 12 additions & 1 deletion apps/testing/lib/Provider/FakeTextProcessingProviderSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function getName(): string {
}

public function process(string $prompt): string {
return strrev($prompt) . ' (done with FakeTextProcessingProviderSync)';
return $this->mb_strrev($prompt) . ' (done with FakeTextProcessingProviderSync)';
}

public function getTaskType(): string {
Expand All @@ -30,4 +30,15 @@ public function getTaskType(): string {
public function getExpectedRuntime(): int {
return 1;
}

/**
* Reverse a miltibyte string.
*
* @param string $string The string to be reversed.
* @return string The reversed string
*/
private function mb_strrev(string $string): string {
$chars = mb_str_split($string, 1);
return implode('', array_reverse($chars));
}
}