TinyMCE   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A fill() 0 4 1
A type() 0 5 1
A read() 0 4 1
1
<?php
2
/**
3
 * @author Sergii Bondarenko, <[email protected]>
4
 */
5
namespace Drupal\TqExtension\Utils\Wysiwyg;
6
7
// Contexts.
8
use Drupal\TqExtension\Context\RawTqContext;
9
10
class TinyMCE extends Wysiwyg
11
{
12
    public function __construct(RawTqContext $context)
13
    {
14
        $this->setContext($context);
15
        $this->setObject("tinyMCE.get('%s')");
16
    }
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function fill($text, $selector = '')
22
    {
23
        $this->execute('setContent', $selector, [$text]);
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function type($text, $selector = '')
30
    {
31
        // Unfortunately, TinyMCE cannot type to an editor.
32
        $this->fill($text, $selector);
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function read($selector = '')
39
    {
40
        return $this->execute('getContent', $selector);
41
    }
42
}
43