Completed
Push — master ( cb6493...8e9bfe )
by Dev
04:15
created

UserAgentTrait::setDesktopUserAgent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PiedWeb\Curl;
4
5
trait UserAgentTrait
6
{
7
    abstract public function setUserAgent(string $ua);
8
9
    /**
10
     * An self::setUserAgent()'s alias to add an user-agent wich correspond to a Desktop PC.
11
     *
12
     * @return self
13
     */
14 18
    public function setDesktopUserAgent()
15
    {
16 18
        $this->setUserAgent('Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0');
17
18 18
        return $this;
19
    }
20
21
    /**
22
     * An self::setUserAgent()'s alias to add an user-agent wich correspond to a mobile.
23
     *
24
     * @return self
25
     */
26 3
    public function setMobileUserAgent()
27
    {
28 3
        $this->setUserAgent('Mozilla/5.0 (Linux; Android 7.0; SM-G892A Build/NRD90M; wv) AppleWebKit/537.36'
29 3
            .' (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Mobile Safari/537.36');
30
31 3
        return $this;
32
    }
33
34
    /**
35
     * An self::setUserAgent()'s alias to add an user-agent wich correspond to a webrowser without javascript.
36
     *
37
     * @return self
38
     */
39 3
    public function setLessJsUserAgent()
40
    {
41 3
        $this->setUserAgent('NokiaN70-1/5.0609.2.0.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1 '
42 3
            .'UP.Link/6.3.1.13.0');
43
44 3
        return $this;
45
    }
46
}
47