Passed
Push — develop ( ec1e42...80559e )
by Brent
03:22
created

TwitterMeta::description()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Pageon\Html\Meta\Social;
4
5
use Pageon\Html\Meta\Meta;
6
use Pageon\Html\Meta\SocialMeta;
7
8
final class TwitterMeta implements SocialMeta
9
{
10
    private $meta;
11
12 34
    public function __construct(Meta $meta, string $type = 'article') {
13 34
        $this->meta = $meta;
14
15 34
        $this->meta->name('twitter:card', $type);
16 34
    }
17
18 13
    public function title(string $title) : SocialMeta {
19 13
        $this->meta->name('twitter:title', $title);
20
21 13
        return $this;
22
    }
23
24 11
    public function description(string $description) : SocialMeta {
25 11
        $this->meta->name('twitter:description', substr($description, 0, 199));
26
27 11
        return $this;
28
    }
29
30 2
    public function image(string $image) : SocialMeta {
31 2
        $this->meta->name('twitter:image', $image);
32
33 2
        return $this;
34
    }
35
}
36