CoreFiles by mySites.guru
MVCFactoryServiceTrait.php58 lines, 1,096 bytes, from Joomla_4.0.0-beta7-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta6
md5
9495f2dcc7401e35b88f2e8f0639f390
sha1
da7770be47ff9ddf9ea85b75cf11426439f235c8
sha256
e8796014a0a17a5b2488033f8bc16833999195b093972de8d313c320ae368ef7
<?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\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 2 releases, Joomla 4.0.0-beta6 to 4.0.0-beta7. See them all, or every version of this file.