Skip to content

Commit

Permalink
CDPIP-2116
Browse files Browse the repository at this point in the history
  • Loading branch information
szsanyi committed Nov 21, 2019
1 parent 31e1140 commit 1f90e43
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions Model/Api/CustomersApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ public function get($page, $pageSize, $websiteId = null, $storeId = null, $onlyR

$this
->handleWebsiteId($websiteId, $onlyReg)
->initCollection($websiteId)
->initCollection()
->handleIds($page, $pageSize)
->handleAttributeData($websiteId)
->handleAddressesAttributeData($websiteId)
->handleAttributeData()
->handleAddressesAttributeData()
->joinSubscriptionStatus()
->setWhere()
->setOrder();
Expand All @@ -126,7 +126,7 @@ public function get($page, $pageSize, $websiteId = null, $storeId = null, $onlyR
->setLastPage($lastPageNumber)
->setPageSize($pageSize)
->setTotalCount($this->numberOfItems)
->setCustomers($this->handleCustomers($websiteId));
->setCustomers($this->handleCustomers());
}

/**
Expand All @@ -144,13 +144,11 @@ private function handleWebsiteId($websiteId = null, $onlyReg = false)
}

/**
* @param int $websiteId
*
* @return $this
*/
private function initCollection($websiteId)
private function initCollection()
{
$this->customerHelper->initCollection($websiteId);
$this->customerHelper->initCollection($this->websiteId);

return $this;
}
Expand All @@ -176,32 +174,28 @@ private function handleIds($page, $pageSize)
}

/**
* @param int $websiteId
*
* @return $this
*/
private function handleAttributeData($websiteId)
private function handleAttributeData()
{
$this->customerHelper->getCustomersAttributeData(
$this->minId,
$this->maxId,
$websiteId
$this->websiteId
);

return $this;
}

/**
* @param int $websiteId
*
* @return $this
*/
private function handleAddressesAttributeData($websiteId)
private function handleAddressesAttributeData()
{
$this->customerHelper->getCustomersAddressesAttributeData(
$this->minId,
$this->maxId,
$websiteId
$this->websiteId
);

return $this;
Expand All @@ -228,15 +222,13 @@ protected function setOrder()
}

/**
* @param int $websiteId
*
* @return array
*/
private function handleCustomers($websiteId)
private function handleCustomers()
{
$customerArray = [];
foreach ($this->customerHelper->getCustomerCollection() as $customer) {
$customerArray[] = $this->customerHelper->buildCustomerObject($customer, $websiteId);
$customerArray[] = $this->customerHelper->buildCustomerObject($customer, $this->websiteId);
}

return $customerArray;
Expand Down

0 comments on commit 1f90e43

Please sign in to comment.