GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Heuristic   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A compute() 0 4 1
1
<?php
2
3
namespace Letournel\PathFinder\Core;
4
5
use Letournel\PathFinder\Distance;
6
7
class Heuristic
8
{
9
    private
10
        $distance,
0 ignored issues
show
Coding Style introduced by
It is generally advisable to only define one property per statement.

Only declaring a single property per statement allows you to later on add doc comments more easily.

It is also recommended by PSR2, so it is a common style that many people expect.

Loading history...
Coding Style introduced by
The visibility should be declared for property $distance.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
11
        $weight;
12
    
13
    public function __construct(Distance $distance, $weight = 1)
14
    {
15
        $this->distance = $distance;
16
        $this->weight = (float) $weight;
17
    }
18
    
19
    public function compute(Node $node, Node $target)
20
    {
21
        return $this->weight * $this->distance->compute($node, $target);
22
    }
23
}
24