Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace global DI library functions with corresponding objects for PRS-4 compliance #238

Merged
merged 1 commit into from
May 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 24 additions & 22 deletions src/di_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* @license http://opensource.org/licenses/bsd-license.php BSD
*/

use DI\Definition\Helper\AutowireDefinitionHelper;
use DI\Definition\Reference;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use ZBateson\MailMimeParser\Header\Consumer\Received\DomainConsumerService;
Expand All @@ -16,47 +18,47 @@
use ZBateson\MailMimeParser\Stream\StreamFactory;

return [
LoggerInterface::class => DI\autowire(NullLogger::class),
LoggerInterface::class => new AutowireDefinitionHelper(NullLogger::class),

// only affects reading part content, not for instance decoding mime encoded
// header parts
'throwExceptionReadingPartContentFromUnsupportedCharsets' => false,

'fromDomainConsumerService' => DI\autowire(DomainConsumerService::class)
'fromDomainConsumerService' => (new AutowireDefinitionHelper(DomainConsumerService::class))
->constructorParameter('partName', 'from'),
'byDomainConsumerService' => DI\autowire(DomainConsumerService::class)
'byDomainConsumerService' => (new AutowireDefinitionHelper(DomainConsumerService::class))
->constructorParameter('partName', 'by'),
'viaGenericReceivedConsumerService' => DI\autowire(GenericReceivedConsumerService::class)
'viaGenericReceivedConsumerService' => (new AutowireDefinitionHelper(GenericReceivedConsumerService::class))
->constructorParameter('partName', 'via'),
'withGenericReceivedConsumerService' => DI\autowire(GenericReceivedConsumerService::class)
'withGenericReceivedConsumerService' => (new AutowireDefinitionHelper(GenericReceivedConsumerService::class))
->constructorParameter('partName', 'with'),
'idGenericReceivedConsumerService' => DI\autowire(GenericReceivedConsumerService::class)
'idGenericReceivedConsumerService' => (new AutowireDefinitionHelper(GenericReceivedConsumerService::class))
->constructorParameter('partName', 'id'),
'forGenericReceivedConsumerService' => DI\autowire(GenericReceivedConsumerService::class)
'forGenericReceivedConsumerService' => (new AutowireDefinitionHelper(GenericReceivedConsumerService::class))
->constructorParameter('partName', 'for'),
ReceivedConsumerService::class => DI\autowire()
ReceivedConsumerService::class => (new AutowireDefinitionHelper())
->constructor(
fromDomainConsumerService: DI\get('fromDomainConsumerService'),
byDomainConsumerService: DI\get('byDomainConsumerService'),
viaGenericReceivedConsumerService: DI\get('viaGenericReceivedConsumerService'),
withGenericReceivedConsumerService: DI\get('withGenericReceivedConsumerService'),
idGenericReceivedConsumerService: DI\get('idGenericReceivedConsumerService'),
forGenericReceivedConsumerService: DI\get('forGenericReceivedConsumerService')
fromDomainConsumerService: new Reference('fromDomainConsumerService'),
byDomainConsumerService: new Reference('byDomainConsumerService'),
viaGenericReceivedConsumerService: new Reference('viaGenericReceivedConsumerService'),
withGenericReceivedConsumerService: new Reference('withGenericReceivedConsumerService'),
idGenericReceivedConsumerService: new Reference('idGenericReceivedConsumerService'),
forGenericReceivedConsumerService: new Reference('forGenericReceivedConsumerService')
),
PartStreamContainer::class => DI\autowire()
PartStreamContainer::class => (new AutowireDefinitionHelper())
->constructor(
throwExceptionReadingPartContentFromUnsupportedCharsets: DI\get('throwExceptionReadingPartContentFromUnsupportedCharsets')
throwExceptionReadingPartContentFromUnsupportedCharsets: new Reference('throwExceptionReadingPartContentFromUnsupportedCharsets')
),
PartStreamContainerFactory::class => DI\autowire()
PartStreamContainerFactory::class => (new AutowireDefinitionHelper())
->constructor(
throwExceptionReadingPartContentFromUnsupportedCharsets: DI\get('throwExceptionReadingPartContentFromUnsupportedCharsets')
throwExceptionReadingPartContentFromUnsupportedCharsets: new Reference('throwExceptionReadingPartContentFromUnsupportedCharsets')
),
ParserPartStreamContainerFactory::class => DI\autowire()
ParserPartStreamContainerFactory::class => (new AutowireDefinitionHelper())
->constructor(
throwExceptionReadingPartContentFromUnsupportedCharsets: DI\get('throwExceptionReadingPartContentFromUnsupportedCharsets')
throwExceptionReadingPartContentFromUnsupportedCharsets: new Reference('throwExceptionReadingPartContentFromUnsupportedCharsets')
),
StreamFactory::class => DI\autowire()
StreamFactory::class => (new AutowireDefinitionHelper())
->constructor(
throwExceptionReadingPartContentFromUnsupportedCharsets: DI\get('throwExceptionReadingPartContentFromUnsupportedCharsets')
throwExceptionReadingPartContentFromUnsupportedCharsets: new Reference('throwExceptionReadingPartContentFromUnsupportedCharsets')
),
];
Loading