Skip to content

Commit aaf7525

Browse files
committed
clean up
1 parent a8ee878 commit aaf7525

File tree

4 files changed

+60
-59
lines changed

4 files changed

+60
-59
lines changed

example/dump_events.php

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
<?php
2-
3-
namespace example;
4-
5-
error_reporting(E_ALL);
6-
ini_set('display_errors', 1);
7-
date_default_timezone_set('UTC');
8-
include __DIR__ . '/../vendor/autoload.php';
9-
10-
use MySQLReplication\Config\ConfigService;
11-
use MySQLReplication\Event\DTO\EventDTO;
12-
use MySQLReplication\Event\EventSubscribers;
13-
use MySQLReplication\MySQLReplicationFactory;
14-
15-
$binLogStream = new MySQLReplicationFactory(
16-
(new ConfigService())->makeConfigFromArray([
17-
'user' => 'root',
18-
'ip' => '127.0.0.1',
19-
'password' => 'root',
20-
//'mariaDbGtid' => '1-1-3,0-1-88',
21-
//'gtid' => '9b1c8d18-2a76-11e5-a26b-000c2976f3f3:1-177592',
22-
])
23-
);
24-
25-
/**
26-
* Class BenchmarkEventSubscribers
27-
* @package example
28-
*/
29-
class MyEventSubscribers extends EventSubscribers
30-
{
31-
/**
32-
* @param EventDTO $event (your own handler more in EventSubscribers class )
33-
*/
34-
public function allEvents(EventDTO $event)
35-
{
36-
// all events got __toString() implementation
37-
echo $event;
38-
39-
// all events got JsonSerializable implementation
40-
//echo json_encode($result, JSON_PRETTY_PRINT);
41-
42-
echo 'Memory usage ' . round(memory_get_usage() / 1048576, 2) . ' MB' . PHP_EOL;
43-
}
44-
}
45-
46-
// register your events handler here
47-
$binLogStream->registerSubscriber(new MyEventSubscribers());
48-
49-
// start consuming events
50-
while (1) {
51-
$binLogStream->binLogEvent();
1+
<?php
2+
3+
namespace example;
4+
5+
error_reporting(E_ALL);
6+
ini_set('display_errors', 1);
7+
date_default_timezone_set('UTC');
8+
include __DIR__ . '/../vendor/autoload.php';
9+
10+
use MySQLReplication\Config\ConfigService;
11+
use MySQLReplication\Event\DTO\EventDTO;
12+
use MySQLReplication\Event\EventSubscribers;
13+
use MySQLReplication\MySQLReplicationFactory;
14+
15+
$binLogStream = new MySQLReplicationFactory(
16+
(new ConfigService())->makeConfigFromArray([
17+
'user' => 'root',
18+
'ip' => '127.0.0.1',
19+
'password' => 'root',
20+
//'mariaDbGtid' => '1-1-3,0-1-88',
21+
//'gtid' => '9b1c8d18-2a76-11e5-a26b-000c2976f3f3:1-177592',
22+
])
23+
);
24+
25+
/**
26+
* Class BenchmarkEventSubscribers
27+
* @package example
28+
*/
29+
class MyEventSubscribers extends EventSubscribers
30+
{
31+
/**
32+
* @param EventDTO $event (your own handler more in EventSubscribers class )
33+
*/
34+
public function allEvents(EventDTO $event)
35+
{
36+
// all events got __toString() implementation
37+
echo $event;
38+
39+
// all events got JsonSerializable implementation
40+
//echo json_encode($result, JSON_PRETTY_PRINT);
41+
42+
echo 'Memory usage ' . round(memory_get_usage() / 1048576, 2) . ' MB' . PHP_EOL;
43+
}
44+
}
45+
46+
// register your events handler here
47+
$binLogStream->registerSubscriber(new MyEventSubscribers());
48+
49+
// start consuming events
50+
while (1) {
51+
$binLogStream->binLogEvent();
5252
}

src/MySQLReplication/Gtid/GtidService.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public function __construct()
1919
/**
2020
* @param string $gtids
2121
* @return GtidCollection
22+
* @throws GtidException
2223
*/
2324
public function makeCollectionFromString($gtids)
2425
{

src/MySQLReplication/MySQLReplicationFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace MySQLReplication;
34

45
use Doctrine\DBAL\Connection;
@@ -14,7 +15,6 @@
1415
use MySQLReplication\Event\EventSubscribers;
1516
use MySQLReplication\Event\RowEvent\RowEventService;
1617
use MySQLReplication\Exception\MySQLReplicationException;
17-
use MySQLReplication\Gtid\GtidCollection;
1818
use MySQLReplication\Gtid\GtidService;
1919
use MySQLReplication\Repository\MySQLRepository;
2020
use Symfony\Component\EventDispatcher\EventDispatcher;

src/MySQLReplication/Repository/MySQLRepository.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ class MySQLRepository
1313
/**
1414
* @var Connection
1515
*/
16-
private $conn;
16+
private $connection;
1717

1818
public function __construct(Connection $connection)
1919
{
20-
$this->conn = $connection;
20+
$this->connection = $connection;
2121
}
2222

2323
public function __destruct()
2424
{
25-
$this->conn->close();
25+
$this->connection->close();
2626
}
2727

2828
/**
@@ -56,12 +56,12 @@ public function getFields($schema, $table)
5656
*/
5757
public function getConnection()
5858
{
59-
if (false === $this->conn->ping()) {
60-
$this->conn->close();
61-
$this->conn->connect();
59+
if (false === $this->connection->ping()) {
60+
$this->connection->close();
61+
$this->connection->connect();
6262
}
6363

64-
return $this->conn;
64+
return $this->connection;
6565
}
6666

6767
/**

0 commit comments

Comments
 (0)