public function init() { setlocale(LC_MONETARY, $this->config['locale']); foreach ($this->config['product'] as $productData) { $product = new Product(); $product->setName($productData['name']); $product->setPictureUrl($productData['picture']); foreach ($productData['store'] as $storeData) { $store = new Store(); $store->setName($storeData['name']); $store->setUrl($storeData['url']); $selectorData = $storeData['selector']; $store->setSelector($selectorData['path']); $store->setSelectorValue($selectorData['value']); $store->setProduct($product); $product->addStore($store); } $this->addProduct($product); } }