CoreFiles by mySites.guru
MVCFactoryServiceTrait.php56 lines, 1,187 bytes, from Joomla_4.2.0-Stable-Full_Package.zip
Raw History Compare with 4.1.5
md5
4f54bd243733d6044855857345c975d7
sha1
a2b996f0f28de026c7ef5d571222d1871e14d8cf
sha256
3130a48c50672cd3e644ce27b238e94c75422c859a473b0ce6276da4eb268d82
<?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;

/**
 * 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.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.