-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #420 from wizaplace/develop
Merge develop for 1.44.3
- Loading branch information
Showing
28 changed files
with
1,415 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* @author Wizacha DevTeam <[email protected]> | ||
* @copyright Copyright (c) Wizacha | ||
* @license Proprietary | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Wizaplace\SDK\Catalog; | ||
|
||
class ProductOffer | ||
{ | ||
/** @var int */ | ||
private $productId; | ||
/** @var int */ | ||
private $companyId; | ||
/** @var float */ | ||
private $price; | ||
/** @var array */ | ||
private $divisions; | ||
|
||
public function __construct(array $data) | ||
{ | ||
$this->productId = (int) $data['productId']; | ||
$this->companyId = (int) $data['companyId']; | ||
$this->price = (float) $data['price']; | ||
$this->divisions = array_filter($data['divisions']); | ||
} | ||
|
||
public function getProductId(): int | ||
{ | ||
return $this->productId; | ||
} | ||
|
||
public function getCompanyId(): int | ||
{ | ||
return $this->companyId; | ||
} | ||
|
||
public function getPrice(): float | ||
{ | ||
return $this->price; | ||
} | ||
|
||
public function getDivisions(): array | ||
{ | ||
return $this->divisions; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) Wizacha | ||
* @license Proprietary | ||
*/ | ||
|
||
namespace Wizaplace\SDK\Division; | ||
|
||
use Wizaplace\SDK\User\UserType; | ||
|
||
final class Division | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $code; | ||
|
||
/** | ||
* @var null|string | ||
*/ | ||
private $parentCode; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
private $level; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
private $isEnabled; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $description; | ||
|
||
/** | ||
* @var null|int | ||
*/ | ||
private $companyId; | ||
|
||
/** | ||
* @var null|UserType | ||
*/ | ||
private $disabledBy; | ||
|
||
/** | ||
* @var null|int | ||
*/ | ||
private $productId; | ||
|
||
/** | ||
* @var Division[] | ||
*/ | ||
private $children; | ||
|
||
public function __construct(array $data) | ||
{ | ||
$this->code = $data['code']; | ||
$this->parentCode = $data['parentCode']; | ||
$this->level = $data['level']; | ||
$this->isEnabled = $data['isEnabled']; | ||
$this->description = $data['description']; | ||
$this->companyId = $data['companyId'] ?? null; | ||
$this->disabledBy = $data['disabledBy'] ?? null; | ||
$this->productId = $data['productId'] ?? null; | ||
$this->children = []; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getCode(): string | ||
{ | ||
return $this->code; | ||
} | ||
|
||
/** | ||
* @return null|string | ||
*/ | ||
public function getParentCode(): ?string | ||
{ | ||
return $this->parentCode; | ||
} | ||
|
||
/** | ||
* @return int | ||
*/ | ||
public function getLevel(): int | ||
{ | ||
return $this->level; | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function isEnabled(): bool | ||
{ | ||
return $this->isEnabled; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDescription(): string | ||
{ | ||
return $this->description; | ||
} | ||
|
||
/** | ||
* @return int|null | ||
*/ | ||
public function getCompanyId(): ?int | ||
{ | ||
return $this->companyId; | ||
} | ||
|
||
/** | ||
* @return null|UserType | ||
*/ | ||
public function getDisabledBy(): ?UserType | ||
{ | ||
if (is_null($this->disabledBy)) { | ||
return null; | ||
} | ||
|
||
return ($this->disabledBy === UserType::ADMIN()->getValue()) ? UserType::ADMIN() : UserType::VENDOR(); | ||
} | ||
|
||
/** | ||
* @return int|null | ||
*/ | ||
public function getProductId(): ?int | ||
{ | ||
return $this->productId; | ||
} | ||
|
||
/** | ||
* @return Division[] | ||
*/ | ||
public function getChildren(): array | ||
{ | ||
return $this->children; | ||
} | ||
|
||
public function addChild(Division $child): void | ||
{ | ||
$this->children[] = $child; | ||
} | ||
} |
Oops, something went wrong.