TwitterMeta::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
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 18
    public function __construct(Meta $meta, string $type = 'article') {
13 18
        $this->meta = $meta;
14
15 18
        $this->meta->name('twitter:card', $type);
16 18
    }
17
18 5
    public function title(string $title) : SocialMeta {
19 5
        $this->meta->name('twitter:title', $title);
20
21 5
        return $this;
22
    }
23
24 4
    public function description(string $description) : SocialMeta {
25 4
        $this->meta->name('twitter:description', substr($description, 0, 199));
26
27 4
        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