Skip to content

Commit 67cd405

Browse files
Merge pull request #36 from technicalguru/1.2-dev
Release v1.2.4
2 parents 4297d95 + 6af7715 commit 67cd405

File tree

2 files changed

+32
-11
lines changed

2 files changed

+32
-11
lines changed

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"php" : ">=7.0.0",
1717
"ext-mbstring" : "*",
1818
"technicalguru/i18n" : "~1",
19-
"ezyang/htmlpurifier":"^4.15"
19+
"ezyang/htmlpurifier":"^4"
2020
},
2121
"autoload" : {
2222
"psr-4" : {
@@ -26,7 +26,7 @@
2626
},
2727
"extra": {
2828
"branch-alias": {
29-
"dev-master": "1.0-dev"
29+
"dev-master": "1.2-dev"
3030
}
3131
},
3232
"require-dev" : {

src/TgUtils/Auth/DefaultCredentialsProvider.php

+30-9
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,49 @@
44

55
class DefaultCredentialsProvider implements CredentialsProvider {
66

7-
private $username;
8-
private $password;
7+
private $credentials;
98

10-
public function __construct($username, $password) {
11-
$this->username = $username;
12-
$this->password = $password;
9+
public function __construct($username, $password) {
10+
$this->credentials = array(
11+
'username' => $username,
12+
'password' => $password
13+
);
1314
}
1415

1516
/**
1617
* Returns the username.
1718
* @return string the username
1819
*/
1920
public function getUsername(){
20-
return $this->username;
21+
return $this->get('username');
2122
}
2223

2324
/**
2425
* Returns the password.
2526
* @return string the password
2627
*/
2728
public function getPassword() {
28-
return $this->password;
29+
return $this->get('password');
2930
}
30-
31-
}
31+
32+
/**
33+
* Returns the credentials of the given key.
34+
* @param string $key - the key of the credentials.
35+
* @return string the credentials stored of NULL
36+
*/
37+
public function get($key) {
38+
if (isset($this->credentials[$key])) {
39+
return $this->credentials[$key];
40+
}
41+
return NULL;
42+
}
43+
44+
/**
45+
* Sets the credentials of the given key.
46+
* @param string $key - the key of the credentials.
47+
* @param string $value - credentials to be stored at this key
48+
*/
49+
protected function set($key, $value) {
50+
$this->credentials[$key] = $value;
51+
}
52+
}

0 commit comments

Comments
 (0)