ArticleResource::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace TEiling\Scd16\Resource;
4
5
use Shopware\Components\Api\Resource\Article;
6
7
class ArticleResource implements ArticleResourceInterface
8
{
9
    /** @var Article $articleRes  */
10
    private $articleRes;
11
12
    /**
13
     * ArticleResource constructor.
14
     *
15
     * @param $articleRes
16
     */
17
    public function __construct(Article $articleRes)
18
    {
19
        $this->articleRes = $articleRes;
20
    }
21
22
    /**
23
     * @param $data
24
     *
25
     * @return int|boolean
26
     */
27
    public function getIdByData($data)
28
    {
29
        return $this->articleRes->getIdByData($data);
30
    }
31
32
    /**
33
     * @param       $articleId
34
     * @param array $article
35
     *
36
     * @return mixed
37
     * @throws \Shopware\Components\Api\Exception\ValidationException
38
     * @throws \Shopware\Components\Api\Exception\ParameterMissingException
39
     * @throws \Shopware\Components\Api\Exception\NotFoundException
40
     */
41
    public function update($articleId, array $article)
42
    {
43
        return $this->articleRes->update($articleId, $article);
44
    }
45
46
    /**
47
     * @param array $article
48
     *
49
     * @return mixed
50
     * @throws \Shopware\Components\Api\Exception\ValidationException
51
     * @throws \Shopware\Components\Api\Exception\CustomValidationException
52
     */
53
    public function create(array $article)
54
    {
55
        return $this->articleRes->create($article);
56
    }
57
}
58