StreamWrapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 21
ccs 7
cts 8
cp 0.875
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 11 2
1
<?php
2
/*
3
 * Copyright (C) 2017 by TEQneers GmbH & Co. KG
4
 *
5
 * Permission is hereby granted, free of charge, to any person obtaining a copy
6
 * of this software and associated documentation files (the "Software"), to deal
7
 * in the Software without restriction, including without limitation the rights
8
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
 * copies of the Software, and to permit persons to whom the Software is
10
 * furnished to do so, subject to the following conditions:
11
 *
12
 * The above copyright notice and this permission notice shall be included in
13
 * all copies or substantial portions of the Software.
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
 * THE SOFTWARE.
22
 */
23
24
/**
25
 * Git Stream Wrapper for PHP
26
 *
27
 * @category   TQ
28
 * @package    TQ_VCS
29
 * @subpackage SVN
30
 * @copyright  Copyright (C) 2018 by TEQneers GmbH & Co. KG
31
 */
32
33
namespace TQ\Svn\StreamWrapper;
34
use TQ\Svn\Cli\Binary;
35
use TQ\Svn\StreamWrapper\FileBuffer\Factory;
36
use TQ\Vcs\StreamWrapper\AbstractStreamWrapper;
37
use TQ\Vcs\StreamWrapper\PathFactoryInterface;
38
39
/**
40
 * The stream wrapper that hooks into PHP's stream infrastructure
41
 *
42
 * @author     Stefan Gehrig <gehrigteqneers.de>
43
 * @category   TQ
44
 * @package    TQ_VCS
45
 * @subpackage SVN
46
 * @copyright  Copyright (C) 2018 by TEQneers GmbH & Co. KG
47
 */
48
class StreamWrapper extends AbstractStreamWrapper
49
{
50
    /**
51
     * Registers the stream wrapper with the given protocol
52
     *
53
     * @param   string                                   $protocol    The protocol (such as "svn")
54
     * @param   Binary|string|null|PathFactoryInterface  $binary      The SVN binary or a path factory
55
     * @throws  \RuntimeException                                     If $protocol is already registered
56
     */
57 56
    public static function register($protocol, $binary = null)
58
    {
59 56
        $bufferFactory  = Factory::getDefault();
60 56
        if ($binary instanceof PathFactoryInterface) {
61
            $pathFactory  = $binary;
62
        } else {
63 56
            $binary         = Binary::ensure($binary);
64 56
            $pathFactory    = new PathFactory($protocol, $binary, null);
65
        }
66 56
        parent::doRegister($protocol, $pathFactory, $bufferFactory);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (doRegister() instead of register()). Are you sure this is correct? If so, you might want to change this to $this->doRegister().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
67 56
    }
68
}
69