Tweet   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A tweet() 0 15 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
        $this->webDriver->wait(5)->until(ExpectedCondition::elementExists($this->theme->getTweetButton(), WebDriver::BY_XPATH));
0 ignored issues
show
Documentation introduced by
\Magium\WebDriver\Expect...er\WebDriver::BY_XPATH) is of type object<Facebook\WebDrive...riverExpectedCondition>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
35
        $element = $this->webDriver->byXpath($this->theme->getTweetButton());
36
37
        $this->webDriver->wait(5)->until(ExpectedCondition::visibilityOf($element));
0 ignored issues
show
Documentation introduced by
\Magium\WebDriver\Expect...:visibilityOf($element) is of type object<Magium\WebDriver\ExpectedCondition>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
38
        $element->click();
39
40
    }
41
42
}