Completed
Push — master ( 782db2...a5ac1f )
by ReliQ
02:57 queued 10s
created

RemoteFileAssistant::fileExists()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReliqArts\DirectTranslator\Utility;
6
7
class RemoteFileAssistant
8
{
9
    /**
10
     * @param string $url
11
     *
12
     * @return bool
13
     */
14
    public function fileExists(string $url): bool
15
    {
16
        /** @noinspection PhpUsageOfSilenceOperatorInspection */
17
        $headers = @get_headers($url) ?: [''];
18
19
        return strpos(current($headers), '200') !== false;
20
    }
21
}
22