12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
-
- namespace SCF\Core;
-
-
- class UserManager {
- /**
- * @var mixed
- */
- private $_db;
- /**
- * @var int $userId
- */
- private $userId;
- /**
- * @var array
- */
- private $userData = [];
-
- /**
- * UserManager constructor.
- * @param Database $db
- * @param $userId
- */
- public function __construct(Database $db, $userId)
- {
- $this->_db = $db;
- $this->userId = $userId;
- $this->getPlayerAccount($this->userId);
- }
-
- /**
- * @param $userId
- */
- private function getPlayerAccount($userId)
- {
- $this->_db->query("SELECT * FROM users WHERE userId = :userId LIMIT 0,1");
- $this->_db->bind(':userId', $userId);
- $this->userData = $this->_db->single();
-
- }
-
- /**
- * @param $value
- * @return mixed|string
- */
- public function getValue($value)
- {
- if(isset($this->userData[$value])) {
- return $this->userData[$value];
- } else {
- return 'N/A';
- }
- }
-
-
-
- }
|