CoreFiles by mySites.guru
MenuFactory.php45 lines, 1,085 bytes, from Joomla_4.0.0-alpha12-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha11
md5
0ca2293c714191cb91961fafda909d62
sha1
9249f465b106d139c55718a6960638e361250b64
sha256
cd9b8f286928054b6e25297539ce44df9c495cebc1420c412285da39303f1add
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  Copyright (C) 2005 - 2019 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;

use Joomla\CMS\Language\Text;

/**
 * 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(Text::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.