Completed
Push — master ( 143878...f45699 )
by Taosikai
14:33
created

ChunkServerCollection   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A findByTunnelInfo() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of the slince/spike package.
5
 *
6
 * (c) Slince <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Spike\Server\ChunkServer;
13
14
use Doctrine\Common\Collections\ArrayCollection;
15
16
class ChunkServerCollection extends ArrayCollection
17
{
18
    /**
19
     * Finds the tunnel server by the tunnel information.
20
     *
21
     * @param array $tunnelInfo
22
     *
23
     * @return ChunkServerInterface
24
     */
25
    public function findByTunnelInfo($tunnelInfo)
26
    {
27
        return parent::filter(function(ChunkServerInterface $tunnelServer) use ($tunnelInfo){
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (filter() instead of findByTunnelInfo()). Are you sure this is correct? If so, you might want to change this to $this->filter().

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...
28
            return $tunnelServer->getTunnel()->match($tunnelInfo);
29
        })->first();
30
    }
31
}