UrlEmbed::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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