$endpoint) { if($endpoint->getName() == $endpointName) { return $endpoint; } } } private static function addEndpoint_($endpointName,$regionId, $product, $domain) { $regionIds = array($regionId); $productsDomains = array(new ProductDomain($product, $domain)); $endpoint = new Endpoint($endpointName, $regionIds, $productDomains); array_push(self::$endpoints, $endpoint); } private static function updateEndpoint($regionId, $product, $domain, $endpoint) { $regionIds = $endpoint->getRegionIds(); if(!in_array($regionId,$regionIds)) { array_push($regionIds, $regionId); $endpoint->setRegionIds($regionIds); } $productDomains = $endpoint->getProductDomains(); if(null == self::findProductDomain($productDomains, $product, $domain)) { array_push($productDomains, new ProductDomain($product, $domain)); } $endpoint->setProductDomains($productDomains); } private static function findProductDomain($productDomains, $product, $domain) { foreach ($productDomains as $key => $productDomain) { if($productDomain->getProductName() == $product && $productDomain->getDomainName() == $domain) { return $productDomain; } } return null; } }