@@ -41,7 +41,7 @@ |
||
| 41 | 41 | { |
| 42 | 42 | $requiredParams = ['apiKey', 'login', 'passwordHash', 'isSandbox', 'countryCode']; |
| 43 | 43 | |
| 44 | - foreach($requiredParams as $property) { |
|
| 44 | + foreach ($requiredParams as $property) { |
|
| 45 | 45 | if (!array_key_exists($property, $params)) { |
| 46 | 46 | throw new Exception("{$property} is required in params array"); |
| 47 | 47 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -use PHPUnit\Framework\TestCase; |
|
| 3 | +use PHPUnit\Framework\TestCase; |
|
| 4 | 4 | use Radowoj\Yaah\Field; |
| 5 | 5 | |
| 6 | 6 | class FieldTest extends TestCase |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @throws Radowoj\Yaah\Exception on failure |
| 41 | 41 | * |
| 42 | - * @param Radowoj\Yaah\Auction $auction Auction to create |
|
| 42 | + * @param Auction $auction Auction to create |
|
| 43 | 43 | * @param integer $localId - local item id, required by WebAPI |
| 44 | 44 | * @return integer id of created auction |
| 45 | 45 | */ |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * @param integer $itemId id of auction to get |
| 128 | - * @return Radowoj\Yaah\Auction | null |
|
| 128 | + * @return Auction|null | null |
|
| 129 | 129 | */ |
| 130 | 130 | public function getAuctionByItemId($itemId) |
| 131 | 131 | { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $data = $this->client->getSellFormFieldsForCategory(['categoryId' => $idCategory]); |
| 24 | 24 | $items = $data->sellFormFieldsForCategory->sellFormFieldsList->item; |
| 25 | 25 | |
| 26 | - return array_map(function ($item) { |
|
| 26 | + return array_map(function($item) { |
|
| 27 | 27 | return [ |
| 28 | 28 | 'fid' => $item->sellFormId, |
| 29 | 29 | 'title' => $item->sellFormTitle, |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function finishAuctions(array $auctionIds, $cancelAllBids = 0, $finishCancelReason = '') |
| 83 | 83 | { |
| 84 | - $finishItemsList = array_map(function ($auctionId) use ($cancelAllBids, $finishCancelReason) { |
|
| 84 | + $finishItemsList = array_map(function($auctionId) use ($cancelAllBids, $finishCancelReason) { |
|
| 85 | 85 | return [ |
| 86 | 86 | 'finishItemId' => $auctionId, |
| 87 | 87 | 'finishCancelAllBids' => $cancelAllBids, |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function getAuctionByItemId($itemId) |
| 131 | 131 | { |
| 132 | - $response = $this->client->getItemFields(['itemId' => $itemId]); |
|
| 132 | + $response = $this->client->getItemFields(['itemId' => $itemId]); |
|
| 133 | 133 | if (isset($response->itemFields->item)) { |
| 134 | 134 | $auction = new Auction(); |
| 135 | 135 | $auction->fromApiRepresentation($response->itemFields->item); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $fields = []; |
| 36 | 36 | |
| 37 | - foreach($this->fields as $fid => $value) { |
|
| 37 | + foreach ($this->fields as $fid => $value) { |
|
| 38 | 38 | $fields[] = (new Field($fid, $value))->toArray(); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $this->fields = []; |
| 52 | 52 | $this->photos = []; |
| 53 | 53 | |
| 54 | - foreach($fields as $apiField) { |
|
| 54 | + foreach ($fields as $apiField) { |
|
| 55 | 55 | $field = new Field(0, ''); |
| 56 | 56 | $field->fromArray((array)$apiField); |
| 57 | 57 | $this->fields[$field->getFid()] = $field->getValue(); |
@@ -127,7 +127,6 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | /** |
| 129 | 129 | * Detect type of range passed as argument (int, float, date) |
| 130 | - * @param array $value value to detect type |
|
| 131 | 130 | */ |
| 132 | 131 | protected function setValueRangeAutodetect(array $range) |
| 133 | 132 | { |
@@ -178,6 +177,9 @@ discard block |
||
| 178 | 177 | } |
| 179 | 178 | |
| 180 | 179 | |
| 180 | + /** |
|
| 181 | + * @param string $forceValueType |
|
| 182 | + */ |
|
| 181 | 183 | protected function setValueForced($forceValueType, $value) |
| 182 | 184 | { |
| 183 | 185 | if (!array_key_exists($forceValueType, $this->fValues)) { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | ['fvalueRangeFloatMin', 'fvalueRangeFloatMax'], |
| 146 | 146 | $range |
| 147 | 147 | ); |
| 148 | - } elseif($this->isRangeInt($range)) { |
|
| 148 | + } elseif ($this->isRangeInt($range)) { |
|
| 149 | 149 | $this->fValues[self::VALUE_RANGE_INT] = array_combine( |
| 150 | 150 | ['fvalueRangeIntMin', 'fvalueRangeIntMax'], |
| 151 | 151 | $range |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $this->setFid($array['fid']); |
| 215 | 215 | unset($array['fid']); |
| 216 | 216 | |
| 217 | - foreach($array as $key => $value) { |
|
| 217 | + foreach ($array as $key => $value) { |
|
| 218 | 218 | if (!array_key_exists($key, $this->fValues)) { |
| 219 | 219 | throw new Exception("Unknown Field property: {$key}"); |
| 220 | 220 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | public function getValue() |
| 238 | 238 | { |
| 239 | 239 | $defaults = $this->getDefaults(); |
| 240 | - foreach($this->fValues as $key => $fValue) { |
|
| 240 | + foreach ($this->fValues as $key => $fValue) { |
|
| 241 | 241 | if ($fValue !== $defaults[$key]) { |
| 242 | 242 | return is_array($fValue) ? array_values($fValue) : $fValue; |
| 243 | 243 | } |