CityNameFinder::find()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Indian City Finder
5
 *
6
 * (c) Nexuslink Services
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 IndianCityFinder;
13
14
use IndianCityFinder\src\Services\IndianCityProvider;
15
16
class CityNameFinder {    
17
18
    /**
19
     * @param string $stationCode
20
     * 
21
     * @return string
22
     */
23
    public function find($stationCode) {
24
        
25
        if(empty($stationCode)) {
26
            return "Please provide station code";
27
        }
28
        
29
        return IndianCityProvider::findByStationCode($stationCode);
0 ignored issues
show
Documentation introduced by
$stationCode is of type string, but the function expects a object<IndianCityFinder\src\Services\type>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
30
    }
31
    
32
}