|
@@ 630-640 (lines=11) @@
|
| 627 |
|
* @return int |
| 628 |
|
* @throws ParseMemberLevelException |
| 629 |
|
*/ |
| 630 |
|
public static function parseLevelString(string $levelString): int { |
| 631 |
|
$levelString = ucfirst(strtolower($levelString)); |
| 632 |
|
$level = array_search($levelString, Member::$DEF_LEVEL); |
| 633 |
|
|
| 634 |
|
if (!$level) { |
| 635 |
|
$all = implode(', ', array_values(self::$DEF_LEVEL)); |
| 636 |
|
throw new ParseMemberLevelException('Available levels: ' . $all); |
| 637 |
|
} |
| 638 |
|
|
| 639 |
|
return (int)$level; |
| 640 |
|
} |
| 641 |
|
|
| 642 |
|
/** |
| 643 |
|
* @param string $typeString |
|
@@ 648-658 (lines=11) @@
|
| 645 |
|
* @return int |
| 646 |
|
* @throws UserTypeNotFoundException |
| 647 |
|
*/ |
| 648 |
|
public static function parseTypeString(string $typeString): int { |
| 649 |
|
$typeString = strtolower($typeString); |
| 650 |
|
$type = array_search($typeString, Member::$DEF_TYPE); |
| 651 |
|
|
| 652 |
|
if (!$type) { |
| 653 |
|
$all = implode(', ', array_values(self::$DEF_TYPE)); |
| 654 |
|
throw new UserTypeNotFoundException('Available types: ' . $all); |
| 655 |
|
} |
| 656 |
|
|
| 657 |
|
return (int)$type; |
| 658 |
|
} |
| 659 |
|
|
| 660 |
|
} |
| 661 |
|
|