Completed
Pull Request — master (#22)
by Daryl
07:43
created

component-google-maps.php (2 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace Clubdeuce\WPLib\Components;
3
4
use Clubdeuce\WPLib\Components\GoogleMaps\Map;
5
use Clubdeuce\WPLib\Components\GoogleMaps\Marker;
6
7
/**
8
 * Class Google_Maps
9
 * @package Clubdeuce\WPLib\Components
10
 *
11
 * @mixin \Clubdeuce\WPGoogleMaps\Google_Maps
12
 */
13
class Google_Maps extends \WPLib_Module_Base {
14
15
    const INSTANCE_CLASS = 'Clubdeuce\WPLib\Components\GoogleMaps\Map';
16
17
	/**
18
	 * @var string
19
	 */
20
	protected static $_version = '0.1.6';
21
22
	/**
23
	 *
24
	 */
25 1
    static function on_load() {
26
27 1
	    require_once 'vendor/autoload.php';
28 1
        self::register_helper( '\Clubdeuce\WPGoogleMaps\Google_Maps', __CLASS__ );
29 1
	    \Clubdeuce\WPGoogleMaps\Google_Maps::initialize();
30
31 1
    }
32
33
    /**
34
     * @param  array $args
35
     * @return Map
36
     */
37 1
    static function make_new_map( $args = array() ) {
38
39 1
        $class = static::INSTANCE_CLASS;
40 1
        return new $class( $args );
41
42
    }
43
44
	/**
45
	 * @param $address
46
	 * @param array $args
47
	 *
48
	 * @return Marker
49
	 */
50 1
    static function make_marker_by_address( $address, $args = array() ) {
51
52 1
    	$marker = \Clubdeuce\WPGoogleMaps\Google_Maps::make_marker_by_address( $address, $args );
53 1
    	return new Marker( array( 'marker' => $marker ), $args );
0 ignored issues
show
The call to Marker::__construct() has too many arguments starting with $args.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
54
55
    }
56
57
	/**
58
	 * @param float  $lat
59
	 * @param float  $lng
60
	 * @param array  $args
61
	 *
62
	 * @return Marker
63
	 */
64 1
	static function make_marker_by_position( $lat, $lng, $args = array() ) {
65
66 1
		$marker = \Clubdeuce\WPGoogleMaps\Google_Maps::make_marker_by_position( $lat, $lng, $args );
67 1
		return new Marker( array( 'marker' => $marker ), $args );
0 ignored issues
show
The call to Marker::__construct() has too many arguments starting with $args.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
68
69
	}
70
}
71
72
Google_Maps::on_load();
73