Completed
Push — master ( 898e77...f00d09 )
by Daryl
04:31
created
tests/unit/testGeocoder.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      *
28 28
      */
29 29
     public function setUp() {
30
-        $this->_geocoder = new Geocoder(['api_key' => $this->_api_key]);
30
+        $this->_geocoder = new Geocoder( ['api_key' => $this->_api_key] );
31 31
     }
32 32
 
33 33
     /**
@@ -35,53 +35,53 @@  discard block
 block discarded – undo
35 35
      * @covers ::api_key
36 36
      */
37 37
     public function testConstructorWithAPIKey() {
38
-        $this->assertEquals($this->_api_key, $this->_geocoder->api_key());
38
+        $this->assertEquals( $this->_api_key, $this->_geocoder->api_key() );
39 39
     }
40 40
 
41 41
     /**
42 42
      * @covers ::_make_url
43 43
      */
44 44
     public function testMakeUrl() {
45
-        $response = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_url', '123 Anywhere Street New York 10001');
45
+        $response = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_url', '123 Anywhere Street New York 10001' );
46 46
 
47
-        $this->assertInternalType('string', $response);
48
-        $this->assertRegExp('/address\=123\+Anywhere\+Street\+New\+York\+10001/', $response);
49
-        $this->assertRegExp("/key={$this->_api_key}/", $response);
47
+        $this->assertInternalType( 'string', $response );
48
+        $this->assertRegExp( '/address\=123\+Anywhere\+Street\+New\+York\+10001/', $response );
49
+        $this->assertRegExp( "/key={$this->_api_key}/", $response );
50 50
     }
51 51
 
52 52
     /**
53 53
      * @covers ::_get_data
54 54
      */
55 55
     public function testGetDataCache() {
56
-        wp_cache_add( md5(serialize('foo.bar')), 'foobar');
56
+        wp_cache_add( md5( serialize( 'foo.bar' ) ), 'foobar' );
57 57
 
58
-        $this->assertEquals('foobar', $this->reflectionMethodInvokeArgs($this->_geocoder, '_get_data', 'foo.bar'));
58
+        $this->assertEquals( 'foobar', $this->reflectionMethodInvokeArgs( $this->_geocoder, '_get_data', 'foo.bar' ) );
59 59
     }
60 60
 
61 61
     /**
62 62
      * @covers ::_make_location
63 63
      */
64 64
     public function testMakeLocation() {
65
-        $location = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_location', json_decode(file_get_contents(TEST_INCLUDES_DIR . '/geocoder-response.json'), true));
65
+        $location = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_location', json_decode( file_get_contents( TEST_INCLUDES_DIR.'/geocoder-response.json' ), true ) );
66 66
 
67
-        $this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location);
68
-        $this->assertEquals('1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', $location->address());
69
-        $this->assertEquals('1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', $location->formatted_address());
70
-        $this->assertEquals(37.4224764, $location->latitude());
67
+        $this->assertInstanceOf( '\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location );
68
+        $this->assertEquals( '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', $location->address() );
69
+        $this->assertEquals( '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', $location->formatted_address() );
70
+        $this->assertEquals( 37.4224764, $location->latitude() );
71 71
         $this->assertEquals(-122.0842499, $location->longitude());
72
-        $this->assertEquals('ChIJ2eUgeAK6j4ARbn5u_wAGqWA', $location->place_id());
73
-        $this->assertInternalType('array', $location->viewport());
74
-        $this->assertArrayHasKey('northeast', $location->viewport());
75
-        $this->assertArrayHasKey('southwest', $location->viewport());
76
-        $this->assertInternalType('array', $location->viewport()['northeast']);
77
-        $this->assertArrayHasKey('lat', $location->viewport()['northeast']);
78
-        $this->assertArrayHasKey('lng', $location->viewport()['northeast']);
79
-        $this->assertEquals(37.4238253802915, $location->viewport()['northeast']['lat']);
72
+        $this->assertEquals( 'ChIJ2eUgeAK6j4ARbn5u_wAGqWA', $location->place_id() );
73
+        $this->assertInternalType( 'array', $location->viewport() );
74
+        $this->assertArrayHasKey( 'northeast', $location->viewport() );
75
+        $this->assertArrayHasKey( 'southwest', $location->viewport() );
76
+        $this->assertInternalType( 'array', $location->viewport()['northeast'] );
77
+        $this->assertArrayHasKey( 'lat', $location->viewport()['northeast'] );
78
+        $this->assertArrayHasKey( 'lng', $location->viewport()['northeast'] );
79
+        $this->assertEquals( 37.4238253802915, $location->viewport()['northeast']['lat'] );
80 80
         $this->assertEquals(-122.0829009197085, $location->viewport()['northeast']['lng']);
81
-        $this->assertInternalType('array', $location->viewport()['southwest']);
82
-        $this->assertArrayHasKey('lat', $location->viewport()['southwest']);
83
-        $this->assertArrayHasKey('lng', $location->viewport()['southwest']);
84
-        $this->assertEquals(37.4211274197085, $location->viewport()['southwest']['lat']);
81
+        $this->assertInternalType( 'array', $location->viewport()['southwest'] );
82
+        $this->assertArrayHasKey( 'lat', $location->viewport()['southwest'] );
83
+        $this->assertArrayHasKey( 'lng', $location->viewport()['southwest'] );
84
+        $this->assertEquals( 37.4211274197085, $location->viewport()['southwest']['lat'] );
85 85
         $this->assertEquals(-122.0855988802915, $location->viewport()['southwest']['lng']);
86 86
     }
87 87
 
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
      * @covers ::_make_request
90 90
      */
91 91
     public function testMakeRequestInvalidURL() {
92
-        $response = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_request', 'foo.bar');
93
-        $this->assertInstanceOf('WP_Error', $response);
92
+        $response = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_request', 'foo.bar' );
93
+        $this->assertInstanceOf( 'WP_Error', $response );
94 94
     }
95 95
 
96 96
 }
97 97
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-map-model.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
      */
84 84
     function html_id() {
85 85
 
86
-        if ( ! isset( $this->_html_id ) ) {
86
+        if ( !isset($this->_html_id) ) {
87 87
             $this->_html_id = sprintf( 'map-%1$s', md5( serialize( array( $this->center(), $this->markers() ) ) ) );
88 88
         }
89 89
 
Please login to merge, or discard this patch.
includes/class-map-view.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         $markers      = $this->_make_markers_args();
19 19
         $info_windows = $this->_make_info_windows();
20 20
 
21
-        require dirname( __DIR__) . '/templates/map-view.php';
21
+        require dirname( __DIR__ ).'/templates/map-view.php';
22 22
 
23 23
     }
24 24
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         /**
47 47
          * @var Marker $marker
48 48
          */
49
-        foreach( $this->item->markers() as $marker ) {
49
+        foreach ( $this->item->markers() as $marker ) {
50 50
             $windows[] = array(
51 51
                 'content'      => $marker->info_window()->content(),
52 52
                 'pixel_offset' => $marker->info_window()->pixel_offset(),
Please login to merge, or discard this patch.
component-google-maps.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
      */
49 49
     static function geocoder() {
50 50
 
51
-        if ( ! isset( static::$_geocoder ) ) {
52
-            static::$_geocoder = new Geocoder( ['api_key' => self::api_key() ] );
51
+        if ( !isset(static::$_geocoder) ) {
52
+            static::$_geocoder = new Geocoder( ['api_key' => self::api_key()] );
53 53
         }
54 54
 
55 55
         return static::$_geocoder;
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
             $source = home_url( '/vendor/clubdeuce/wplib-olm-google-maps/assets/maps.js' );
95 95
         }
96 96
 
97
-        wp_register_script('google-maps', "https://maps.google.com/maps/api/js?v=3&key={$key}", false, '3.0', true );
98
-        wp_register_script('map-control', $source, array( 'jquery', 'google-maps' ), '0.1.2', true );
97
+        wp_register_script( 'google-maps', "https://maps.google.com/maps/api/js?v=3&key={$key}", false, '3.0', true );
98
+        wp_register_script( 'map-control', $source, array( 'jquery', 'google-maps' ), '0.1.2', true );
99 99
 
100
-        array_walk(static::$_script_conditions, function( $function ) {
100
+        array_walk( static::$_script_conditions, function( $function ) {
101 101
             return is_callable( $function ) ? call_user_func( $function ) : $function;
102 102
         } );
103 103
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      * @param  array  $args
128 128
      * @return string
129 129
      */
130
-    static function driving_directions_href($destination, $args = array() ) {
130
+    static function driving_directions_href( $destination, $args = array() ) {
131 131
 
132 132
         $args = wp_parse_args( $args, array(
133 133
             'start' => 'My Location',
Please login to merge, or discard this patch.
includes/class-marker-label-model.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
         ];
102 102
 
103 103
         $args = array_filter( $args, function( $value ) {
104
-            return ! is_null( $value );
104
+            return !is_null( $value );
105 105
         } );
106 106
 
107 107
         return $args;
Please login to merge, or discard this patch.
includes/class-marker-model.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     function latitude() {
84 84
         $latitude = 0;
85
-        if ( ! is_wp_error( $this->location() ) ) {
85
+        if ( !is_wp_error( $this->location() ) ) {
86 86
             $latitude = $this->location()->latitude();
87 87
         }
88 88
         return $latitude;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @return Location
93 93
      */
94 94
     function location() {
95
-        if ( ! is_object( $this->_location ) ) {
95
+        if ( !is_object( $this->_location ) ) {
96 96
             $this->_location = $this->_geocoder()->geocode( $this->_address );
97 97
         }
98 98
         return $this->_location;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     function longitude() {
105 105
         $longitude = 0;
106
-        if ( ! is_wp_error( $this->location() ) ) {
106
+        if ( !is_wp_error( $this->location() ) ) {
107 107
             $longitude = $this->location()->longitude();
108 108
         }
109 109
         return $longitude;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      * @return Geocoder
150 150
      */
151 151
     private function _geocoder() {
152
-        if (! is_object( $this->_geocoder ) ) {
152
+        if ( !is_object( $this->_geocoder ) ) {
153 153
             $this->_geocoder = new Geocoder();
154 154
         }
155 155
 
Please login to merge, or discard this patch.