Lines 100.00% 4 / 4
Methods 100.00% 1 / 1
Classes 100.00% 1 / 1
Covered by tests of size
Name Lines Methods CRAP
 create 100.00% 4 / 4 100.00% 1 / 1 4
40class Permission
41{
42    /**
43     * Permission::create() returns an instance of an implementation of the Permission interface.
44     */
45    public static function create(string $permLevel, Configuration $configuration): PermissionInterface
46    {
47        return match (strtolower($permLevel)) {
48            'basic' => new BasicPermission($configuration),
49            'medium' => new MediumPermission($configuration),
50            default => throw new InvalidArgumentException(sprintf('Invalid permission level: %s', $permLevel)),
51        };
52    }
53}