__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* Joomla! Content Management System
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\User;
use Joomla\CMS\Factory;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Trait for classes which require a user to work with.
*
* @since 4.2.0
*/
trait CurrentUserTrait
{
/**
* The current user object.
*
* @var User
* @since 4.2.0
*/
private $currentUser;
/**
* Returns the current user, if none is set the identity of the global app
* is returned. This will change in 6.0 and an empty user will be returned.
*
* @return User
*
* @since 4.2.0
*/
protected function getCurrentUser(): User
{
if (!$this->currentUser) {
@trigger_error(
\sprintf('User must be set in %s. This will not be caught anymore in 6.0', __METHOD__),
E_USER_DEPRECATED
);
$this->currentUser = Factory::getApplication()->getIdentity() ?: Factory::getUser();
}
return $this->currentUser;
}
/**
* Sets the current user.
*
* @param User $currentUser The current user object
*
* @return void
*
* @since 4.2.0
*/
public function setCurrentUser(User $currentUser): void
{
$this->currentUser = $currentUser;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| CurrentUserInterface.php | File | 709 B | 0664 |
|
| CurrentUserTrait.php | File | 1.5 KB | 0664 |
|
| User.php | File | 25.69 KB | 0664 |
|
| UserFactory.php | File | 1.73 KB | 0664 |
|
| UserFactoryAwareInterface.php | File | 745 B | 0664 |
|
| UserFactoryAwareTrait.php | File | 1.35 KB | 0664 |
|
| UserFactoryInterface.php | File | 952 B | 0664 |
|
| UserHelper.php | File | 20.54 KB | 0664 |
|