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

Post::nextPost()   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 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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