Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 799 Bytes

DecoderFactory.md

File metadata and controls

39 lines (25 loc) · 799 Bytes

DecoderFactory

without name (default)

<?php

use Chubbyphp\DecodeEncode\Decoder\TypeDecoderInterface;
use Chubbyphp\DecodeEncode\ServiceFactory\DecoderFactory;
use Psr\Container\ContainerInterface;

/** @var ContainerInterface $container */
$container = ...;

// $container->get(TypeDecoderInterface::class.'[]')

$factory = new DecoderFactory();

$decoder = $factory($container);

with name (default)

<?php

use Chubbyphp\DecodeEncode\Decoder\TypeDecoderInterface;
use Chubbyphp\DecodeEncode\ServiceFactory\DecoderFactory;
use Psr\Container\ContainerInterface;

/** @var ContainerInterface $container */
$container = ...;

// $container->get(TypeDecoderInterface::class.'[]default')

$factory = [DecoderFactory::class, 'default'];

$decoder = $factory($container);