CoreFiles by mySites.guru
MVCFactoryServiceTrait.php58 lines, 1,109 bytes, from Joomla_4.0.0-beta5-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta4
md5
6fdbc7f9f4c46c7b2b5079c0895335b9
sha1
a7f5b0540319509de43ba74d6e9d3d284df212de
sha256
7df1b20a3da6b21003fe52062b511b7bbc06e0b270951094320e3fd907c92b2b
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\MVC\Factory;

\defined('_JEXEC') or die;

/**
 * Defines the trait for a MVC factory service class.
 *
 * @since  4.0.0
 */
trait MVCFactoryServiceTrait
{
	/**
	 * The MVC Factory.
	 *
	 * @var MVCFactoryInterface
	 */
	private $mvcFactory;

	/**
	 * Get the factory.
	 *
	 * @return  MVCFactoryInterface
	 *
	 * @since   4.0.0
	 * @throws  \UnexpectedValueException May be thrown if the factory has not been set.
	 */
	public function getMVCFactory(): MVCFactoryInterface
	{
		if (!$this->mvcFactory)
		{
			throw new \UnexpectedValueException('MVC factory not set in ' . __CLASS__);
		}

		return $this->mvcFactory;
	}

	/**
	 * The MVC Factory.
	 *
	 * @param   MVCFactoryInterface  $mvcFactory  The factory
	 *
	 * @return  void
	 *
	 * @since  4.0.0
	 */
	public function setMvcFactory(MVCFactoryInterface $mvcFactory)
	{
		$this->mvcFactory = $mvcFactory;
	}
}

The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.