Skip to content

Commit 425e3a7

Browse files
committed
Fix inconsistencies
PHPDoc Tag names Documentation CS
1 parent 11c1e1c commit 425e3a7

File tree

11 files changed

+70
-52
lines changed

11 files changed

+70
-52
lines changed

DependencyInjection/BazingaGeocoderExtension.php

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,17 @@ public function load(array $configs, ContainerBuilder $container)
7272
if (isset($config['providers']['ip_info_db'])) {
7373
$ipInfoDbParams = $config['providers']['ip_info_db'];
7474

75-
$this->addProvider('ip_info_db', array($ipInfoDbParams['api_key']));
75+
$this->addProvider('ip_info_db', array(
76+
$ipInfoDbParams['api_key']
77+
));
7678
}
7779

7880
if (isset($config['providers']['cloudmade'])) {
7981
$cloudMadeParams = $config['providers']['cloudmade'];
8082

81-
$this->addProvider('cloudmade', array($cloudMadeParams['api_key']));
83+
$this->addProvider('cloudmade', array(
84+
$cloudMadeParams['api_key']
85+
));
8286
}
8387

8488
if (isset($config['providers']['google_maps'])) {
@@ -106,17 +110,21 @@ public function load(array $configs, ContainerBuilder $container)
106110
if (isset($config['providers']['openstreetmap'])) {
107111
$openstreetMapsParams = $config['providers']['openstreetmap'];
108112

109-
$this->addProvider('openstreetmap', array($openstreetMapsParams['locale']));
113+
$this->addProvider('openstreetmap', array(
114+
$openstreetMapsParams['locale']
115+
));
110116
}
111117

112118
if (isset($config['providers']['geoip'])) {
113119
$this->addProvider('geoip');
114120
}
115121

116122
if (isset($config['providers']['mapquest'])) {
117-
$mapquestParams = $config['providers']['mapquest'];
123+
$mapQuestParams = $config['providers']['mapquest'];
118124

119-
$this->addProvider('mapquest', array($mapquestParams['api_key']));
125+
$this->addProvider('mapquest', array(
126+
$mapQuestParams['api_key']
127+
));
120128
}
121129

122130
if (isset($config['providers']['oiorest'])) {
@@ -134,7 +142,9 @@ public function load(array $configs, ContainerBuilder $container)
134142
if (isset($config['providers']['ign_openls'])) {
135143
$ignOpenlsParams = $config['providers']['ign_openls'];
136144

137-
$this->addProvider('ign_openls', array($ignOpenlsParams['api_key']));
145+
$this->addProvider('ign_openls', array(
146+
$ignOpenlsParams['api_key']
147+
));
138148
}
139149

140150
if (isset($config['providers']['data_science_toolkit'])) {
@@ -144,11 +154,18 @@ public function load(array $configs, ContainerBuilder $container)
144154
if (isset($config['providers']['yandex'])) {
145155
$yandexParams = $config['providers']['yandex'];
146156

147-
$this->addProvider('yandex', array($yandexParams['locale'], $yandexParams['toponym']));
157+
$this->addProvider('yandex', array(
158+
$yandexParams['locale'],
159+
$yandexParams['toponym']
160+
));
148161
}
149162

150163
if (isset($config['providers']['geo_ips'])) {
151-
$this->addProvider('geo_ips', array($config['providers']['geo_ips']['api_key']));
164+
$geoIpsParams = $config['providers']['geo_ips'];
165+
166+
$this->addProvider('geo_ips', array(
167+
$geoIpsParams['api_key']
168+
));
152169
}
153170

154171
if (isset($config['providers']['geo_plugin'])) {
@@ -158,23 +175,27 @@ public function load(array $configs, ContainerBuilder $container)
158175
if (isset($config['providers']['maxmind'])) {
159176
$maxmindParams = $config['providers']['maxmind'];
160177

161-
$this->addProvider('maxmind', array($maxmindParams['api_key']));
178+
$this->addProvider('maxmind', array(
179+
$maxmindParams['api_key']
180+
));
162181
}
163182

164183
if (isset($config['providers']['maxmind_binary'])) {
184+
$maxmindBinaryParams = $config['providers']['maxmind_binary'];
185+
165186
$provider = new Definition(
166187
'%bazinga_geocoder.geocoder.provider.maxmind_binary.class%',
167188
array(
168-
$config['providers']['maxmind_binary']['binary_file'],
169-
$config['providers']['maxmind_binary']['open_flag'],
189+
$maxmindBinaryParams['binary_file'],
190+
$maxmindBinaryParams['open_flag'],
170191
)
171192
);
172193

173194
$provider
174195
->setPublic(false)
175196
->addTag('bazinga_geocoder.provider');
176197

177-
$this->container->setDefinition('bazinga_geocoder.provider.maxmind_binary', $provider);
198+
$container->setDefinition('bazinga_geocoder.provider.maxmind_binary', $provider);
178199
}
179200

180201
if (isset($config['providers']['cache'])) {
@@ -212,7 +233,9 @@ public function load(array $configs, ContainerBuilder $container)
212233
if (isset($config['providers']['chain']['providers'])) {
213234
foreach ($config['providers']['chain']['providers'] as $name) {
214235
if ($this->container->hasDefinition('bazinga_geocoder.provider.'.$name)) {
215-
$chainProvider->addMethodCall('addProvider', array($this->container->getDefinition('bazinga_geocoder.provider.'.$name)));
236+
$chainProvider->addMethodCall('addProvider', array(
237+
$this->container->getDefinition('bazinga_geocoder.provider.'.$name)
238+
));
216239
}
217240
}
218241
}

DependencyInjection/Compiler/AddDumperPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function process(ContainerBuilder $container)
3030
$manager = $container->findDefinition('bazinga_geocoder.dumper_manager');
3131

3232
$dumpers = array();
33-
foreach ($container->findTaggedServiceIds('geocoder.dumper') as $id => $attributes) {
33+
foreach ($container->findTaggedServiceIds('bazinga_geocoder.dumper') as $id => $attributes) {
3434
if (!isset($attributes[0]['alias'])) {
3535
throw new \RuntimeException(sprintf('No alias for service "%s" provided. Please set a alias!', $id));
3636
}

DependencyInjection/Compiler/AddProvidersPass.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,25 @@ class AddProvidersPass implements CompilerPassInterface
2525
protected $container;
2626

2727
/**
28-
* Get all providers based on their tag ('geocoder.provider') and register them.
28+
* Get all providers based on their tag (`bazinga_geocoder.provider`) and
29+
* register them.
2930
*
30-
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container.
31+
* @param ContainerBuilder $container
3132
*/
3233
public function process(ContainerBuilder $container)
3334
{
3435
if (!$container->hasDefinition('bazinga_geocoder.geocoder')) {
3536
return;
3637
}
3738

38-
$this->container = $container;
39-
4039
$array = array();
41-
foreach ($this->container->findTaggedServiceIds('bazinga_geocoder.provider') as $providerId => $attributes) {
40+
foreach ($container->findTaggedServiceIds('bazinga_geocoder.provider') as $providerId => $attributes) {
4241
$array[] = new Reference($providerId);
4342
}
4443

45-
$this->container
44+
$container
4645
->getDefinition('bazinga_geocoder.geocoder')
4746
->addMethodCall('registerProviders', array($array))
48-
;
47+
;
4948
}
5049
}

DependencyInjection/Compiler/LoggablePass.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ public function process(ContainerBuilder $container)
2929
}
3030

3131
$definition = $container->getDefinition('bazinga_geocoder.geocoder');
32-
$definition->setClass(
33-
$container->getParameter('bazinga_geocoder.geocoder.loggable_class')
34-
);
32+
$definition->setClass($container->getParameter('bazinga_geocoder.geocoder.loggable_class'));
3533
$definition->addMethodCall('setLogger', array(new Reference('bazinga_geocoder.logger')));
36-
3734
}
3835
}

Doctrine/ORM/GeocoderListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class GeocoderListener implements EventSubscriber
2020

2121
public function __construct(Geocoder $geocoder, DriverInterface $driver)
2222
{
23-
$this->driver = $driver;
23+
$this->driver = $driver;
2424
$this->geocoder = $geocoder;
2525
}
2626

@@ -69,8 +69,8 @@ public function onFlush(OnFlushEventArgs $args)
6969
private function geocodeEntity($entity)
7070
{
7171
$metadata = $this->driver->loadMetadataFromObject($entity);
72-
$address = $metadata->addressProperty->getValue($entity);
73-
$result = $this->geocoder->geocode($address);
72+
$address = $metadata->addressProperty->getValue($entity);
73+
$result = $this->geocoder->geocode($address);
7474

7575
$metadata->latitudeProperty->setValue($entity, $result['latitude']);
7676
$metadata->longitudeProperty->setValue($entity, $result['longitude']);

Geocoder/LoggableGeocoder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public function geocode($value)
3939
}
4040

4141
$startTime = microtime(true);
42-
$result = parent::geocode($value);
43-
$duration = (microtime(true) - $startTime) * 1000;
42+
$result = parent::geocode($value);
43+
$duration = (microtime(true) - $startTime) * 1000;
4444

4545
$this->logger->logRequest(
4646
sprintf("[Geocoding] %s", $value),
@@ -62,8 +62,8 @@ public function reverse($latitude, $longitude)
6262
}
6363

6464
$startTime = microtime(true);
65-
$result = parent::reverse($latitude, $longitude);
66-
$duration = (microtime(true) - $startTime) * 1000;
65+
$result = parent::reverse($latitude, $longitude);
66+
$duration = (microtime(true) - $startTime) * 1000;
6767

6868
$value = sprintf("[Reverse geocoding] latitude: %s, longitude: %s", $latitude, $longitude);
6969

Logger/GeocoderLogger.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
use Symfony\Component\HttpKernel\Log\LoggerInterface;
1414

1515
/**
16-
* GeocoderLogger
1716
* @author Michal Dabrowski <[email protected]>
1817
*/
1918
class GeocoderLogger
2019
{
2120
protected $logger;
22-
protected $nbRequests = 0;
21+
2322
protected $requests = array();
2423

2524
/**
@@ -40,18 +39,19 @@ public function __construct(LoggerInterface $logger = null)
4039
*/
4140
public function logRequest($value, $duration, $providerClass, $result)
4241
{
43-
++$this->nbRequests;
44-
4542
if (null !== $this->logger) {
4643
$this->requests[] = array(
47-
'value' => $value,
48-
'duration' => $duration,
44+
'value' => $value,
45+
'duration' => $duration,
4946
'providerClass' => $providerClass,
50-
'result' => $result
47+
'result' => $result
5148
);
5249

53-
$message = sprintf("%s %0.2f ms (%s)", $value, $duration, $providerClass);
54-
$this->logger->info($message);
50+
$this->logger->info(sprintf("%s %0.2f ms (%s)",
51+
$value,
52+
$duration,
53+
$providerClass
54+
));
5555
}
5656
}
5757

Resources/config/services.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,19 @@
5959
<argument type="collection" /><!-- Placeholder -->
6060
</service>
6161
<service id="bazinga_geocoder.dumper.geojson" class="%bazinga_geocoder.dumper.geojson.class%">
62-
<tag name="geocoder.dumper" alias="geojson" />
62+
<tag name="bazinga_geocoder.dumper" alias="geojson" />
6363
</service>
6464
<service id="bazinga_geocoder.dumper.gpx" class="%bazinga_geocoder.dumper.gpx.class%">
65-
<tag name="geocoder.dumper" alias="gpx" />
65+
<tag name="bazinga_geocoder.dumper" alias="gpx" />
6666
</service>
6767
<service id="bazinga_geocoder.dumper.kmp" class="%bazinga_geocoder.dumper.kmp.class%">
68-
<tag name="geocoder.dumper" alias="kmp" />
68+
<tag name="bazinga_geocoder.dumper" alias="kmp" />
6969
</service>
7070
<service id="bazinga_geocoder.dumper.wkb" class="%bazinga_geocoder.dumper.wkb.class%">
71-
<tag name="geocoder.dumper" alias="wkb" />
71+
<tag name="bazinga_geocoder.dumper" alias="wkb" />
7272
</service>
7373
<service id="bazinga_geocoder.dumper.wkt" class="%bazinga_geocoder.dumper.wkt.class%">
74-
<tag name="geocoder.dumper" alias="wkt" />
74+
<tag name="bazinga_geocoder.dumper" alias="wkt" />
7575
</service>
7676

7777
<!-- Logger -->

Resources/doc/index.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,14 @@ public function geocodeAction(Request $request)
165165
}
166166
```
167167

168-
To register a new dumper, you must tag it with _geocoder.dumper_.
169-
Geocoder detect and register it automatically.
168+
To register a new dumper, you must tag it with `bazinga_geocoder.dumper`.
169+
The bundles will automatically register it.
170170

171171
A little example:
172172

173173
```xml
174174
<service id="some.dumper" class="%some.dumper.class">
175-
<tag name="geocoder.dumper" alias="custom" />
175+
<tag name="bazinga_geocoder.dumper" alias="custom" />
176176
</service>
177177
```
178178

@@ -182,8 +182,6 @@ Sometimes you have to cache the results from a provider. For this case the bundl
182182
a cache provider. The cache provider wraps another provider and delegate all calls
183183
to this provider and cache the return value.
184184

185-
__Configuration example:__
186-
187185
```yaml
188186
# app/config/config*.yml
189187
services:

Tests/DependencyInjection/BazingaGeocoderExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function testLoad()
4141
);
4242

4343
$dumperManager = $container->get('bazinga_geocoder.dumper_manager');
44+
4445
foreach (array('geojson', 'gpx', 'kmp', 'wkb', 'wkt') as $name) {
4546
$this->assertTrue($dumperManager->has($name));
4647
}

0 commit comments

Comments
 (0)