Added VKBot
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Library\VK\Mapper;
|
||||
|
||||
class AttachmentMapper
|
||||
{
|
||||
public function map(array $attachments = []): array
|
||||
{
|
||||
$photos = [];
|
||||
foreach ($attachments as $attachment) {
|
||||
if( ($attachment['type'] === 'photo') && $attachment['photo']['sizes'] ) {
|
||||
$photos[] = end($attachment['photo']['sizes'])['url'];
|
||||
}
|
||||
}
|
||||
|
||||
return $photos;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user