CoreFiles by mySites.guru
HelperFactory.php66 lines, 1,504 bytes, from Joomla_4.2.0-Stable-Full_Package.zip
Raw History Compare with 4.1.5
md5
4f56969b97826f35e18070d0263fe4a1
sha1
dfca234f9ce854431a860ba0299111f9d6d3f6e3
sha256
ad0d1a701bb5e6368d0198a760564ffde60eed6fdecbaa46499dce47645821c7
<?php

/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Extension\Service\Provider;

use Joomla\CMS\Helper\HelperFactoryInterface;
use Joomla\Database\DatabaseInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;

/**
 * Service provider for the service helper factory.
 *
 * @since  4.0.0
 */
class HelperFactory implements ServiceProviderInterface
{
    /**
     * The namespace
     *
     * @var  string
     *
     * @since   4.0.0
     */
    private $namespace;

    /**
     * HelperFactory constructor.
     *
     * @param   string  $namespace  The namespace
     *
     * @since   4.0.0
     */
    public function __construct(string $namespace)
    {
        $this->namespace = $namespace;
    }

    /**
     * Registers the service provider with a DI container.
     *
     * @param   Container  $container  The DI container.
     *
     * @return  void
     *
     * @since   4.0.0
     */
    public function register(Container $container)
    {
        $container->set(
            HelperFactoryInterface::class,
            function (Container $container) {
                $factory = new \Joomla\CMS\Helper\HelperFactory($this->namespace);
                $factory->setDatabase($container->get(DatabaseInterface::class));

                return $factory;
            }
        );
    }
}

The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.