Cdiscount / API-MarketPlace-SDK-PHP

15 stars 42 forks source link

src/public/product/IdentifierRequest.php #54

Open Eayshwary opened 5 years ago

Eayshwary commented 5 years ago

when inserting identifiers into $this->_valueList : in function

public function addValue($value) { array_push($this->_valueList, $value); }

directly pushing the value of identifier and if the values are already present in the array it makes execution time much more since it starts fetching same product number of times,

there can be small enhancement to reduce such complexities like below : we can first check wheather or not values already present in an array before pushing them.

public function addValue($value) { if (!in_array($value, $this->_valueList)) { array_push($this->_valueList, $value); } }