-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new_chat_members to Message object
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace unreal4u\TelegramAPI\Telegram\Types\Custom; | ||
|
||
use unreal4u\TelegramAPI\Abstracts\CustomType; | ||
use unreal4u\TelegramAPI\Telegram\Types\User; | ||
use unreal4u\TelegramAPI\Interfaces\CustomArrayType; | ||
use Psr\Log\LoggerInterface; | ||
|
||
/** | ||
* Mockup class to generate a real telegram update representation | ||
*/ | ||
class UserArray extends CustomType implements CustomArrayType | ||
{ | ||
public function __construct(array $data = null, LoggerInterface $logger = null) | ||
{ | ||
if (count($data) !== 0) { | ||
foreach ($data as $id => $chatMember) { | ||
$this->data[$id] = new User($chatMember, $logger); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Traverses through our $data, yielding the result set | ||
* | ||
* @return ChatMember[] | ||
*/ | ||
public function traverseObject() | ||
{ | ||
foreach ($this->data as $user) { | ||
yield $user; | ||
} | ||
} | ||
} |
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