Passed
Push — develop ( b02061...820347 )
by Andreas
03:07
created

Product::getTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Wambo\Catalog\Model;
4
5
/**
6
 * Class Product represents a single catalog item or product.
7
 *
8
 * @package Wambo\Catalog
9
 */
10
class Product
11
{
12
    /**
13
     * @var SKU
14
     */
15
    private $sku;
16
    /**
17
     * @var Slug
18
     */
19
    private $slug;
20
    /**
21
     * @var Content
22
     */
23
    private $content;
24
25
    /**
26
     * Creates a new Product basic class instance.
27
     *
28
     * @param SKU     $sku     A unique identifier for the product (e.g. "fancy-short-1")
29
     * @param Slug    $slug    A human-readable, descriptive URL fragment for the product (e.g.
30
     *                         "fancy-t-shirt-1-with-ice-cream-pooping-unicorn")
31
     * @param Content $content A product content model
32
     *
33
     */
34 9
    public function __construct(SKU $sku, Slug $slug, Content $content)
35
    {
36 9
        $this->sku = $sku;
37 9
        $this->slug = $slug;
38 9
        $this->content = $content;
39 9
    }
40
41
    /**
42
     * Get the unique identifier for the product (e.g. "fancy-short-1")
43
     *
44
     * @return SKU
45
     */
46 6
    public function getSku()
47
    {
48 6
        return $this->sku;
49
    }
50
51
    /**
52
     * Get the human-readable, descriptive URL fragment for the product (e.g.
53
     *                        "fancy-t-shirt-1-with-ice-cream-pooping-unicorn")
54
     *
55
     * @return Slug
56
     */
57 5
    public function getSlug()
58
    {
59 5
        return $this->slug;
60
    }
61
62
    /**
63
     * Get the title of the product (e.g. "Fancy T-Shirt No. 1")
64
     *
65
     * @return string
66
     */
67
    public function getTitle()
68
    {
69
        return $this->content->getTitle();
70
    }
71
72
    /**
73
     * Get a short description text of the product (e.g. "The first edition of our fancy T-Shirt with a unicorn pooping
74
     * ice cream on the front")
75
     *
76
     * @return string
77
     */
78
    public function getSummaryText()
79
    {
80
        return $this->content->getSummaryText();
81
    }
82
83
    /**
84
     * Get a full product description text
85
     *
86
     * @return string
87
     */
88
    public function getProductDescription()
89
    {
90
        return $this->content->getProductDescription();
91
    }
92
}