Article::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 11
cts 11
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 1
crap 1
1
<?php
2
3
namespace ShopifyClient\Resource;
4
5
use ShopifyClient\Action\Action;
6
use ShopifyClient\Request;
7
8
/**
9
 * https://help.shopify.com/api/reference/article
10
 *
11
 * @method create(float $parentId, array $parameters = [])
12
 * @method get(float $parentId, float $childId)
13
 * @method all(float $parentId, array $parameters = [])
14
 * @method count(float $parentId)
15
 * @method update(float $parentId, float $childId, array $parameters = [])
16
 * @method tags(float $parentId, array $parameters = [])
17
 * @method authors
18
 * @method delete(float $parentId, float $childId)
19
 *
20
 * @property ArticleMetaField $metafields
21
 * @property CustomerAddress $addresses
22
 */
23
class Article extends AbstractResource implements Resource
24
{
25
    /**
26
     * @var array
27
     */
28
    protected $childResources = [
29
        'metafields' => ArticleMetaField::class,
30
    ];
31
32
    /**
33
     * Article constructor.
34
     * @param Request $request
35
     */
36 5
    public function __construct(Request $request)
37
    {
38 5
        parent::__construct($request);
39
40 5
        $this->actions->add('create', new Action(Request::METHOD_POST, 'blogs/%s/articles.json', 'article', 'article'));
41 5
        $this->actions->add('get', new Action(Request::METHOD_GET, 'blogs/%s/articles/%s.json', 'article', 'article'));
42 5
        $this->actions->add('all', new Action(Request::METHOD_GET, 'blogs/%s/articles.json', 'articles', 'articles'));
43 5
        $this->actions->add('count', new Action(Request::METHOD_GET, 'blogs/%s/articles/count.json', 'count', 'count'));
44 5
        $this->actions->add('update', new Action(Request::METHOD_PUT, 'blogs/%s/articles/%s.json', 'article', 'article'));
45 5
        $this->actions->add('tags', new Action(Request::METHOD_GET, 'blogs/%s/articles/tags.json', 'tags', 'tags'));
46 5
        $this->actions->add('authors', new Action(Request::METHOD_GET, 'articles/authors.json', 'authors', 'authors'));
47 5
        $this->actions->add('delete', new Action(Request::METHOD_DELETE, 'blogs/%s/articles/%s.json'));
48 5
    }
49
}
50