|
@@ 605-615 (lines=11) @@
|
| 602 |
|
* @return int |
| 603 |
|
* @throws ParseMemberLevelException |
| 604 |
|
*/ |
| 605 |
|
public static function parseLevelString(string $levelString): int { |
| 606 |
|
$levelString = ucfirst(strtolower($levelString)); |
| 607 |
|
$level = array_search($levelString, Member::$DEF_LEVEL); |
| 608 |
|
|
| 609 |
|
if (!$level) { |
| 610 |
|
$all = implode(', ', array_values(self::$DEF_LEVEL)); |
| 611 |
|
throw new ParseMemberLevelException('Available levels: ' . $all); |
| 612 |
|
} |
| 613 |
|
|
| 614 |
|
return (int)$level; |
| 615 |
|
} |
| 616 |
|
|
| 617 |
|
/** |
| 618 |
|
* @param string $typeString |
|
@@ 623-633 (lines=11) @@
|
| 620 |
|
* @return int |
| 621 |
|
* @throws UserTypeNotFoundException |
| 622 |
|
*/ |
| 623 |
|
public static function parseTypeString(string $typeString): int { |
| 624 |
|
$typeString = strtolower($typeString); |
| 625 |
|
$type = array_search($typeString, Member::$DEF_TYPE); |
| 626 |
|
|
| 627 |
|
if (!$type) { |
| 628 |
|
$all = implode(', ', array_values(self::$DEF_TYPE)); |
| 629 |
|
throw new UserTypeNotFoundException('Available types: ' . $all); |
| 630 |
|
} |
| 631 |
|
|
| 632 |
|
return (int)$type; |
| 633 |
|
} |
| 634 |
|
|
| 635 |
|
} |
| 636 |
|
|