TwitterMeta   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A title() 0 5 1
A description() 0 5 1
A image() 0 5 1
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