__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ 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) 2019 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\Database\DatabaseInterface;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Default factory for creating User objects
*
* @since 4.0.0
*/
class UserFactory implements UserFactoryInterface
{
/**
* The database.
*
* @var DatabaseInterface
*/
private $db;
/**
* UserFactory constructor.
*
* @param DatabaseInterface $db The database
*/
public function __construct(DatabaseInterface $db)
{
$this->db = $db;
}
/**
* Method to get an instance of a user for the given id.
*
* @param int $id The id
*
* @return User
*
* @since 4.0.0
*/
public function loadUserById(int $id): User
{
return new User($id);
}
/**
* Method to get an instance of a user for the given username.
*
* @param string $username The username
*
* @return User
*
* @since 4.0.0
*/
public function loadUserByUsername(string $username): User
{
// Initialise some variables
$query = $this->db->getQuery(true)
->select($this->db->quoteName('id'))
->from($this->db->quoteName('#__users'))
->where($this->db->quoteName('username') . ' = :username')
->bind(':username', $username)
->setLimit(1);
$this->db->setQuery($query);
return $this->loadUserById((int) $this->db->loadResult());
}
}
| 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 |
|