GSCPDownloadTrait::download()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 0
crap 2
1
<?php
2
namespace GSCP;
3
4
trait GSCPDownloadTrait
5
{
6
    private $url = 'https://www.google.com/basepages/producttype/taxonomy-with-ids.%locale%.txt';
7
8 5
    private function download(): void
9
    {
10 5
        if (!file_exists($this->filename)) {
11 5
            $url = str_replace('%locale%', $this->getLocale(), $this->url);
0 ignored issues
show
Bug introduced by
It seems like getLocale() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

11
            $url = str_replace('%locale%', $this->/** @scrutinizer ignore-call */ getLocale(), $this->url);
Loading history...
12 4
            copy($url, $this->filename);
13
        }
14
    }
15
}