Passed
Pull Request — develop (#1)
by Andreas
02:52
created

Product::getTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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 string
22
     */
23
    private $title;
0 ignored issues
show
Unused Code introduced by
The property $title is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
24
    /**
25
     * @var Content
26
     */
27
    private $content;
28
29
    /**
30
     * Creates a new Product basic class instance.
31
     *
32
     * @param SKU     $sku     A unique identifier for the product (e.g. "fancy-short-1")
33
     * @param Slug    $slug    A human-readable, descriptive URL fragment for the product (e.g.
34
     *                         "fancy-t-shirt-1-with-ice-cream-pooping-unicorn")
35
     * @param Content $content A product content model
36
     *
37
     */
38 8
    public function __construct(SKU $sku, Slug $slug, Content $content)
39
    {
40 8
        $this->sku = $sku;
41 8
        $this->slug = $slug;
42 8
        $this->content = $content;
43 8
    }
44
45
    /**
46
     * Get the unique identifier for the product (e.g. "fancy-short-1")
47
     *
48
     * @return SKU
49
     */
50 7
    public function getSku()
51
    {
52 7
        return $this->sku;
53
    }
54
55
    /**
56
     * Get the human-readable, descriptive URL fragment for the product (e.g.
57
     *                        "fancy-t-shirt-1-with-ice-cream-pooping-unicorn")
58
     *
59
     * @return Slug
60
     */
61 7
    public function getSlug()
62
    {
63 7
        return $this->slug;
64
    }
65
66
    /**
67
     * Get the title of the product (e.g. "Fancy T-Shirt No. 1")
68
     *
69
     * @return string
70
     */
71 1
    public function getTitle()
72
    {
73 1
        return $this->content->getTitle();
74
    }
75
76
    /**
77
     * Get a short description text of the product (e.g. "The first edition of our fancy T-Shirt with a unicorn pooping
78
     * ice cream on the front")
79
     *
80
     * @return string
81
     */
82 1
    public function getSummaryText()
83
    {
84 1
        return $this->content->getSummaryText();
85
    }
86
87
    /**
88
     * Get a full product description text
89
     *
90
     * @return string
91
     */
92 1
    public function getProductDescription()
93
    {
94 1
        return $this->content->getProductDescription();
95
    }
96
}