Passed
Push — master ( ef74f3...d652f7 )
by Dev
02:15
created

UserAgentTrait::setMobileUserAgent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
ccs 4
cts 4
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
    /**
8
     * An self::setUserAgent()'s alias to add an user-agent wich correspond to a Destkop PC.
9
     *
10
     * @return self
11
     */
12 15
    public function setDestkopUserAgent()
13
    {
14 15
        $this->setUserAgent('Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0');
0 ignored issues
show
Bug introduced by
It seems like setUserAgent() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
        $this->/** @scrutinizer ignore-call */ 
15
               setUserAgent('Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0');
Loading history...
15
16 15
        return $this;
17
    }
18
19
    /**
20
     * An self::setUserAgent()'s alias to add an user-agent wich correspond to a mobile.
21
     *
22
     * @return self
23
     */
24 3
    public function setMobileUserAgent()
25
    {
26 3
        $this->setUserAgent('Mozilla/5.0 (Linux; Android 7.0; SM-G892A Build/NRD90M; wv) AppleWebKit/537.36'
27 3
            .' (KHTML, like Gecko) Version/4.0 Chrome/60.0.3112.107 Mobile Safari/537.36');
28
29 3
        return $this;
30
    }
31
32
    /**
33
     * An self::setUserAgent()'s alias to add an user-agent wich correspond to a webrowser without javascript.
34
     *
35
     * @return self
36
     */
37 3
    public function setLessJsUserAgent()
38
    {
39 3
        $this->setUserAgent('NokiaN70-1/5.0609.2.0.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1 '
40 3
            .'UP.Link/6.3.1.13.0');
41
42 3
        return $this;
43
    }
44
}
45