FileHash::getInfo()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
/**
3
 * Mage Scan
4
 *
5
 * PHP version 5
6
 *
7
 * @category  MageScan
8
 * @package   MageScan
9
 * @author    Steve Robbins <[email protected]>
10
 * @copyright 2015 Steve Robbins
11
 * @license   http://creativecommons.org/licenses/by/4.0/ CC BY 4.0
12
 * @link      https://github.com/steverobbins/magescan
13
 */
14
15
namespace MageScan\Check\Version;
16
17
use MageScan\Check\AbstractCheck;
18
use MageScan\Check\Version;
19
use Mvi\Check;
20
21
/**
22
 * Scan for Magento edition and version via file md5 hash
23
 *
24
 * @category  MageScan
25
 * @package   MageScan
26
 * @author    Steve Robbins <[email protected]>
27
 * @copyright 2015 Steve Robbins
28
 * @license   http://creativecommons.org/licenses/by/4.0/ CC BY 4.0
29
 * @link      https://github.com/steverobbins/magescan
30
 */
31
class FileHash extends AbstractCheck
32
{
33
    /**
34
     * Guess magento edition and version
35
     *
36
     * @return array|boolean
37
     */
38
    public function getInfo()
39
    {
40
        $checker = new Check($this->getRequest()->getUrl());
0 ignored issues
show
Bug introduced by
It seems like $this->getRequest()->getUrl() targeting MageScan\Request::getUrl() can also be of type boolean; however, Mvi\Check::__construct() does only seem to accept string|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
41
        $info    = $checker->getInfo();
42
        if ($info === false) {
43
            return false;
44
        }
45
        $edition  = key($info);
46
        $versions = $info[$edition];
47
        return [$edition, implode(', ', $versions)];
48
    }
49
}
50