public static function getPlanType($type) { $types = PlanResourceType::getAllTypes(); foreach ($types[PlanType::ADVERTISER_PLAN] as $resourceType) { foreach ($resourceType as $id => $name) { if ($type == $id) { return PlanType::ADVERTISER_PLAN; } } } foreach ($types[PlanType::WHITELABEL_PLAN] as $resourceType) { foreach ($resourceType as $id => $name) { if ($type == $id) { return PlanType::WHITELABEL_PLAN; } } } return null; }