Code Duplication    Length = 16-16 lines in 2 locations

src/Browscap.php 1 location

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

src/BrowscapUpdater.php 1 location

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