Skip to content

Commit

Permalink
Add 5 additional methods
Browse files Browse the repository at this point in the history
  • Loading branch information
meezaan committed Nov 19, 2023
1 parent be32969 commit 41b7639
Show file tree
Hide file tree
Showing 5 changed files with 206 additions and 195 deletions.
5 changes: 5 additions & 0 deletions api/Utils/ClassMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public static function method($methodId)
14 => Method::METHOD_RUSSIA,
15 => Method::METHOD_MOONSIGHTING,
16 => Method::METHOD_DUBAI,
17 => Method::METHOD_JAKIM,
18 => Method::METHOD_TUNISIA,
19 => Method::METHOD_ALGERIA,
20 => Method::METHOD_KEMENAG,
21 => Method::METHOD_MOROCCO,
99 => Method::METHOD_CUSTOM,
];

Expand Down
3 changes: 3 additions & 0 deletions api/Utils/PrayerTimesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ public static function applyMethodSpecificTuning(PrayerTimes $pt, ?array $tune,
case Method::METHOD_TURKEY:
$pt->tune($tune[0], $tune[1], -7, 5, 4, 7, 7, $tune[7], $tune[8]);
break;
case Method::METHOD_MOROCCO:
$pt->tune($tune[0], $tune[1], $tune[2], 5, $tune[4], 5, $tune[6], $tune[7], $tune[8]);
break;
default:
$pt->tune($tune[0], $tune[1], $tune[2], $tune[3], $tune[4], $tune[5], $tune[6], $tune[7], $tune[8]);
break;
Expand Down
19 changes: 11 additions & 8 deletions api/Utils/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static function method($data, $latitude = null, $longitude= null): int

return 2; // ISNA
}
if (!in_array($data, [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 99])) {
if (!in_array($data, [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 99])) {
return 2; // ISNA
} else {
return (int) $data;
Expand All @@ -71,14 +71,17 @@ public static function method($data, $latitude = null, $longitude= null): int

public static function customMethod($data): array
{
$method = explode(',', $data);
$result = [];
// PrayerTimesHelper::createCustomMethod() takes a total of 12 params
for ($i=0; $i<=11; $i++) {
if (isset($method[$i]) && $method[$i] != 0 && $method[$i] != null) {
$result[] = (string) $method[$i];
} else {
$result[] = null;

if ($data !== null) {
$method = explode(',', $data);
// PrayerTimesHelper::createCustomMethod() takes a total of 12 params
for ($i=0; $i<=11; $i++) {
if (isset($method[$i]) && $method[$i] != 0 && $method[$i] != null) {
$result[] = (string) $method[$i];
} else {
$result[] = null;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"require": {
"7x/sdk": "^1.4",
"islamic-network/alqibla": "^1.2",
"islamic-network/prayer-times": "^1.0.24",
"islamic-network/prayer-times": "^1.0.26",
"mamluk/kipchak": "^0.33",
"rafaelfragoso/haversini-formula": "dev-master",
"p3k/emoji-detector": "^0.2.1"
Expand Down
Loading

0 comments on commit 41b7639

Please sign in to comment.