Code Duplication    Length = 5-5 lines in 2 locations

Alpha/View/Widget/Image.php 2 locations

@@ 236-240 (lines=5) @@
233
234
        if (!strpos($this->source, 'attachments/article_')) {
235
            // checking to see if we will write a jpg or png to the cache
236
            if ($this->sourceType->getValue() == 'png' && $config->get('cms.images.perserve.png')) {
237
                $this->filename = $config->get('app.file.store.dir').'cache/images/'.basename($this->source, '.'.$this->sourceType->getValue()).'_'.$this->width->getValue().'x'.$this->height->getValue().'.png';
238
            } else {
239
                $this->filename = $config->get('app.file.store.dir').'cache/images/'.basename($this->source, '.'.$this->sourceType->getValue()).'_'.$this->width->getValue().'x'.$this->height->getValue().'.jpg';
240
            }
241
        } else {
242
            // make a cache dir for the article
243
            $cacheDir = $config->get('app.file.store.dir').'cache/images/article_'.mb_substr($this->source, mb_strpos($this->source, 'attachments/article_') + 20, 11);
@@ 260-264 (lines=5) @@
257
            }
258
259
            // now set the filename to include the new cache directory
260
            if ($this->sourceType->getValue() == 'png' && $config->get('cms.images.perserve.png')) {
261
                $this->filename = $cacheDir.'/'.basename($this->source, '.'.$this->sourceType->getValue()).'_'.$this->width->getValue().'x'.$this->height->getValue().'.png';
262
            } else {
263
                $this->filename = $cacheDir.'/'.basename($this->source, '.'.$this->sourceType->getValue()).'_'.$this->width->getValue().'x'.$this->height->getValue().'.jpg';
264
            }
265
        }
266
267
        self::$logger->debug('Image filename is ['.$this->filename.']');