UrlEmbed   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getConfig() 0 3 1
A setConfig() 0 3 1
A getEmbed() 0 3 2
1
<?php
2
3
/**
4
 * @file
5
 * Contains Drupal\url_embed\UrlEmbed.
6
 */
7
8
namespace Drupal\url_embed;
9
10
use Embed\Embed;
11
12
/**
13
 * A service class for handling URL embeds.
14
 */
15
class UrlEmbed implements UrlEmbedInterface {
16
17
  /**
18
   * @var array
19
   */
20
  public $config;
21
22
  /**
23
   * @{inheritdoc}
24
   */
25
  public function __construct(array $config = []) {
26
    $this->config = $config;
27
  }
28
29
  /**
30
   * @{inheritdoc}
31
   */
32
  public function getConfig() {
33
    return $this->config;
34
  }
35
36
  /**
37
   * @{inheritdoc}
38
   */
39
  public function setConfig(array $config) {
40
    $this->config = $config;
41
  }
42
43
  /**
44
   * @{inheritdoc}
45
   */
46
  public function getEmbed($request, array $config = []) {
47
    return Embed::create($request, $config ?: $this->config);
48
  }
49
50
}
51