Skip to content

Commit c42dc9b

Browse files
committed
Handle case where a store has no logo and the store information API returns an empty array
1 parent 34cab3f commit c42dc9b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/BigCommerceLegacyApi/ResourceModels/StoreInformation/StoreInformation.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace BigCommerce\ApiV2\ResourceModels\StoreInformation;
44

55
use BigCommerce\ApiV3\ResourceModels\ResourceModel;
6+
use stdClass;
67

78
class StoreInformation extends ResourceModel
89
{
@@ -37,8 +38,16 @@ class StoreInformation extends ResourceModel
3738
public string $plan_name;
3839
public string $plan_level;
3940
public string $industry;
40-
public object $logo;
41+
public ?object $logo;
4142
public string $is_price_entered_with_tax;
4243
public array $active_comparison_modules;
4344
public object $features;
45+
46+
public function __construct(?stdClass $optionObject = null)
47+
{
48+
if (isset($optionObject->logo) && is_array($optionObject->logo)) {
49+
$optionObject->logo = null;
50+
}
51+
parent::__construct($optionObject);
52+
}
4453
}

tests/BigCommerceLegacyApi/Api/StoreInformation/StoreInformationApiTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testCanGetStoreInformationForStoreWithNoLogo()
3434

3535
$information = $this->getApi()->storeInformation()->storeInformation();
3636

37-
$this->assertEquals('BigCommerce', $information->name);
37+
$this->assertEquals('MLITest', $information->name);
3838
$this->assertNull($information->logo);
3939
}
4040
}

0 commit comments

Comments
 (0)