@@ -90,7 +90,7 @@ |
||
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * @param $url |
|
| 93 | + * @param string $url |
|
| 94 | 94 | * @return array|\WP_Error |
| 95 | 95 | */ |
| 96 | 96 | private function _make_request( $url ) { |
@@ -117,7 +117,7 @@ |
||
| 117 | 117 | |
| 118 | 118 | $cache_key = md5( serialize( $url ) ); |
| 119 | 119 | |
| 120 | - if ( ! $data = wp_cache_get( $cache_key ) ) { |
|
| 120 | + if ( !$data = wp_cache_get( $cache_key ) ) { |
|
| 121 | 121 | $data = wp_remote_get( $url ); |
| 122 | 122 | wp_cache_add( $cache_key, $data, 300 ); |
| 123 | 123 | } |
@@ -6,6 +6,6 @@ |
||
| 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 |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | */ |
| 28 | 28 | public function setUp() { |
| 29 | - $this->_geocoder = new Geocoder(['api_key' => $this->_api_key]); |
|
| 29 | + $this->_geocoder = new Geocoder( ['api_key' => $this->_api_key] ); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -34,53 +34,53 @@ discard block |
||
| 34 | 34 | * @covers ::api_key |
| 35 | 35 | */ |
| 36 | 36 | public function testConstructorWithAPIKey() { |
| 37 | - $this->assertEquals($this->_api_key, $this->_geocoder->api_key()); |
|
| 37 | + $this->assertEquals( $this->_api_key, $this->_geocoder->api_key() ); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @covers ::_make_url |
| 42 | 42 | */ |
| 43 | 43 | public function testMakeUrl() { |
| 44 | - $response = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_url', '123 Anywhere Street New York 10001'); |
|
| 44 | + $response = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_url', '123 Anywhere Street New York 10001' ); |
|
| 45 | 45 | |
| 46 | - $this->assertInternalType('string', $response); |
|
| 47 | - $this->assertRegExp('/address\=123\+Anywhere\+Street\+New\+York\+10001/', $response); |
|
| 48 | - $this->assertRegExp("/key={$this->_api_key}/", $response); |
|
| 46 | + $this->assertInternalType( 'string', $response ); |
|
| 47 | + $this->assertRegExp( '/address\=123\+Anywhere\+Street\+New\+York\+10001/', $response ); |
|
| 48 | + $this->assertRegExp( "/key={$this->_api_key}/", $response ); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @covers ::_get_data |
| 53 | 53 | */ |
| 54 | 54 | public function testGetDataCache() { |
| 55 | - wp_cache_add( md5(serialize('foo.bar')), 'foobar'); |
|
| 55 | + wp_cache_add( md5( serialize( 'foo.bar' ) ), 'foobar' ); |
|
| 56 | 56 | |
| 57 | - $this->assertEquals('foobar', $this->reflectionMethodInvokeArgs($this->_geocoder, '_get_data', 'foo.bar')); |
|
| 57 | + $this->assertEquals( 'foobar', $this->reflectionMethodInvokeArgs( $this->_geocoder, '_get_data', 'foo.bar' ) ); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * @covers ::_make_location |
| 62 | 62 | */ |
| 63 | 63 | public function testMakeLocation() { |
| 64 | - $location = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_location', json_decode(file_get_contents(INCLUDES_DIR . '/geocoder-response.json'), true)); |
|
| 64 | + $location = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_location', json_decode( file_get_contents( INCLUDES_DIR.'/geocoder-response.json' ), true ) ); |
|
| 65 | 65 | |
| 66 | - $this->assertInstanceOf('\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location); |
|
| 67 | - $this->assertEquals('1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', $location->address()); |
|
| 68 | - $this->assertEquals('1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', $location->formatted_address()); |
|
| 69 | - $this->assertEquals(37.4224764, $location->latitude()); |
|
| 66 | + $this->assertInstanceOf( '\Clubdeuce\WPLib\Components\GoogleMaps\Location', $location ); |
|
| 67 | + $this->assertEquals( '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', $location->address() ); |
|
| 68 | + $this->assertEquals( '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA', $location->formatted_address() ); |
|
| 69 | + $this->assertEquals( 37.4224764, $location->latitude() ); |
|
| 70 | 70 | $this->assertEquals(-122.0842499, $location->longitude()); |
| 71 | - $this->assertEquals('ChIJ2eUgeAK6j4ARbn5u_wAGqWA', $location->place_id()); |
|
| 72 | - $this->assertInternalType('array', $location->viewport()); |
|
| 73 | - $this->assertArrayHasKey('northeast', $location->viewport()); |
|
| 74 | - $this->assertArrayHasKey('southwest', $location->viewport()); |
|
| 75 | - $this->assertInternalType('array', $location->viewport()['northeast']); |
|
| 76 | - $this->assertArrayHasKey('lat', $location->viewport()['northeast']); |
|
| 77 | - $this->assertArrayHasKey('lng', $location->viewport()['northeast']); |
|
| 78 | - $this->assertEquals(37.4238253802915, $location->viewport()['northeast']['lat']); |
|
| 71 | + $this->assertEquals( 'ChIJ2eUgeAK6j4ARbn5u_wAGqWA', $location->place_id() ); |
|
| 72 | + $this->assertInternalType( 'array', $location->viewport() ); |
|
| 73 | + $this->assertArrayHasKey( 'northeast', $location->viewport() ); |
|
| 74 | + $this->assertArrayHasKey( 'southwest', $location->viewport() ); |
|
| 75 | + $this->assertInternalType( 'array', $location->viewport()['northeast'] ); |
|
| 76 | + $this->assertArrayHasKey( 'lat', $location->viewport()['northeast'] ); |
|
| 77 | + $this->assertArrayHasKey( 'lng', $location->viewport()['northeast'] ); |
|
| 78 | + $this->assertEquals( 37.4238253802915, $location->viewport()['northeast']['lat'] ); |
|
| 79 | 79 | $this->assertEquals(-122.0829009197085, $location->viewport()['northeast']['lng']); |
| 80 | - $this->assertInternalType('array', $location->viewport()['southwest']); |
|
| 81 | - $this->assertArrayHasKey('lat', $location->viewport()['southwest']); |
|
| 82 | - $this->assertArrayHasKey('lng', $location->viewport()['southwest']); |
|
| 83 | - $this->assertEquals(37.4211274197085, $location->viewport()['southwest']['lat']); |
|
| 80 | + $this->assertInternalType( 'array', $location->viewport()['southwest'] ); |
|
| 81 | + $this->assertArrayHasKey( 'lat', $location->viewport()['southwest'] ); |
|
| 82 | + $this->assertArrayHasKey( 'lng', $location->viewport()['southwest'] ); |
|
| 83 | + $this->assertEquals( 37.4211274197085, $location->viewport()['southwest']['lat'] ); |
|
| 84 | 84 | $this->assertEquals(-122.0855988802915, $location->viewport()['southwest']['lng']); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | * @covers ::_make_request |
| 89 | 89 | */ |
| 90 | 90 | public function testMakeRequestInvalidURL() { |
| 91 | - $response = $this->reflectionMethodInvokeArgs($this->_geocoder, '_make_request', 'foo.bar'); |
|
| 92 | - $this->assertInstanceOf('WP_Error', $response); |
|
| 91 | + $response = $this->reflectionMethodInvokeArgs( $this->_geocoder, '_make_request', 'foo.bar' ); |
|
| 92 | + $this->assertInstanceOf( 'WP_Error', $response ); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | } |
| 96 | 96 | \ No newline at end of file |
@@ -18,7 +18,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
@@ -19,38 +19,38 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -1,29 +1,29 @@ |
||
| 1 | 1 | <?php |
| 2 | -define('VENDOR_DIRECTORY', dirname(__DIR__) . '/vendor'); |
|
| 3 | -define('INCLUDES_DIR', dirname(__FILE__) . '/includes'); |
|
| 2 | +define( 'VENDOR_DIRECTORY', dirname( __DIR__ ).'/vendor' ); |
|
| 3 | +define( 'INCLUDES_DIR', dirname( __FILE__ ).'/includes' ); |
|
| 4 | 4 | |
| 5 | -if (! file_exists( dirname(__DIR__) . '/build' ) ) { |
|
| 6 | - mkdir(dirname(__DIR__) . '/build'); |
|
| 5 | +if ( !file_exists( dirname( __DIR__ ).'/build' ) ) { |
|
| 6 | + mkdir( dirname( __DIR__ ).'/build' ); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -require_once getenv( 'WP_TESTS_DIR' ) . '/tests/phpunit/includes/functions.php'; |
|
| 10 | -require getenv( 'WP_TESTS_DIR' ) . '/tests/phpunit/includes/bootstrap.php'; |
|
| 9 | +require_once getenv( 'WP_TESTS_DIR' ).'/tests/phpunit/includes/functions.php'; |
|
| 10 | +require getenv( 'WP_TESTS_DIR' ).'/tests/phpunit/includes/bootstrap.php'; |
|
| 11 | 11 | |
| 12 | 12 | require 'includes/testCase.php'; |
| 13 | 13 | |
| 14 | -require VENDOR_DIRECTORY . '/autoload.php'; |
|
| 14 | +require VENDOR_DIRECTORY.'/autoload.php'; |
|
| 15 | 15 | |
| 16 | -if ( ! function_exists( 'wplib_define' ) ) { |
|
| 17 | - require( VENDOR_DIRECTORY . '/wplib/wplib/defines.php' ); |
|
| 16 | +if ( !function_exists( 'wplib_define' ) ) { |
|
| 17 | + require(VENDOR_DIRECTORY.'/wplib/wplib/defines.php'); |
|
| 18 | 18 | wplib_define( 'WPLib_Runmode', 'PRODUCTION' ); |
| 19 | 19 | wplib_define( 'WPLib_Stability', 'EXPERIMENTAL' ); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -require VENDOR_DIRECTORY . '/wplib/wplib/wplib.php'; |
|
| 22 | +require VENDOR_DIRECTORY.'/wplib/wplib/wplib.php'; |
|
| 23 | 23 | WPLib::initialize(); |
| 24 | 24 | |
| 25 | -require_once dirname(__DIR__) . '/includes/class-geocoder.php'; |
|
| 26 | -require_once dirname(__DIR__) . '/includes/class-location.php'; |
|
| 27 | -require_once dirname(__DIR__) . '/includes/class-location-model.php'; |
|
| 28 | -require_once dirname(__DIR__) . '/includes/class-location-view.php'; |
|
| 29 | -require_once dirname(__DIR__) . '/includes/class-marker-model.php'; |
|
| 25 | +require_once dirname( __DIR__ ).'/includes/class-geocoder.php'; |
|
| 26 | +require_once dirname( __DIR__ ).'/includes/class-location.php'; |
|
| 27 | +require_once dirname( __DIR__ ).'/includes/class-location-model.php'; |
|
| 28 | +require_once dirname( __DIR__ ).'/includes/class-location-view.php'; |
|
| 29 | +require_once dirname( __DIR__ ).'/includes/class-marker-model.php'; |
|
@@ -32,7 +32,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
@@ -54,7 +54,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -47,8 +47,8 @@ discard block |
||
| 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 |
||
| 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 | |