This block and the previous ones can be aggregated:

```php
$writerPluginManager = 'LogWriterManager';

if (isset($config['writer_plugin_manager']) && is_string($config['writer_plugin_manager'])) {
    $writerPluginManager = $config['writer_plugin_manager'];
}

$writerPluginManager = $services->has($writerPluginManager) ? $services->get($writerPluginManager) : $writerPluginManager;
```

Also, I'd say that an exception should be thrown if the service does not exist. You can simply remove the `has()` checks.