CoreFiles by mySites.guru
MenuFactory.php43 lines, 1,055 bytes, from Joomla_4.0.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha2
md5
b7acf86265838597a14075f576089c7d
sha1
45f1a242d0d30ba4b7ea6034170d17a3ff9b04a3
sha256
3da418ee85cc030d325dbbbdcf2d92de9b84874b72d300548f79a69e7ecf2fa8
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Menu;

defined('_JEXEC') or die;

/**
 * Default factory for creating Menu objects
 *
 * @since  4.0.0
 */
class MenuFactory implements MenuFactoryInterface
{
	/**
	 * Creates a new Menu object for the requested format.
	 *
	 * @param   string  $client   The name of the client
	 * @param   array   $options  An associative array of options
	 *
	 * @return  AbstractMenu
	 *
	 * @since   4.0.0
	 * @throws  \InvalidArgumentException
	 */
	public function createMenu(string $client, array $options = []): AbstractMenu
	{
		// Create a Menu object
		$classname = __NAMESPACE__ . '\\' . ucfirst(strtolower($client)) . 'Menu';

		if (!class_exists($classname))
		{
			throw new \InvalidArgumentException(\JText::sprintf('JLIB_APPLICATION_ERROR_MENU_LOAD', $client), 500);
		}

		return new $classname($options);
	}
}

No other release has this exact content. See every version of this file.