MappableDataObjectSet   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 28
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setMarkerTemplateValues() 0 4 1
A getRenderableMap() 0 9 3
1
<?php
2
3
/*
4
 * Provides a GoogleMap() function to DataObject objects.
5
 *
6
 * @author Uncle Cheese
7
 * @package mappable
8
 */
9
class MappableDataObjectSet extends Extension
10
{
11
    /**
12
     * Optional template values for the map info windows.
13
     */
14
    private $MarkerTemplateValues = null;
15
16
    /**
17
     * Pass through values to the markers so that when rendering the map info windows, these
18
     * parameters are available to the template.  This is of course optional.
19
     *
20
     * @param array $values hash array of template key to template value
21
     */
22 1
    public function setMarkerTemplateValues($values)
23
    {
24 1
        $this->MarkerTemplateValues = $values;
25 1
    }
26
27 3
    public function getRenderableMap($width = null, $height = null)
28
    {
29 3
        $gmap = MapUtil::get_map($this->owner, $this->MarkerTemplateValues);
0 ignored issues
show
Documentation introduced by
$this->owner is of type object<SS_Object>, but the function expects a object<SS_List>.

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 3
        $w = $width ? $width : MapUtil::$map_width;
31 3
        $h = $height ? $height : MapUtil::$map_height;
32 3
        $gmap->setSize($w, $h);
33
34 3
        return $gmap;
35
    }
36
}
37