Вход Регистрация
Файл: system/vendor/laminas/laminas-servicemanager/src/Factory/InvokableFactory.php
Строк: 66
<?php

/**
 * @see       https://github.com/laminas/laminas-servicemanager for the canonical source repository
 * @copyright https://github.com/laminas/laminas-servicemanager/blob/master/COPYRIGHT.md
 * @license   https://github.com/laminas/laminas-servicemanager/blob/master/LICENSE.md New BSD License
 */

namespace LaminasServiceManagerFactory;

use 
InteropContainerContainerInterface;

/**
 * Factory for instantiating classes with no dependencies or which accept a single array.
 *
 * The InvokableFactory can be used for any class that:
 *
 * - has no constructor arguments;
 * - accepts a single array of arguments via the constructor.
 *
 * It replaces the "invokables" and "invokable class" functionality of the v2
 * service manager.
 */
final class InvokableFactory implements FactoryInterface
{
    
/**
     * {@inheritDoc}
     */
    
public function __invoke(ContainerInterface $container$requestedName, array $options null)
    {
        return (
null === $options) ? new $requestedName : new $requestedName($options);
    }
}
Онлайн: 1
Реклама