Code Duplication    Length = 16-16 lines in 2 locations

src/Browscap.php 1 location

@@ 136-151 (lines=16) @@
133
     * @throws \BrowscapPHP\Exception
134
     * @return \BrowscapPHP\Browscap
135
     */
136
    public function setCache($cache)
137
    {
138
        if ($cache instanceof BrowscapCacheInterface) {
139
            $this->cache = $cache;
140
        } elseif ($cache instanceof AdapterInterface) {
141
            $this->cache = new BrowscapCache($cache);
142
        } else {
143
            throw new Exception(
144
                'the cache has to be an instance of \BrowscapPHP\Cache\BrowscapCacheInterface or '
145
                . 'an instanceof of \WurflCache\Adapter\AdapterInterface',
146
                Exception::CACHE_INCOMPATIBLE
147
            );
148
        }
149
150
        return $this;
151
    }
152
153
    /**
154
     * Sets the parser instance to use

src/BrowscapUpdater.php 1 location

@@ 104-119 (lines=16) @@
101
     * @throws \BrowscapPHP\Exception
102
     * @return \BrowscapPHP\BrowscapUpdater
103
     */
104
    public function setCache($cache)
105
    {
106
        if ($cache instanceof BrowscapCacheInterface) {
107
            $this->cache = $cache;
108
        } elseif ($cache instanceof AdapterInterface) {
109
            $this->cache = new BrowscapCache($cache);
110
        } else {
111
            throw new Exception(
112
                'the cache has to be an instance of \BrowscapPHP\Cache\BrowscapCacheInterface or '
113
                . 'an instanceof of \WurflCache\Adapter\AdapterInterface',
114
                Exception::CACHE_INCOMPATIBLE
115
            );
116
        }
117
118
        return $this;
119
    }
120
121
    /**
122
     * Sets a logger instance