Completed
Push — master ( 14dabf...9ebc80 )
by Daryl
01:59
created
includes/class-marker-view.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,6 +6,6 @@
 block discarded – undo
6 6
  * Class Marker_View
7 7
  * @package Clubdeuce\WPLib\Components\GoogleMaps
8 8
  */
9
-class Marker_View extends \WPLib_View_Base  {
9
+class Marker_View extends \WPLib_View_Base {
10 10
 
11 11
 }
12 12
\ No newline at end of file
Please login to merge, or discard this patch.
tests/unit/testLocationModel.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     private $_location;
19 19
 
20 20
     public function setUp() {
21
-        $this->_location = new Location_Model([
21
+        $this->_location = new Location_Model( [
22 22
             'address'           => '1600 Amphitheatre Parkway Mountain View CA',
23 23
             'formatted_address' => '1600 Amphitheatre Parkway, Mountain View, CA, 12345',
24 24
             'latitude'          => 100.12345,
@@ -32,21 +32,21 @@  discard block
 block discarded – undo
32 32
      * @covers ::__call
33 33
      */
34 34
     public function testAddress() {
35
-        $this->assertEquals('1600 Amphitheatre Parkway Mountain View CA', $this->_location->address());
35
+        $this->assertEquals( '1600 Amphitheatre Parkway Mountain View CA', $this->_location->address() );
36 36
     }
37 37
 
38 38
     /**
39 39
      * @covers ::__call
40 40
      */
41 41
     public function testFormattedAddress() {
42
-        $this->assertEquals('1600 Amphitheatre Parkway, Mountain View, CA, 12345', $this->_location->formatted_address());
42
+        $this->assertEquals( '1600 Amphitheatre Parkway, Mountain View, CA, 12345', $this->_location->formatted_address() );
43 43
     }
44 44
 
45 45
     /**
46 46
      * @covers ::__call
47 47
      */
48 48
     public function testLatitude() {
49
-        $this->assertEquals(100.12345, $this->_location->latitude());
49
+        $this->assertEquals( 100.12345, $this->_location->latitude() );
50 50
     }
51 51
 
52 52
     /**
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
      * @covers ::__call()
61 61
      */
62 62
     public function testPlaceId() {
63
-        $this->assertEquals('foobar', $this->_location->place_id());
63
+        $this->assertEquals( 'foobar', $this->_location->place_id() );
64 64
     }
65 65
 
66 66
     /**
67 67
      * @covers ::__call()
68 68
      */
69 69
     public function testViewport() {
70
-        $this->assertEquals(['foo', 'bar'], $this->_location->viewport());
70
+        $this->assertEquals( ['foo', 'bar'], $this->_location->viewport() );
71 71
     }
72 72
 }
73 73
\ No newline at end of file
Please login to merge, or discard this patch.
tests/integration/testGeocoder.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -19,38 +19,38 @@  discard block
 block discarded – undo
19 19
     private $_geocoder;
20 20
 
21 21
     public function setUp() {
22
-        $this->_geocoder = new Geocoder(['api_key' => '']);
22
+        $this->_geocoder = new Geocoder( ['api_key' => ''] );
23 23
     }
24 24
 
25 25
     /**
26 26
      * @covers ::_make_request
27 27
      */
28 28
     public function testMakeRequest() {
29
-        $url      = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_url', '1600 Amphitheatre Parkway, Mountain View, CA');
30
-        $response = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_request', $url);
29
+        $url      = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_url', '1600 Amphitheatre Parkway, Mountain View, CA' );
30
+        $response = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_request', $url );
31 31
 
32
-        $this->assertInternalType('array', $response);
32
+        $this->assertInternalType( 'array', $response );
33 33
     }
34 34
 
35 35
     /**
36 36
      * @covers ::_make_request
37 37
      */
38 38
     public function testMakeRequestError404() {
39
-        $response = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_request', 'https://maps.googleapis.com/maps/api/geo');
39
+        $response = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_request', 'https://maps.googleapis.com/maps/api/geo' );
40 40
 
41
-        $this->assertInstanceOf('WP_Error', $response);
42
-        $this->assertObjectHasAttribute('errors', $response);
43
-        $this->assertArrayHasKey('404', $response->errors);
41
+        $this->assertInstanceOf( 'WP_Error', $response );
42
+        $this->assertObjectHasAttribute( 'errors', $response );
43
+        $this->assertArrayHasKey( '404', $response->errors );
44 44
     }
45 45
 
46 46
     /**
47 47
      * @covers ::_get_data
48 48
      */
49 49
     public function testGetData() {
50
-        $url      = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_url', '1600 Amphitheatre Parkway, Mountain View, CA');
51
-        $response = $this->reflectionMethodInvokeArgs($this->_geocoder, '_get_data', $url);
50
+        $url      = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_url', '1600 Amphitheatre Parkway, Mountain View, CA' );
51
+        $response = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_get_data', $url );
52 52
 
53
-        $this->assertInternalType('array', $response);
53
+        $this->assertInternalType( 'array', $response );
54 54
     }
55 55
 
56 56
     /**
@@ -58,26 +58,26 @@  discard block
 block discarded – undo
58 58
      * @covers ::_make_location
59 59
      */
60 60
     public function testGeocode() {
61
-        $location = $this->_geocoder->geocode('1600 Amphitheatre Parkway, Mountain View, CA');
61
+        $location = $this->_geocoder->geocode( '1600 Amphitheatre Parkway, Mountain View, CA' );
62 62
 
63
-        $this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location);
64
-        $this->assertEquals('1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA', $location->address());
65
-        $this->assertEquals('1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA', $location->formatted_address());
66
-        $this->assertEquals(37.422366400000001, $location->latitude());
63
+        $this->assertInstanceOf( '\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location );
64
+        $this->assertEquals( '1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA', $location->address() );
65
+        $this->assertEquals( '1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA', $location->formatted_address() );
66
+        $this->assertEquals( 37.422366400000001, $location->latitude() );
67 67
         $this->assertEquals(-122.084406, $location->longitude());
68
-        $this->assertEquals('ChIJ2eUgeAK6j4ARbn5u_wAGqWA', $location->place_id());
69
-        $this->assertInternalType('array', $location->viewport());
70
-        $this->assertArrayHasKey('northeast', $location->viewport());
71
-        $this->assertArrayHasKey('southwest', $location->viewport());
72
-        $this->assertInternalType('array', $location->viewport()['northeast']);
73
-        $this->assertArrayHasKey('lat', $location->viewport()['northeast']);
74
-        $this->assertArrayHasKey('lng', $location->viewport()['northeast']);
75
-        $this->assertEquals(37.423715380291497, $location->viewport()['northeast']['lat']);
68
+        $this->assertEquals( 'ChIJ2eUgeAK6j4ARbn5u_wAGqWA', $location->place_id() );
69
+        $this->assertInternalType( 'array', $location->viewport() );
70
+        $this->assertArrayHasKey( 'northeast', $location->viewport() );
71
+        $this->assertArrayHasKey( 'southwest', $location->viewport() );
72
+        $this->assertInternalType( 'array', $location->viewport()['northeast'] );
73
+        $this->assertArrayHasKey( 'lat', $location->viewport()['northeast'] );
74
+        $this->assertArrayHasKey( 'lng', $location->viewport()['northeast'] );
75
+        $this->assertEquals( 37.423715380291497, $location->viewport()['northeast']['lat'] );
76 76
         $this->assertEquals(-122.08305701970851, $location->viewport()['northeast']['lng']);
77
-        $this->assertInternalType('array', $location->viewport()['southwest']);
78
-        $this->assertArrayHasKey('lat', $location->viewport()['southwest']);
79
-        $this->assertArrayHasKey('lng', $location->viewport()['southwest']);
80
-        $this->assertEquals(37.421017419708512, $location->viewport()['southwest']['lat']);
77
+        $this->assertInternalType( 'array', $location->viewport()['southwest'] );
78
+        $this->assertArrayHasKey( 'lat', $location->viewport()['southwest'] );
79
+        $this->assertArrayHasKey( 'lng', $location->viewport()['southwest'] );
80
+        $this->assertEquals( 37.421017419708512, $location->viewport()['southwest']['lat'] );
81 81
         $this->assertEquals(-122.0857549802915, $location->viewport()['southwest']['lng']);
82 82
     }
83 83
 }
Please login to merge, or discard this patch.
tests/unit/testMarkerModel.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 
34 34
     public function setUp() {
35
-        $this->_location = new Location([
35
+        $this->_location = new Location( [
36 36
             'address'           => '123 Anywhere Street Anywhere NY',
37 37
             'formatted_address' => '123 Anywhere Street, Anywhere, NY 12345 USA',
38 38
             'latitude'          => 100.12345,
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
             'place_id'          => 'foobar',
41 41
             'types'             => ['foo', 'bar'],
42 42
             'viewport'          => ['northeast' => ['lat' => 100.12346, 'lng' => -100.12344], 'southwest' => ['lat' => 100.12344, 'lng' => -100.12346]],
43
-        ]);
43
+        ] );
44 44
 
45
-        $this->_geocoder = \Mockery::mock('\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder');
46
-        $this->_geocoder->shouldReceive('geocode')->andReturn($this->_location);
45
+        $this->_geocoder = \Mockery::mock( '\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder' );
46
+        $this->_geocoder->shouldReceive( 'geocode' )->andReturn( $this->_location );
47 47
 
48
-        $this->_model = new Marker_Model([
48
+        $this->_model = new Marker_Model( [
49 49
             'address'  => $this->_address,
50 50
             'geocoder' => $this->_geocoder,
51
-        ]);
51
+        ] );
52 52
     }
53 53
 
54 54
 
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
      * @covers ::latitude
57 57
      */
58 58
     public function testLatitude() {
59
-        $this->assertEquals(100.12345, $this->_model->latitude());
59
+        $this->assertEquals( 100.12345, $this->_model->latitude() );
60 60
     }
61 61
 
62 62
     /**
63 63
      * @covers ::location
64 64
      */
65 65
     public function testLocation() {
66
-        $this->assertEquals($this->_location, $this->_model->location());
66
+        $this->assertEquals( $this->_location, $this->_model->location() );
67 67
     }
68 68
 
69 69
     /**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @covers ::_geocoder
78 78
      */
79 79
     public function testGeocoder() {
80
-        $this->assertEquals($this->_geocoder, $this->reflectionMethodInvoke($this->_model, '_geocoder'));
80
+        $this->assertEquals( $this->_geocoder, $this->reflectionMethodInvoke( $this->_model, '_geocoder' ) );
81 81
     }
82 82
 
83 83
     /**
@@ -85,6 +85,6 @@  discard block
 block discarded – undo
85 85
      */
86 86
     public function testCreateGeocoder() {
87 87
         $marker_model = new Marker_Model();
88
-        $this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder',  $this->reflectionMethodInvoke($marker_model, '_geocoder'));
88
+        $this->assertInstanceOf( '\Clubdeuce\WPLib\Components\GoogleMaps\Geocoder', $this->reflectionMethodInvoke( $marker_model, '_geocoder' ) );
89 89
     }
90 90
 }
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-marker-model.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      * @return Location
55 55
      */
56 56
     function location() {
57
-        if ( ! is_object( $this->_location ) ) {
57
+        if ( !is_object( $this->_location ) ) {
58 58
             $this->_location = $this->_geocoder()->geocode( $this->_address );
59 59
         }
60 60
         return $this->_location;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      * @return Geocoder
79 79
      */
80 80
     private function _geocoder() {
81
-        if (! is_object( $this->_geocoder ) ) {
81
+        if ( !is_object( $this->_geocoder ) ) {
82 82
             $this->_geocoder = new Geocoder();
83 83
         }
84 84
 
Please login to merge, or discard this patch.
component-google-maps.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
      */
48 48
     static function geocoder() {
49 49
 
50
-        if ( ! isset( static::$_geocoder ) ) {
51
-            static::$_geocoder = new Geocoder( ['api_key' => self::api_key() ] );
50
+        if ( !isset(static::$_geocoder) ) {
51
+            static::$_geocoder = new Geocoder( ['api_key' => self::api_key()] );
52 52
         }
53 53
 
54 54
         return static::$_geocoder;
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 
89 89
         $key = static::api_key();
90 90
 
91
-        wp_register_script('google-maps', "https://maps.google.com/maps/api/js?key={$key}", false, '3.0', true );
92
-        wp_register_script('map-control', home_url( '/vendor/clubdeuce/wplib-olm-google-maps/assets/maps.js' ), array( 'jquery', 'google-maps' ), '0.1', true );
91
+        wp_register_script( 'google-maps', "https://maps.google.com/maps/api/js?key={$key}", false, '3.0', true );
92
+        wp_register_script( 'map-control', home_url( '/vendor/clubdeuce/wplib-olm-google-maps/assets/maps.js' ), array( 'jquery', 'google-maps' ), '0.1', true );
93 93
 
94
-        array_walk(static::$_script_conditions, function( $function ) {
94
+        array_walk( static::$_script_conditions, function( $function ) {
95 95
             return is_callable( $function ) ? call_user_func( $function ) : $function;
96 96
         } );
97 97
 
Please login to merge, or discard this patch.
includes/class-map.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     function make_args() {
24 24
         return array(
25 25
             'center' => $this->center(),
26
-            'zoom'   => (int)$this->zoom(),
26
+            'zoom'   => ( int ) $this->zoom(),
27 27
         );
28 28
     }
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-geocoder.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,6 @@  discard block
 block discarded – undo
73 73
     /**
74 74
      * Convert the response body into an a Location object
75 75
      *
76
-     * @param  array $response
77 76
      * @return Location
78 77
      */
79 78
     private function _make_location( $results ) {
@@ -95,7 +94,7 @@  discard block
 block discarded – undo
95 94
 
96 95
 
97 96
     /**
98
-     * @param $url
97
+     * @param string $url
99 98
      * @return array|\WP_Error
100 99
      */
101 100
     private function _make_request( $url ) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
      */
44 44
     function geocode( $address ) {
45 45
 
46
-        $location = new \WP_Error(100, 'No results found', array( 'address' => $address ) );
46
+        $location = new \WP_Error( 100, 'No results found', array( 'address' => $address ) );
47 47
         $url = $this->_make_url( $address );
48 48
 
49 49
         $response = $this->_make_request( $url );
50 50
 
51
-        if ( ! is_wp_error( $response ) && count( $response['results'] ) > 0 ) {
51
+        if ( !is_wp_error( $response ) && count( $response['results'] ) > 0 ) {
52 52
             $location = $this->_make_location( $response['results'][0] );
53 53
         }
54 54
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $response = new Location( array(
82 82
             'address'           => $results['formatted_address'],
83 83
             'formatted_address' => $results['formatted_address'],
84
-            'state'             => isset( $results['address_components'][4] ) ? $results['address_components'][4]['short_name'] : '',
84
+            'state'             => isset($results['address_components'][4]) ? $results['address_components'][4]['short_name'] : '',
85 85
             'latitude'          => $results['geometry']['location']['lat'],
86 86
             'longitude'         => $results['geometry']['location']['lng'],
87 87
             'place_id'          => $results['place_id'],
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
         $cache_key = md5( serialize( $url ) );
127 127
 
128
-        if ( ! $data = wp_cache_get( $cache_key ) ) {
128
+        if ( !$data = wp_cache_get( $cache_key ) ) {
129 129
             $data = wp_remote_get( $url );
130 130
             wp_cache_add( $cache_key, $data, 300 );
131 131
         }
Please login to merge, or discard this patch.
templates/map-view.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 <script type="application/javascript">
13 13
     jQuery(document).ready(function() {
14 14
         generate_map(
15
-            "<?php echo esc_js($map_id); ?>",
16
-            <?php echo json_encode($map_params); ?>,
17
-            <?php echo json_encode($markers); ?>,
18
-            <?php echo json_encode($info_windows); ?>
15
+            "<?php echo esc_js( $map_id ); ?>",
16
+            <?php echo json_encode( $map_params ); ?>,
17
+            <?php echo json_encode( $markers ); ?>,
18
+            <?php echo json_encode( $info_windows ); ?>
19 19
         );
20 20
     });
21 21
 </script>
Please login to merge, or discard this patch.