Code Duplication    Length = 10-10 lines in 4 locations

src/Device.php 1 location

@@ 28-37 (lines=10) @@
25
     *
26
     * @throws \Sinergi\BrowserDetector\InvalidArgumentException
27
     */
28
    public function __construct($userAgent = null)
29
    {
30
        if ($userAgent instanceof UserAgent) {
31
            $this->setUserAgent($userAgent);
32
        } elseif (null === $userAgent || is_string($userAgent)) {
33
            $this->setUserAgent(new UserAgent($userAgent));
34
        } else {
35
            throw new InvalidArgumentException();
36
        }
37
    }
38
39
    /**
40
     * @param UserAgent $userAgent

src/Os.php 1 location

@@ 56-65 (lines=10) @@
53
     *
54
     * @throws \Sinergi\BrowserDetector\InvalidArgumentException
55
     */
56
    public function __construct($userAgent = null)
57
    {
58
        if ($userAgent instanceof UserAgent) {
59
            $this->setUserAgent($userAgent);
60
        } elseif (null === $userAgent || is_string($userAgent)) {
61
            $this->setUserAgent(new UserAgent($userAgent));
62
        } else {
63
            throw new InvalidArgumentException();
64
        }
65
    }
66
67
    /**
68
     * Return the name of the OS.

src/Browser.php 1 location

@@ 97-106 (lines=10) @@
94
     *
95
     * @throws \Sinergi\BrowserDetector\InvalidArgumentException
96
     */
97
    public function __construct($userAgent = null)
98
    {
99
        if ($userAgent instanceof UserAgent) {
100
            $this->setUserAgent($userAgent);
101
        } elseif (null === $userAgent || is_string($userAgent)) {
102
            $this->setUserAgent(new UserAgent($userAgent));
103
        } else {
104
            throw new InvalidArgumentException();
105
        }
106
    }
107
108
    /**
109
     * Set the name of the Browser.

src/ScriptedAgent.php 1 location

@@ 83-92 (lines=10) @@
80
     */
81
    private $url;
82
83
    public function __construct($userAgent = null)
84
    {
85
        if ($userAgent instanceof UserAgent) {
86
            $this->setUserAgent($userAgent);
87
        } elseif (null === $userAgent || is_string($userAgent)) {
88
            $this->setUserAgent(new UserAgent($userAgent));
89
        } else {
90
            throw new InvalidArgumentException();
91
        }
92
    }
93
94
    /**
95
     * Set the name of the ScriptedAgent.