Completed
Pull Request — master (#10)
by Tomáš
04:50 queued 01:55
created

Post   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 40
ccs 0
cts 28
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A date() 0 4 1
A title() 0 4 1
A previousPost() 0 4 1
A setPreviousItem() 0 8 1
A nextPost() 0 4 1
A setNextItem() 0 8 1
1
<?php
2
3
/*
4
 * This file is a part of Sculpin.
5
 *
6
 * (c) Dragonfly Development Inc.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sculpin\Bundle\PostsBundle;
13
14
use Symplify\PHP7_Sculpin\ProxySourceCollection\ProxySourceItem;
15
16
/**
17
 * Post.
18
 *
19
 * @author Beau Simensen <[email protected]>
20
 */
21
class Post extends ProxySourceItem
22
{
23
    public function date()
24
    {
25
        return $this->data()->get('calculated_date');
26
    }
27
28
    public function title()
29
    {
30
        return $this->data()->get('title');
31
    }
32
33
    public function previousPost()
34
    {
35
        return $this->previousItem();
36
    }
37
38
    public function setPreviousItem(ProxySourceItem $item = null)
39
    {
40
        parent::setPreviousItem($item);
41
42
        // expose additional metadata
43
        $this->data()->set('previous_post', $item);
44
        $this->data()->set('previousPost', $item); // @deprecated
45
    }
46
47
    public function nextPost()
48
    {
49
        return $this->nextItem();
50
    }
51
52
    public function setNextItem(ProxySourceItem $item = null)
53
    {
54
        parent::setNextItem($item);
55
56
        // expose additional metadata
57
        $this->data()->set('next_post', $item);
58
        $this->data()->set('nextPost', $item); // @deprecated
59
    }
60
}
61