|
@@ 597-607 (lines=11) @@
|
| 594 |
|
* @return int |
| 595 |
|
* @throws MemberLevelException |
| 596 |
|
*/ |
| 597 |
|
public static function parseLevelString(string $levelString): int { |
| 598 |
|
$levelString = ucfirst(strtolower($levelString)); |
| 599 |
|
$level = array_search($levelString, Member::$DEF_LEVEL); |
| 600 |
|
|
| 601 |
|
if (!$level) { |
| 602 |
|
$all = implode(', ', array_values(self::$DEF_LEVEL)); |
| 603 |
|
throw new MemberLevelException('Available levels: ' . $all); |
| 604 |
|
} |
| 605 |
|
|
| 606 |
|
return (int)$level; |
| 607 |
|
} |
| 608 |
|
|
| 609 |
|
/** |
| 610 |
|
* @param string $typeString |
|
@@ 615-625 (lines=11) @@
|
| 612 |
|
* @return int |
| 613 |
|
* @throws UserTypeNotFoundException |
| 614 |
|
*/ |
| 615 |
|
public static function parseTypeString(string $typeString): int { |
| 616 |
|
$typeString = strtolower($typeString); |
| 617 |
|
$type = array_search($typeString, Member::$DEF_TYPE); |
| 618 |
|
|
| 619 |
|
if (!$type) { |
| 620 |
|
$all = implode(', ', array_values(self::$DEF_TYPE)); |
| 621 |
|
throw new UserTypeNotFoundException('Available types: ' . $all); |
| 622 |
|
} |
| 623 |
|
|
| 624 |
|
return (int)$type; |
| 625 |
|
} |
| 626 |
|
|
| 627 |
|
} |
| 628 |
|
|