-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ | |
|
||
# Local History for Visual Studio Code | ||
.history/ | ||
|
||
tests/main.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
class Account { | ||
|
||
private $user; | ||
|
||
public function __construct(User $user) { | ||
$this->user = $user; | ||
} | ||
|
||
public function getId() { | ||
return $this->user->VkApiRequest()->api('account.getProfileInfo', [])['id']; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
<?php | ||
|
||
class User { | ||
|
||
public function __construct() { } | ||
|
||
// public function getAccount(): Account { } | ||
|
||
// public function getMessages(): Messages { } | ||
|
||
} | ||
|
||
private $VkApiRequest; | ||
private $Account; | ||
|
||
public $token; | ||
public $v; | ||
|
||
public function __construct(string $token, $v = 5.126) { | ||
$this->token = $token; | ||
$this->v = $v; | ||
|
||
$this->VkApiRequest = new VkApiRequest($this); | ||
$this->Account = new Account($this); | ||
} | ||
|
||
public function VkApiRequest(): VkApiRequest { | ||
return $this->VkApiRequest; | ||
} | ||
|
||
public function getAccount(): Account { | ||
return $this->Account; | ||
} | ||
|
||
// public function getMessages(): Messages { } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters