@@ -51,34 +51,34 @@ |
||
| 51 | 51 | 'image' => [Data::class, 'toData'] |
| 52 | 52 | ]; |
| 53 | 53 | |
| 54 | - final protected static function getMetafieldType (): string { |
|
| 54 | + final protected static function getMetafieldType(): string { |
|
| 55 | 55 | return 'article'; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - final protected static function getSearchPath (array $query): string { |
|
| 58 | + final protected static function getSearchPath(array $query): string { |
|
| 59 | 59 | return "blogs/{$query['blog_id']}/articles"; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - final protected static function getSearchType (): string { |
|
| 62 | + final protected static function getSearchType(): string { |
|
| 63 | 63 | return 'articles'; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - final protected static function getType (): string { |
|
| 66 | + final protected static function getType(): string { |
|
| 67 | 67 | return 'article'; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - final public function __toString (): string { |
|
| 70 | + final public function __toString(): string { |
|
| 71 | 71 | return "{$this->getDir()}/{$this->getId()}"; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - final protected function getDir (): string { |
|
| 74 | + final protected function getDir(): string { |
|
| 75 | 75 | return "blogs/{$this->getBlogId()}/articles"; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * @return Comment |
| 80 | 80 | */ |
| 81 | - public function newComment () { |
|
| 81 | + public function newComment() { |
|
| 82 | 82 | assert($this->hasId()); |
| 83 | 83 | return new Comment($this->api, [ |
| 84 | 84 | 'blog_id' => $this->getBlogId(), |
@@ -34,23 +34,23 @@ |
||
| 34 | 34 | |
| 35 | 35 | protected $patch = ['blog_id', 'article_id']; |
| 36 | 36 | |
| 37 | - final protected static function getSearchPath (): string { |
|
| 37 | + final protected static function getSearchPath(): string { |
|
| 38 | 38 | return 'comments'; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - final protected static function getSearchType (): string { |
|
| 41 | + final protected static function getSearchType(): string { |
|
| 42 | 42 | return 'comments'; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - final protected static function getType (): string { |
|
| 45 | + final protected static function getType(): string { |
|
| 46 | 46 | return 'comment'; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - final public function __toString (): string { |
|
| 49 | + final public function __toString(): string { |
|
| 50 | 50 | return "comments/{$this->getId()}"; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - final protected function getDir (): string { |
|
| 53 | + final protected function getDir(): string { |
|
| 54 | 54 | return 'comments'; |
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | \ No newline at end of file |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | use EntityTrait; |
| 16 | 16 | |
| 17 | - final protected static function getType (): string { |
|
| 17 | + final protected static function getType(): string { |
|
| 18 | 18 | return 'collect'; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - final public function __toString (): string { |
|
| 21 | + final public function __toString(): string { |
|
| 22 | 22 | return "collects/{$this->getId()}"; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @return $this |
| 29 | 29 | */ |
| 30 | - public function save () { |
|
| 30 | + public function save() { |
|
| 31 | 31 | assert(!$this->hasId()); |
| 32 | 32 | $remote = $this->api->post('collects', [ |
| 33 | 33 | 'collection_id' => $this->getCollectionId(), |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | 'marketed_resources' => [Resource::class, 'toDataSet'] |
| 80 | 80 | ]; |
| 81 | 81 | |
| 82 | - final protected static function getType (): string { |
|
| 82 | + final protected static function getType(): string { |
|
| 83 | 83 | return 'marketing_event'; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -87,37 +87,37 @@ discard block |
||
| 87 | 87 | * @param Api|Data $caller |
| 88 | 88 | * @param array $data |
| 89 | 89 | */ |
| 90 | - public function __construct ($caller, array $data = []) { |
|
| 90 | + public function __construct($caller, array $data = []) { |
|
| 91 | 91 | parent::__construct($caller, $data); |
| 92 | 92 | $this->engagements = new DataSet(); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - final public function __toString (): string { |
|
| 95 | + final public function __toString(): string { |
|
| 96 | 96 | return "marketing_events/{$this->getId()}"; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - final protected function getDir (): string { |
|
| 99 | + final protected function getDir(): string { |
|
| 100 | 100 | return 'marketing_events'; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * @return Engagement[] |
| 105 | 105 | */ |
| 106 | - public function getEngagements (): array { |
|
| 106 | + public function getEngagements(): array { |
|
| 107 | 107 | return $this->engagements->getItems(); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * @return Engagement |
| 112 | 112 | */ |
| 113 | - public function newEngagement () { |
|
| 113 | + public function newEngagement() { |
|
| 114 | 114 | return $this->engagements->add(new Engagement($this->api)); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * @return Resource |
| 119 | 119 | */ |
| 120 | - public function newResource () { |
|
| 120 | + public function newResource() { |
|
| 121 | 121 | return $this->data['marketed_resources']->add(new Resource($this->api)); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @return $this |
| 128 | 128 | */ |
| 129 | - public function sendEngagements () { |
|
| 129 | + public function sendEngagements() { |
|
| 130 | 130 | assert($this->hasId()); |
| 131 | 131 | if ($this->engagements->count()) { |
| 132 | 132 | $this->api->post("{$this}/engagements", ['engagements' => $this->engagements->getData()]); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | trait MetafieldTrait { |
| 19 | 19 | |
| 20 | - abstract protected static function getMetafieldType (): string; |
|
| 20 | + abstract protected static function getMetafieldType(): string; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @var Api |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @return Metafield[] |
| 34 | 34 | */ |
| 35 | - public function getMetafields () { |
|
| 35 | + public function getMetafields() { |
|
| 36 | 36 | assert($this->hasId()); |
| 37 | 37 | if (!isset($this->metafields)) { |
| 38 | 38 | $remote = $this->api->get('metafields', [ |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param string $key |
| 55 | 55 | * @return Metafield |
| 56 | 56 | */ |
| 57 | - public function newMetafield (string $namespace, string $key) { |
|
| 57 | + public function newMetafield(string $namespace, string $key) { |
|
| 58 | 58 | $this->getMetafields(); |
| 59 | 59 | /** @var Data $self */ |
| 60 | 60 | $self = $this; |
@@ -23,15 +23,15 @@ |
||
| 23 | 23 | 'provinces' => [Province::class, 'toDataSet'] |
| 24 | 24 | ]; |
| 25 | 25 | |
| 26 | - final protected static function getType (): string { |
|
| 26 | + final protected static function getType(): string { |
|
| 27 | 27 | return 'country'; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - final public function __toString (): string { |
|
| 30 | + final public function __toString(): string { |
|
| 31 | 31 | return "countries/{$this->getId()}"; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - final protected function getDir (): string { |
|
| 34 | + final protected function getDir(): string { |
|
| 35 | 35 | return 'countries'; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | const COMMENTS_MODERATED = 'moderate'; |
| 34 | 34 | const COMMENTS_OPEN = 'yes'; |
| 35 | 35 | |
| 36 | - final protected static function getMetafieldType (): string { |
|
| 36 | + final protected static function getMetafieldType(): string { |
|
| 37 | 37 | return 'blog'; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - protected static function getSearchPath (): string { |
|
| 40 | + protected static function getSearchPath(): string { |
|
| 41 | 41 | return 'blogs'; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - protected static function getSearchType (): string { |
|
| 44 | + protected static function getSearchType(): string { |
|
| 45 | 45 | return 'blogs'; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - final protected static function getType (): string { |
|
| 48 | + final protected static function getType(): string { |
|
| 49 | 49 | return 'blog'; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -53,23 +53,23 @@ discard block |
||
| 53 | 53 | * @param Api $api |
| 54 | 54 | * @return static[] |
| 55 | 55 | */ |
| 56 | - public static function loadAll (Api $api) { |
|
| 56 | + public static function loadAll(Api $api) { |
|
| 57 | 57 | $proto = new static($api); |
| 58 | 58 | return static::toList($proto, $api->get('blogs')['blogs']); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - final public function __toString (): string { |
|
| 61 | + final public function __toString(): string { |
|
| 62 | 62 | return "blogs/{$this->getId()}"; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - final protected function getDir (): string { |
|
| 65 | + final protected function getDir(): string { |
|
| 66 | 66 | return 'blogs'; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * @return Article |
| 71 | 71 | */ |
| 72 | - public function newArticle () { |
|
| 72 | + public function newArticle() { |
|
| 73 | 73 | assert($this->hasId()); |
| 74 | 74 | return new Article($this->api, ['blog_id' => $this->getId()]); |
| 75 | 75 | } |
@@ -37,22 +37,22 @@ |
||
| 37 | 37 | 'country_harmonized_system_codes' => [CountrySystemCode::class, 'toDataSet'] |
| 38 | 38 | ]; |
| 39 | 39 | |
| 40 | - final protected static function getType (): string { |
|
| 40 | + final protected static function getType(): string { |
|
| 41 | 41 | return 'inventory_item'; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - final public function __toString (): string { |
|
| 44 | + final public function __toString(): string { |
|
| 45 | 45 | return "inventory_items/{$this->getId()}"; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - final protected function getDir (): string { |
|
| 48 | + final protected function getDir(): string { |
|
| 49 | 49 | return "inventory_items"; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * @return CountrySystemCode |
| 54 | 54 | */ |
| 55 | - public function newCountrySystemCode () { |
|
| 55 | + public function newCountrySystemCode() { |
|
| 56 | 56 | return $this->data['country_harmonized_system_codes']->add(CountrySystemCode::toData($this, [])); |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | \ No newline at end of file |
@@ -22,19 +22,19 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | use SearchTrait; |
| 24 | 24 | |
| 25 | - final protected static function getSearchPath (): string { |
|
| 25 | + final protected static function getSearchPath(): string { |
|
| 26 | 26 | return 'customer_saved_searches'; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - final protected static function getSearchType (): string { |
|
| 29 | + final protected static function getSearchType(): string { |
|
| 30 | 30 | return 'customer_saved_searches'; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - final protected static function getType (): string { |
|
| 33 | + final protected static function getType(): string { |
|
| 34 | 34 | return 'customer_saved_search'; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - final public function __toString (): string { |
|
| 37 | + final public function __toString(): string { |
|
| 38 | 38 | return "customer_saved_searches/{$this->getId()}"; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param array $args |
| 43 | 43 | * @return Customer[] |
| 44 | 44 | */ |
| 45 | - public function getCustomers (array $args) { |
|
| 45 | + public function getCustomers(array $args) { |
|
| 46 | 46 | assert($this->hasId()); |
| 47 | 47 | // no since_id support? |
| 48 | 48 | $args += ['limit' => 250]; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | return Customer::toList($this, $remote['customers']); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - final protected function getDir (): string { |
|
| 53 | + final protected function getDir(): string { |
|
| 54 | 54 | return 'customer_saved_searches'; |
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | \ No newline at end of file |