forked from aligent/bigcommerce-v3-api-php-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHasCustomUrl.php
More file actions
30 lines (25 loc) · 720 Bytes
/
HasCustomUrl.php
File metadata and controls
30 lines (25 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace BigCommerce\ApiV3\ResourceModels;
use BigCommerce\Tests\Api\Catalog\CustomUrl;
trait HasCustomUrl
{
public ?CustomUrl $custom_url;
/**
* Set the URL for a category, brand, or product.
*
* Just a shortcut to setting {url, is_customized: true}
*/
public function setCustomUrl(string $url): void
{
$this->custom_url = new CustomUrl();
$this->custom_url->url = $url;
$this->custom_url->is_customized = true;
}
protected function buildCustomUrl(\stdClass $data): void
{
if (isset($data->custom_url)) {
$this->custom_url = new CustomUrl($data->custom_url);
unset($data->custom_url);
}
}
}