Completed
Push — master ( ed2425...d8adec )
by Daryl
01:55
created

Marker::make_options()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Clubdeuce\WPLib\Components\GoogleMaps;
4
5
/**
6
 * Class Marker
7
 * @package Clubdeuce\WPLib\Components\GoogleMaps
8
 *
9
 * @property Marker_Model $model
10
 * @property Marker_View  $view
11
 * @mixin    Marker_Model
12
 * @mixin    Marker_View
13
 * @method   string label()
14
 * @method   float  latitude()
15
 * @method   float  longitude()
16
 * @method   string title
17
 */
18
class Marker extends \WPLib_Item_Base {
19
20
    /**
21
     * @return array
22
     */
23
    function make_options() {
24
        return array(
25
            'label' => $this->label(),
26
            'position' => array( 'lat' => $this->latitude(), 'lng' => $this->longitude() ),
27
            'title' => $this->title()
0 ignored issues
show
Documentation Bug introduced by
The method title does not exist on object<Clubdeuce\WPLib\C...ents\GoogleMaps\Marker>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
28
        );
29
    }
30
}