CoreFiles by mySites.guru
IdentityAware.php57 lines, 1,050 bytes, from Joomla_4.0.0-alpha5-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha3
md5
52aa38a7739b67e6ce81475b99653c5f
sha1
92a1a45740fc1f45fecd429ce797bd1b28ed62e2
sha256
288dd9048cb21765e3139784cf1d6ab69111451ea6dbc8b697b083dd9a8948cf
<?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
 */

namespace Joomla\CMS\Application;

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\User\User;

/**
 * Trait for application classes which are identity (user) aware
 *
 * @since  4.0.0
 */
trait IdentityAware
{
	/**
	 * The application identity object.
	 *
	 * @var    User
	 * @since  4.0.0
	 */
	protected $identity;

	/**
	 * Get the application identity.
	 *
	 * @return  User
	 *
	 * @since   4.0.0
	 */
	public function getIdentity()
	{
		return $this->identity;
	}

	/**
	 * Allows the application to load a custom or default identity.
	 *
	 * @param   User  $identity  An optional identity object. If omitted, a null user object is created.
	 *
	 * @return  $this
	 *
	 * @since   4.0.0
	 */
	public function loadIdentity(User $identity = null)
	{
		$this->identity = $identity ?: User::getInstance();

		return $this;
	}
}

The same content is in 3 releases, Joomla 4.0.0-alpha3 to 4.0.0-alpha6. See them all, or every version of this file.