Skip to content

Commit b8f1e2f

Browse files
authored
Apply fixes from StyleCI (#78)
1 parent a02f02b commit b8f1e2f

15 files changed

+53
-53
lines changed

src/DSN.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,38 @@
1919
final class DSN
2020
{
2121
private static $PORTS = [
22-
'redis' => 6379,
22+
'redis' => 6379,
2323
'mongodb' => 27017,
24-
'tcp' => 6379,
24+
'tcp' => 6379,
2525
];
2626

2727
/**
28-
* @type string
28+
* @var string
2929
*/
3030
protected $dsn;
3131

3232
/**
33-
* @type string
33+
* @var string
3434
*/
3535
protected $protocol;
3636

3737
/**
38-
* @type array
38+
* @var array
3939
*/
4040
protected $authentication;
4141

4242
/**
43-
* @type array
43+
* @var array
4444
*/
4545
protected $hosts;
4646

4747
/**
48-
* @type int
48+
* @var int
4949
*/
5050
protected $database;
5151

5252
/**
53-
* @type array
53+
* @var array
5454
*/
5555
protected $parameters = [];
5656

@@ -181,7 +181,7 @@ private function parseProtocol($dsn)
181181
private function parseDsn($dsn)
182182
{
183183
$this->parseProtocol($dsn);
184-
if ($this->getProtocol() === null) {
184+
if (null === $this->getProtocol()) {
185185
return;
186186
}
187187

@@ -191,10 +191,10 @@ private function parseDsn($dsn)
191191
// Parse and remove auth if they exist
192192
if (false !== $pos = strrpos($dsn, '@')) {
193193
$temp = explode(':', str_replace('\@', '@', substr($dsn, 0, $pos)));
194-
$dsn = substr($dsn, $pos + 1);
194+
$dsn = substr($dsn, $pos + 1);
195195

196196
$auth = [];
197-
if (count($temp) === 2) {
197+
if (2 === count($temp)) {
198198
$auth['username'] = $temp[0];
199199
$auth['password'] = $temp[1];
200200
} else {
@@ -204,8 +204,8 @@ private function parseDsn($dsn)
204204
$this->authentication = $auth;
205205
}
206206

207-
if (strpos($dsn, '?') !== false) {
208-
if (strpos($dsn, '/') === false) {
207+
if (false !== strpos($dsn, '?')) {
208+
if (false === strpos($dsn, '/')) {
209209
$dsn = str_replace('?', '/?', $dsn);
210210
}
211211
}
@@ -214,8 +214,8 @@ private function parseDsn($dsn)
214214
$this->parseHosts($temp[0]);
215215

216216
if (isset($temp[1])) {
217-
$params = $temp[1];
218-
$temp = explode('?', $params);
217+
$params = $temp[1];
218+
$temp = explode('?', $params);
219219
$this->database = empty($temp[0]) ? null : $temp[0];
220220
if (isset($temp[1])) {
221221
$this->parseParameters($temp[1]);
@@ -248,7 +248,7 @@ protected function parseParameters($params)
248248
$parameters = explode('&', $params);
249249

250250
foreach ($parameters as $parameter) {
251-
$kv = explode('=', $parameter, 2);
251+
$kv = explode('=', $parameter, 2);
252252
$this->parameters[$kv[0]] = isset($kv[1]) ? $kv[1] : null;
253253
}
254254

src/DependencyInjection/CacheAdapterExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ class CacheAdapterExtension extends Extension
3333
public function load(array $configs, ContainerBuilder $container)
3434
{
3535
$configuration = new Configuration();
36-
$config = $this->processConfiguration($configuration, $configs);
36+
$config = $this->processConfiguration($configuration, $configs);
3737

3838
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
3939
$loader->load('services.yml');
4040

4141
// Configure client services
4242
$first = isset($config['providers']['default']) ? 'default' : null;
4343
foreach ($config['providers'] as $name => $arguments) {
44-
if ($first === null) {
44+
if (null === $first) {
4545
$first = $name;
4646
}
4747

@@ -62,7 +62,7 @@ public function load(array $configs, ContainerBuilder $container)
6262
}
6363
}
6464

65-
if ($first !== null) {
65+
if (null !== $first) {
6666
$container->setAlias('cache', 'cache.provider.'.$first);
6767
$container->setAlias('php_cache', 'cache.provider.'.$first);
6868
}
@@ -78,7 +78,7 @@ private function findReferences(array $options)
7878
foreach ($options as $key => $value) {
7979
if (is_array($value)) {
8080
$options[$key] = $this->findReferences($value);
81-
} elseif (substr($key, -8) === '_service' || strpos($value, '@') === 0 || $key === 'service') {
81+
} elseif ('_service' === substr($key, -8) || 0 === strpos($value, '@') || 'service' === $key) {
8282
$options[$key] = new Reference(ltrim($value, '@'));
8383
}
8484
}

src/DependencyInjection/CompilerPass/ServiceAliasCompilerPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function process(ContainerBuilder $container)
3030
{
3131
$serviceIds = array_keys($container->findTaggedServiceIds('cache.provider'));
3232
foreach ($serviceIds as $serviceId) {
33-
$instance = $container->get($serviceId);
34-
$class = get_class($instance);
33+
$instance = $container->get($serviceId);
34+
$class = get_class($instance);
3535

3636
$container->setAlias($class, $serviceId);
3737
}

src/DependencyInjection/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Configuration implements ConfigurationInterface
3030
public function getConfigTreeBuilder()
3131
{
3232
$treeBuilder = new TreeBuilder();
33-
$rootNode = $treeBuilder->root('cache_adapter');
33+
$rootNode = $treeBuilder->root('cache_adapter');
3434

3535
$rootNode->children()
3636
->append($this->getClustersNode())
@@ -45,7 +45,7 @@ public function getConfigTreeBuilder()
4545
private function getClustersNode()
4646
{
4747
$treeBuilder = new TreeBuilder();
48-
$node = $treeBuilder->root('providers');
48+
$node = $treeBuilder->root('providers');
4949

5050
$node
5151
->requiresAtLeastOneElement()

src/Factory/AbstractDsnAdapterFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
abstract class AbstractDsnAdapterFactory extends AbstractAdapterFactory
2121
{
2222
/**
23-
* @type DSN
23+
* @var DSN
2424
*/
2525
private $DSN;
2626

src/Factory/DoctrineCouchbaseFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public function getAdapter(array $config)
4040
protected static function configureOptionResolver(OptionsResolver $resolver)
4141
{
4242
$resolver->setDefaults([
43-
'host' => '127.0.0.1',
44-
'user' => 'Administrator',
43+
'host' => '127.0.0.1',
44+
'user' => 'Administrator',
4545
'password' => 'password',
46-
'bucket' => 'default',
46+
'bucket' => 'default',
4747
]);
4848

4949
$resolver->setAllowedTypes('host', ['string']);

src/Factory/DoctrineFilesystemFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected static function configureOptionResolver(OptionsResolver $resolver)
3737
{
3838
$resolver->setDefaults([
3939
'extension' => FilesystemCache::EXTENSION,
40-
'umask' => '0002',
40+
'umask' => '0002',
4141
]);
4242

4343
$resolver->setRequired(['directory']);

src/Factory/DoctrineMongodDBFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class DoctrineMongodDBFactory extends AbstractDoctrineAdapterFactory
2626
*/
2727
public function getAdapter(array $config)
2828
{
29-
$mongo = new MongoClient();
29+
$mongo = new MongoClient();
3030
$collection = $mongo->selectCollection($config['host'], $config['collection']);
3131

3232
return new DoctrineCachePool(new MongoDBCache($collection));

src/Factory/DoctrinePredisFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public function getAdapter(array $config)
3333
{
3434
$client = new Client([
3535
'scheme' => $config['scheme'],
36-
'host' => $config['host'],
37-
'port' => $config['port'],
36+
'host' => $config['host'],
37+
'port' => $config['port'],
3838
]);
3939

4040
return new DoctrineCachePool(new PredisCache($client));
@@ -46,8 +46,8 @@ public function getAdapter(array $config)
4646
protected static function configureOptionResolver(OptionsResolver $resolver)
4747
{
4848
$resolver->setDefaults([
49-
'host' => '127.0.0.1',
50-
'port' => '6379',
49+
'host' => '127.0.0.1',
50+
'port' => '6379',
5151
'scheme' => 'tcp',
5252
]);
5353

src/Factory/DoctrineRiakFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class DoctrineRiakFactory extends AbstractDoctrineAdapterFactory
2828
public function getAdapter(array $config)
2929
{
3030
$connection = new Connection($config['host'], $config['port']);
31-
$bucket = new Bucket($connection, $config['type']);
31+
$bucket = new Bucket($connection, $config['type']);
3232

3333
return new DoctrineCachePool(new RiakCache($bucket));
3434
}

0 commit comments

Comments
 (0)