CoreFiles by mySites.guru
MVCFactoryAwareTrait.php57 lines, 1,032 bytes, from Joomla_4.0.0-Stable-Full_Package.zip
Raw History Compare with 3.10.12
md5
6872d98dc3ffe03382fa2bbbc4eaa5f9
sha1
ace8a54a8f2193ceb24575c0ea6c402e102d177b
sha256
aa02575943215f2bcf54c897c63766b763a22b993465b028a9635f1555ed3615
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2019 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;

/**
 * MVCFactory aware trait.
 *
 * @since  4.0.0
 */
trait MVCFactoryAwareTrait
{
	/**
	 * The mvc factory.
	 *
	 * @var    MVCFactoryInterface
	 * @since  4.0.0
	 */
	private $mvcFactory;

	/**
	 * Returns the MVC factory.
	 *
	 * @return  MVCFactoryInterface
	 *
	 * @since   4.0.0
	 * @throws  \UnexpectedValueException
	 */
	protected function getMVCFactory(): MVCFactoryInterface
	{
		if ($this->mvcFactory)
		{
			return $this->mvcFactory;
		}

		throw new \UnexpectedValueException('MVC Factory not set in ' . __CLASS__);
	}

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

The same content is in 50 releases, Joomla 4.0.0-beta7 to 4.2.0-beta2. See them all, or every version of this file.