You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/web/app/Services/UserCopy/UserCopyPageResolver.php

29 lines
807 B
PHP

<?php
namespace App\Services\UserCopy;
/** Maps authenticated non-cloud routes to their bounded copy scope. */
final class UserCopyPageResolver
{
public static function forAccountPath(string $path): ?string
{
$path = '/' . ltrim($path, '/');
if (preg_match('#\A/user/ticket(?:/|\z)#D', $path) === 1) {
return 'user.tickets';
}
if (preg_match('#\A/user/(?:edit|disable)(?:/|\z)#D', $path) === 1) {
return 'user.account';
}
if (preg_match('#\A/user/invite(?:/|\z)#D', $path) === 1) {
return 'user.invite';
}
if (preg_match(
'#\A/user/(?:code|paytaro|pay_success)(?:/|\z)#D',
$path
) === 1) {
return 'user.recharge';
}
return null;
}
}