check if router has plan

This commit is contained in:
Ibnu Maksum
2023-09-21 12:09:13 +07:00
parent c5b96df43f
commit c9eeefcf3d
2 changed files with 119 additions and 98 deletions

View File

@ -299,4 +299,23 @@ class Validator
return (bool)in_array($format, $formats);
}
public static function countRouterPlan($plans, $router){
$n = 0;
foreach ($plans as $plan){
if($plan['routers'] == $router){
$n++;
}
}
return $n;
}
public static function isRouterHasPlan($plans, $router){
foreach ($plans as $plan){
if($plan['routers'] == $router){
return true;
}
}
return false;
}
}