Skip to content

Commit ba7c551

Browse files
committed
Apply coding style fixes
1 parent 7dcfd93 commit ba7c551

25 files changed

+146
-106
lines changed

.php-cs-fixer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
],
6161
],
6262
'modernize_types_casting' => true,
63-
'mb_str_functions' => true,
6463
'no_alias_functions' => true,
6564
'no_binary_string' => true,
6665
'no_empty_comment' => true,

config/geoip.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
return [
46

57
/*
@@ -82,14 +84,14 @@
8284
],
8385

8486
'ipdata' => [
85-
'class' => \InteractionDesignFoundation\GeoIP\Services\IPData::class,
86-
'key' => env('IPDATA_API_KEY'),
87+
'class' => \InteractionDesignFoundation\GeoIP\Services\IPData::class,
88+
'key' => env('IPDATA_API_KEY'),
8789
'secure' => true,
8890
],
8991

9092
'ipfinder' => [
91-
'class' => \InteractionDesignFoundation\GeoIP\Services\IPFinder::class,
92-
'key' => env('IPFINDER_API_KEY'),
93+
'class' => \InteractionDesignFoundation\GeoIP\Services\IPFinder::class,
94+
'key' => env('IPFINDER_API_KEY'),
9395
'secure' => true,
9496
'locales' => ['en'],
9597
],

src/Cache.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace InteractionDesignFoundation\GeoIP;
46

57
use Illuminate\Cache\CacheManager;
@@ -27,8 +29,8 @@ class Cache
2729
* Create a new cache instance.
2830
*
2931
* @param CacheManager $cache
30-
* @param array $tags
31-
* @param int $expires
32+
* @param array $tags
33+
* @param int $expires
3234
*/
3335
public function __construct(CacheManager $cache, $tags, $expires = 30)
3436
{
@@ -54,7 +56,7 @@ public function setPrefix(?string $prefix = null): void
5456
*/
5557
public function get($name)
5658
{
57-
$value = $this->cache->get($this->prefix.$name);
59+
$value = $this->cache->get($this->prefix . $name);
5860

5961
return is_array($value)
6062
? new Location($value)
@@ -64,14 +66,14 @@ public function get($name)
6466
/**
6567
* Store an item in cache.
6668
*
67-
* @param string $name
69+
* @param string $name
6870
* @param Location $location
6971
*
7072
* @return bool
7173
*/
7274
public function set($name, Location $location)
7375
{
74-
return $this->cache->put($this->prefix.$name, $location->toArray(), $this->expires);
76+
return $this->cache->put($this->prefix . $name, $location->toArray(), $this->expires);
7577
}
7678

7779
/**
@@ -83,4 +85,4 @@ public function flush()
8385
{
8486
return $this->cache->flush();
8587
}
86-
}
88+
}

src/Console/Clear.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace InteractionDesignFoundation\GeoIP\Console;
46

57
use Illuminate\Console\Command;
@@ -53,7 +55,7 @@ public function fire()
5355
protected function isSupported()
5456
{
5557
return empty(app('geoip')->config('cache_tags')) === false
56-
&& in_array(config('cache.default'), ['file', 'database']) === false;
58+
&& in_array(config('cache.default'), ['file', 'database'], true) === false;
5759
}
5860

5961
/**

src/Console/Update.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace InteractionDesignFoundation\GeoIP\Console;
46

57
use Illuminate\Console\Command;
@@ -53,8 +55,7 @@ public function fire()
5355
// Perform update
5456
if ($result = $service->update()) {
5557
$this->info($result);
56-
}
57-
else {
58+
} else {
5859
$this->error('Update failed!');
5960
}
6061
}

src/Contracts/ServiceInterface.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace InteractionDesignFoundation\GeoIP\Contracts;
46

57
interface ServiceInterface
@@ -34,9 +36,9 @@ public function hydrate(array $attributes = []);
3436
* Get configuration value.
3537
*
3638
* @param string $key
37-
* @param mixed $default
39+
* @param mixed $default
3840
*
3941
* @return mixed
4042
*/
4143
public function config($key, $default = null);
42-
}
44+
}

src/Facades/GeoIP.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace InteractionDesignFoundation\GeoIP\Facades;
46

57
use Illuminate\Support\Facades\Facade;
@@ -18,4 +20,4 @@ protected static function getFacadeAccessor()
1820
{
1921
return 'geoip';
2022
}
21-
}
23+
}

src/GeoIP.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace InteractionDesignFoundation\GeoIP;
46

57
use Exception;
@@ -77,7 +79,7 @@ class GeoIP
7779
/**
7880
* Create a new GeoIP instance.
7981
*
80-
* @param array $config
82+
* @param array $config
8183
* @param CacheManager $cache
8284
*/
8385
public function __construct(array $config, CacheManager $cache)
@@ -275,7 +277,7 @@ private function isValid($ip): bool
275277
/**
276278
* Determine if the location should be cached.
277279
*
278-
* @param Location $location
280+
* @param Location $location
279281
* @param string|null $ip
280282
*
281283
* @return bool
@@ -299,7 +301,7 @@ private function shouldCache(Location $location, $ip = null): bool
299301
* Get configuration value.
300302
*
301303
* @param string $key
302-
* @param mixed $default
304+
* @param mixed $default
303305
*
304306
* @return mixed
305307
*/

src/GeoIPServiceProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace InteractionDesignFoundation\GeoIP;
46

5-
use Illuminate\Support\Str;
67
use Illuminate\Support\ServiceProvider;
78

89
class GeoIPServiceProvider extends ServiceProvider

src/Location.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace InteractionDesignFoundation\GeoIP;
46

57
use ArrayAccess;
@@ -46,7 +48,7 @@ public function __construct(array $attributes = [])
4648
/**
4749
* Determine if the location is for the same IP address.
4850
*
49-
* @param string $ip
51+
* @param string $ip
5052
*
5153
* @return bool
5254
*/
@@ -58,8 +60,8 @@ public function same($ip)
5860
/**
5961
* Set a given attribute on the location.
6062
*
61-
* @param string $key
62-
* @param mixed $value
63+
* @param string $key
64+
* @param mixed $value
6365
*
6466
* @return $this
6567
*/
@@ -73,7 +75,7 @@ public function setAttribute($key, $value)
7375
/**
7476
* Get an attribute from the $attributes array.
7577
*
76-
* @param string $key
78+
* @param string $key
7779
*
7880
* @return mixed
7981
*/
@@ -125,7 +127,7 @@ public function toArray()
125127
/**
126128
* Get the location's attribute
127129
*
128-
* @param string $key
130+
* @param string $key
129131
*
130132
* @return mixed
131133
*/
@@ -137,8 +139,8 @@ public function __get($key)
137139
/**
138140
* Set the location's attribute
139141
*
140-
* @param string $key
141-
* @param mixed $value
142+
* @param string $key
143+
* @param mixed $value
142144
*/
143145
public function __set($key, $value)
144146
{
@@ -148,7 +150,7 @@ public function __set($key, $value)
148150
/**
149151
* Determine if the given attribute exists.
150152
*
151-
* @param mixed $offset
153+
* @param mixed $offset
152154
*
153155
* @return bool
154156
*/
@@ -160,7 +162,7 @@ public function offsetExists(mixed $offset): bool
160162
/**
161163
* Get the value for a given offset.
162164
*
163-
* @param mixed $offset
165+
* @param mixed $offset
164166
*
165167
* @return mixed
166168
*/
@@ -172,8 +174,8 @@ public function offsetGet(mixed $offset): mixed
172174
/**
173175
* Set the value for a given offset.
174176
*
175-
* @param mixed $offset
176-
* @param mixed $value
177+
* @param mixed $offset
178+
* @param mixed $value
177179
*
178180
* @return void
179181
*/
@@ -185,7 +187,7 @@ public function offsetSet(mixed $offset, mixed $value): void
185187
/**
186188
* Unset the value for a given offset.
187189
*
188-
* @param mixed $offset
190+
* @param mixed $offset
189191
*
190192
* @return void
191193
*/
@@ -209,7 +211,7 @@ public function __isset($key)
209211
/**
210212
* Unset an attribute on the location.
211213
*
212-
* @param string $key
214+
* @param string $key
213215
*
214216
* @return void
215217
*/

0 commit comments

Comments
 (0)