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