Passed
Push — master ( da0795...78880b )
by Jens
14:45 queued 18s
created

ProjectSetExternalOAuthAction::fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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