ArticleResource   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 51
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getIdByData() 0 4 1
A update() 0 4 1
A create() 0 4 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