| @@ 15-52 (lines=38) @@ | ||
| 12 | * Class RowEventService |
|
| 13 | * @package MySQLReplication\RowEvent |
|
| 14 | */ |
|
| 15 | class RowEventFactory |
|
| 16 | { |
|
| 17 | /** |
|
| 18 | * @var RowEventBuilder |
|
| 19 | */ |
|
| 20 | private $rowEventBuilder; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * RowEventService constructor. |
|
| 24 | * @param RepositoryInterface $repository |
|
| 25 | * @param JsonBinaryDecoderFactory $jsonBinaryDecoderFactory |
|
| 26 | * @param CacheInterface $cache |
|
| 27 | */ |
|
| 28 | public function __construct( |
|
| 29 | RepositoryInterface $repository, |
|
| 30 | JsonBinaryDecoderFactory $jsonBinaryDecoderFactory, |
|
| 31 | CacheInterface $cache |
|
| 32 | ) { |
|
| 33 | $this->rowEventBuilder = new RowEventBuilder( |
|
| 34 | $repository, |
|
| 35 | $jsonBinaryDecoderFactory, |
|
| 36 | $cache |
|
| 37 | ); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @param BinaryDataReader $package |
|
| 42 | * @param EventInfo $eventInfo |
|
| 43 | * @return RowEvent |
|
| 44 | */ |
|
| 45 | public function makeRowEvent(BinaryDataReader $package, EventInfo $eventInfo) |
|
| 46 | { |
|
| 47 | $this->rowEventBuilder->withPackage($package); |
|
| 48 | $this->rowEventBuilder->withEventInfo($eventInfo); |
|
| 49 | ||
| 50 | return $this->rowEventBuilder->build(); |
|
| 51 | } |
|
| 52 | } |
|
| @@ 15-53 (lines=39) @@ | ||
| 12 | * Class RowEventService |
|
| 13 | * @package MySQLReplication\RowEvent |
|
| 14 | */ |
|
| 15 | class RowEventService |
|
| 16 | { |
|
| 17 | /** |
|
| 18 | * @var RowEventBuilder |
|
| 19 | */ |
|
| 20 | private $rowEventBuilder; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * RowEventService constructor. |
|
| 24 | * @param Config $config |
|
| 25 | * @param RepositoryInterface $repository |
|
| 26 | * @param JsonBinaryDecoderFactory $jsonBinaryDecoderFactory |
|
| 27 | */ |
|
| 28 | public function __construct( |
|
| 29 | Config $config, |
|
| 30 | RepositoryInterface $repository, |
|
| 31 | JsonBinaryDecoderFactory $jsonBinaryDecoderFactory |
|
| 32 | ) |
|
| 33 | { |
|
| 34 | $this->rowEventBuilder = new RowEventBuilder( |
|
| 35 | $config, |
|
| 36 | $repository, |
|
| 37 | $jsonBinaryDecoderFactory |
|
| 38 | ); |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * @param BinaryDataReader $package |
|
| 43 | * @param EventInfo $eventInfo |
|
| 44 | * @return RowEvent |
|
| 45 | */ |
|
| 46 | public function makeRowEvent(BinaryDataReader $package, EventInfo $eventInfo) |
|
| 47 | { |
|
| 48 | $this->rowEventBuilder->withPackage($package); |
|
| 49 | $this->rowEventBuilder->withEventInfo($eventInfo); |
|
| 50 | ||
| 51 | return $this->rowEventBuilder->build(); |
|
| 52 | } |
|
| 53 | } |
|