Test Failed
Push — develop ( 1b85da...6edfdb )
by Jens
54:58 queued 29:56
created

ShoppingListSetStoreAction::fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Request\ShoppingLists\Command;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Model\Store\StoreReference;
10
use Commercetools\Core\Request\AbstractAction;
11
12
/**
13
 * @package Commercetools\Core\Request\ShoppingLists\Command
14
 * @link https://docs.commercetools.com/http-api-projects-shoppingLists.html#set-store
15
 * @method string getAction()
16
 * @method ShoppingListSetStoreAction setAction(string $action = null)
17
 * @method StoreReference getStore()
18
 * @method ShoppingListSetStoreAction setStore(StoreReference $store = null)
19
 */
20
class ShoppingListSetStoreAction extends AbstractAction
21
{
22
    public function fieldDefinitions()
23
    {
24
        return [
25
            'action' => [static::TYPE => 'string'],
26
            'store' => [static::TYPE => StoreReference::class],
27
        ];
28
    }
29
30
    /**
31
     * @param array $data
32
     * @param Context|callable $context
33
     */
34
    public function __construct(array $data = [], $context = null)
35
    {
36
        parent::__construct($data, $context);
37
        $this->setAction('setStore');
38
    }
39
40
    /**
41
     * @param StoreReference $store
42
     * @param Context|callable $context
43
     * @return ShoppingListSetStoreAction
44
     */
45
    public static function ofStore(StoreReference $store, $context = null)
46
    {
47
        return static::of($context)->setStore($store);
48
    }
49
}
50