CoreFiles by mySites.guru
MVCFactoryAwareTrait.php57 lines, 1,047 bytes, from Joomla_4.0.0-beta1-Beta-Full_Package.zip
Raw History Compare with 3.9.0-beta4
md5
17f90ec17dc2b1ab50d07df91781bfff
sha1
e366449e9f2c151ddb5de2bb5892d7aa4ee82ff9
sha256
343cba08a249a4d1baa72f8d4526f668ddc386a26af9d13cf00f7994c4fbeda1
<?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;

/**
 * MVCFactory aware trait.
 *
 * @since  4.0.0
 */
trait MVCFactoryAwareTrait
{
	/**
	 * The mvc factory.
	 *
	 * @var    MVCFactoryInterfaceCF
	 * @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 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.