Added VKBot
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Library\VK\Mapper;
|
||||
|
||||
use App\Library\VK\Entity\VkPost;
|
||||
use App\Library\VK\Mapper\Strategy\Interfaces\MappingStrategyInterface;
|
||||
use App\Library\VK\Mapper\Strategy\MappingStrategyFactory;
|
||||
|
||||
class PostMapper
|
||||
{
|
||||
public function __construct(
|
||||
private MappingStrategyFactory $mappingStrategyFactory,
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
public function map(array $item): VkPost
|
||||
{
|
||||
$isRepost = isset($item['copy_history']);
|
||||
|
||||
/** @var MappingStrategyInterface $strategy */
|
||||
$strategy = $this->mappingStrategyFactory->getStrategy($isRepost);
|
||||
|
||||
return $strategy->map($item);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user