Skip to content

Commit

Permalink
fix some issues, expose methods to public
Browse files Browse the repository at this point in the history
  • Loading branch information
abdumu committed Jul 15, 2019
1 parent 74b0733 commit 4e76034
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/numberedStringOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function englishWordsToNumbers($str)
*
* @return int|mixed
*/
protected function arabicWordsToNumbers($str, $normalized)
public function arabicWordsToNumbers($str, $normalized)
{
// Normalization phase
if (!$normalized) {
Expand Down Expand Up @@ -263,23 +263,23 @@ protected function arabicWordsToNumbers($str, $normalized)

foreach ($complications as $complication => $by) {
$subTotal = 0;
if (preg_match("/(.*)\s*{$complication}/", $str, $result) !== false && isset($result[1])) {
$result = " {$result[1]} ";
if (preg_match("/((.*)\s*{$complication})/", $str, $result) !== false && isset($result[1])) {
$result = " {$result[2]} ";

foreach ($spell as $word => $value) {
if (strpos($result, "$word ") !== false) {
$str = str_replace("$word ", ' ', $str);
$result = str_replace("$word ", ' ', $result);
$subTotal += $value;
}
}

if (preg_match("/(\d+)/", $result, $numbersInResult) !== false && isset($numbersInResult[1])) {
$subTotal += $numbersInResult[1];
$str = str_replace("{$numbersInResult[1]}", ' ', $str);
$result = str_replace("{$numbersInResult[1]}", ' ', $result);
}

$str = str_replace(" $complication", ' ', $str);
$str = preg_replace("/(.*\s*{$complication})/", $result, $str);

$total += ($total == 0 && $subTotal == 0) ? $by : ($subTotal * $by);
}
}
Expand Down

0 comments on commit 4e76034

Please sign in to comment.