Code Duplication    Length = 16-16 lines in 2 locations

src/Browscap.php 1 location

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

src/BrowscapUpdater.php 1 location

@@ 118-133 (lines=16) @@
115
     * @throws \BrowscapPHP\Exception
116
     * @return \BrowscapPHP\BrowscapUpdater
117
     */
118
    public function setCache($cache)
119
    {
120
        if ($cache instanceof BrowscapCacheInterface) {
121
            $this->cache = $cache;
122
        } elseif ($cache instanceof AdapterInterface) {
123
            $this->cache = new BrowscapCache($cache);
124
        } else {
125
            throw new Exception(
126
                'the cache has to be an instance of \BrowscapPHP\Cache\BrowscapCacheInterface or '
127
                .'an instanceof of \WurflCache\Adapter\AdapterInterface',
128
                Exception::CACHE_INCOMPATIBLE
129
            );
130
        }
131
132
        return $this;
133
    }
134
135
    /**
136
     * Sets a logger instance