Skip to content

Commit 9baf9fc

Browse files
committed
Service cleanup
1 parent ef2527d commit 9baf9fc

File tree

5 files changed

+11
-106
lines changed

5 files changed

+11
-106
lines changed

os2web_key.services.yml

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,12 @@ services:
33
parent: logger.channel_base
44
arguments: [ 'os2web_key' ]
55

6-
os2web_key.key_helper:
7-
class: 'Drupal\os2web_key\KeyHelper'
6+
Drupal\os2web_key\KeyHelper:
7+
autowire: true
88
arguments:
9-
- '@logger.channel.os2web_key'
9+
$logger: '@logger.channel.os2web_key'
1010

11-
os2web_key.certificate_key_type:
12-
class: 'Drupal\os2web_key\Plugin\KeyType\CertificateKeyType'
11+
Drupal\os2web_key\Services\Psr16CacheAdapter:
12+
autowire: true
1313
arguments:
14-
- '@os2web_key.key_helper'
15-
16-
os2web_key.psr16_cache:
17-
class: 'Drupal\os2web_key\Services\Psr16CacheAdapter'
18-
arguments:
19-
- '@cache.default'
20-
21-
os2web_key.certificate_helper:
22-
class: 'Drupal\os2web_key\Services\VaultCertificateHelper'
23-
arguments:
24-
- '@file_system'
25-
26-
os2web_key.key_provider:
27-
class: 'Drupal\os2web_key\Plugin\KeyProvider\VaultKeyProvider'
28-
arguments:
29-
- '@logger.channel.os2web_key'
30-
- '@http_client'
31-
- '@os2web_key.psr16_cache'
32-
- '@os2web_key.key_helper'
14+
$cacheBackend: '@cache.default'

src/Plugin/KeyProvider/VaultKeyProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Drupal\key\Plugin\KeyPluginFormInterface;
1010
use Drupal\key\Plugin\KeyProviderBase;
1111
use Drupal\os2web_key\KeyHelper;
12+
use Drupal\os2web_key\Services\Psr16CacheAdapter;
1213
use Drupal\os2web_key\Plugin\KeyType\CertificateKeyType;
1314
use GuzzleHttp\Psr7\HttpFactory;
1415
use ItkDev\Vault\Exception\UnknownErrorException;
@@ -78,8 +79,8 @@ public static function create(ContainerInterface $container, array $configuratio
7879
$plugin_definition,
7980
$container->get('logger.channel.default'),
8081
$container->get('http_client'),
81-
$container->get('os2web_key.psr16_cache'),
82-
$container->get('os2web_key.key_helper'),
82+
$container->get(Psr16CacheAdapter::class),
83+
$container->get(KeyHelper::class),
8384
);
8485
}
8586

src/Plugin/KeyType/CertificateKeyType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static function create(ContainerInterface $container, array $configuratio
5656
$configuration,
5757
$plugin_id,
5858
$plugin_definition,
59-
$container->get('os2web_key.key_helper')
59+
$container->get(KeyHelper::class)
6060
);
6161
}
6262

src/Services/Psr16CacheAdapter.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,13 @@
1010
*/
1111
class Psr16CacheAdapter implements CacheInterface {
1212

13-
/**
14-
* The Drupal cache backend.
15-
*
16-
* @var \Drupal\Core\Cache\CacheBackendInterface
17-
*/
18-
protected CacheBackendInterface $cacheBackend;
19-
2013
/**
2114
* Constructs a new Psr16CacheAdapter.
2215
*
2316
* @param \Drupal\Core\Cache\CacheBackendInterface $cacheBackend
2417
* The Drupal cache backend.
2518
*/
26-
public function __construct(CacheBackendInterface $cacheBackend) {
27-
$this->cacheBackend = $cacheBackend;
19+
public function __construct(private readonly CacheBackendInterface $cacheBackend) {
2820
}
2921

3022
/**

src/Services/VaultCertificateHelper.php

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)