0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
<?php
class User
{
protected $_user_id;
protected $_user_email;
protected $_user_password;
public function __construct($user_id)
{
$user_record = self::_getUserRecord($user_id);
$this->_user_id = $user_record['id'];
$this->_user_email = $user_record['email'];
$this->_user_password = $user_record['password'];
}
public function __get($value) {}
public function __set($name, $value) {}
private static function _getUserRecord($user_id)
{
$user_record = array();
switch($user_id) {
case 1:
$user_record['id'] = 1;
$user_record['email'] = '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="046a6d6f6f6b44617c65697468612a676b69">[email protected]</a>';
$user_record['password'] = 'i like croissants';
break;
case 2:
$user_record['id'] = 2;
$user_record['email'] = '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c6aca9aea886a3bea7abb6aaa3e8a5a9ab">[email protected]</a>';
$user_record['password'] = 'me too!';
break;
case 'error':
throw new Exception('Ошибка библиотеки SQL!');
break;
}
return $user_record;
}
}
?>
PHP исключения...
Запостил:
Govnisti_Diavol ,
19.03.2012 (Updated 09.04.2019 )
(похоже на орм ентити)