/** * Initilizate catalog products and services and return CmlCatalog. * @param CmlCatalog $cmlCatalog * @param SimpleXMLElement $catalogInventories * return CmlCatalog */ private function initilizateCatalogInventories($cmlCatalog, $catalogInventories) { foreach ($catalogInventories->Товар as $importInventory) { if ($this->isProduct($importInventory)) { $inventory = new CmlProduct(); $inventory = $this->initilizateCatalogInventory($importInventory, $inventory); $cmlCatalog->addProduct($inventory); } else { $inventory = new CmlService(); $inventory = $this->initilizateCatalogInventory($importInventory, $inventory); $cmlCatalog->addService($inventory); } } return $cmlCatalog; }