- md5
- 7c963880aadfc969b6430faf92c8a0fb
- sha1
- 52d9d294a2663d79ee5c855d7bc0d1838fdf4b48
- sha256
- a648be51f2ab8c560b9cbe43825bdfb5febe24732fc91e79d6f5761d39c27435
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
<?php
/**
* Joomla! Content Management System
*
* @copyright (C) 2018 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\Categories\CategoryFactoryInterface;
use Joomla\Database\DatabaseInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Service provider for the service categories.
*
* @since 4.0.0
*/
class CategoryFactory implements ServiceProviderInterface
{
/**
* The namespace to create the categories from.
*
* @var string
* @since 4.0.0
*/
private $namespace;
/**
* The namespace must be like:
* Joomla\Component\Content
*
* @param string $namespace The namespace
*
* @since 4.0.0
*/
public function __construct($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(
CategoryFactoryInterface::class,
function (Container $container) {
$factory = new \Joomla\CMS\Categories\CategoryFactory($this->namespace);
$factory->setDatabase($container->get(DatabaseInterface::class));
return $factory;
}
);
}
}
The same content is in 155 releases, Joomla 5.0.0-alpha1 to 6.2.1-rc1. See them all, or every version of this file.