Comment::getBlog()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Helix\Shopify\Blog\Article;
4
5
use Helix\Shopify\Base\AbstractEntity;
6
use Helix\Shopify\Base\AbstractEntity\CrudTrait;
7
use Helix\Shopify\Blog;
8
use Helix\Shopify\Blog\Article;
9
10
/**
11
 * A blog article comment.
12
 *
13
 * @see https://shopify.dev/docs/admin-api/rest/reference/online-store/comment
14
 *
15
 * @method string   getArticleId    () injected
16
 * @method string   getAuthor       ()
17
 * @method string   getBlogId       () injected
18
 * @method string   getBody         ()
19
 * @method string   getBodyHtml     ()
20
 * @method string   getCreatedAt    ()
21
 * @method string   getEmail        ()
22
 * @method string   getIp           ()
23
 * @method string   getPublishedAt  ()
24
 * @method string   getStatus       ()
25
 * @method string   getUpdatedAt    ()
26
 * @method string   getUserAgent    ()
27
 *
28
 * @method $this    setAuthor       (string $author)
29
 * @method $this    setBody         (string $body)
30
 * @method $this    setBodyHtml     (string $html)
31
 * @method $this    setEmail        (string $email)
32
 * @method $this    setIp           (string $ip)
33
 */
34
class Comment extends AbstractEntity
35
{
36
37
    use CrudTrait;
38
39
    const TYPE = 'comment';
40
    const DIR = 'comments';
41
42
    protected function _container()
43
    {
44
        return $this->getArticle();
45
    }
46
47
    protected function _dir(): string
48
    {
49
        return 'comments';
50
    }
51
52
    /**
53
     * @return Article
54
     */
55
    public function getArticle()
56
    {
57
        return Article::load($this, $this->getArticleId());
58
    }
59
60
    /**
61
     * @return Blog
62
     */
63
    public function getBlog()
64
    {
65
        return Blog::load($this, $this->getBlogId());
66
    }
67
}