Completed
Pull Request — master (#3)
by Kevin
03:52
created

Tweet   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 31
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A tweet() 0 12 1
1
<?php
2
3
namespace Magium\Twitter\Actions;
4
5
use Magium\Twitter\Themes\Twitter;
6
use Magium\WebDriver\ExpectedCondition;
7
use Magium\WebDriver\WebDriver;
8
9
class Tweet
10
{
11
12
    const ACTION = 'Magium\Twitter\Actions\Tweet';
13
14
    protected $theme;
15
    protected $webDriver;
16
17
    public function __construct(
18
        Twitter $theme,
19
        WebDriver $webDriver
20
    )
21
    {
22
        $this->theme = $theme;
23
        $this->webDriver = $webDriver;
24
    }
25
26
    public function tweet($text)
27
    {
28
29
        $element = $this->webDriver->byXpath($this->theme->getTweetBoxXpath());
30
        $element->click();
31
32
        $this->webDriver->getKeyboard()->sendKeys($text);
33
34
        $element = $this->webDriver->byXpath($this->theme->getTweetButton());
35
        $element->click();
36
37
    }
38
39
}