Code Duplication    Length = 14-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

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