Skip to content

Commit ee037c6

Browse files
committed
comments update, minor changes
1 parent a7452d6 commit ee037c6

36 files changed

+216
-198
lines changed

src/MySQLReplication/BinLog/BinLogAuth.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
namespace MySQLReplication\BinLog;
44

55
/**
6-
* Class PackAuth
6+
* Class BinLogAuth
7+
* @package MySQLReplication\BinLog
78
*/
89
class BinLogAuth
910
{

src/MySQLReplication/BinLog/BinLogConnect.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
use MySQLReplication\Gtid\GtidCollection;
1111

1212
/**
13-
* Class Connect
13+
* Class BinLogConnect
14+
* @package MySQLReplication\BinLog
1415
*/
1516
class BinLogConnect
1617
{
@@ -151,15 +152,16 @@ public function getPacket($checkForOkByte = true)
151152
public function isWriteSuccessful($packet)
152153
{
153154
$head = ord($packet[0]);
154-
if (in_array($head, $this->packageOkHeader))
155+
if (in_array($head, $this->packageOkHeader, true))
155156
{
156157
return ['status' => true, 'code' => 0, 'msg' => ''];
157158
}
158159
else
159160
{
160161
$error_code = unpack('v', $packet[1] . $packet[2])[1];
161162
$error_msg = '';
162-
for ($i = 9; $i < strlen($packet); $i++)
163+
$packetLength = strlen($packet);
164+
for ($i = 9; $i < $packetLength; $i++)
163165
{
164166
$error_msg .= $packet[$i];
165167
}

src/MySQLReplication/BinLog/BinLogServerInfo.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace MySQLReplication\BinLog;
44

55
/**
6-
* Class ServerInfo
7-
* @package MySQLReplication\Pack
6+
* Class BinLogServerInfo
7+
* @package MySQLReplication\BinLog
88
*/
99
class BinLogServerInfo
1010
{
@@ -50,31 +50,31 @@ public static function parsePackage($pack)
5050
{
5151
self::$serverInfo['salt'] .= $pack[$j];
5252
}
53-
$i = $i + 8;
53+
$i += 8;
5454

5555
//filler_1 (1) -- 0x00
5656
$i++;
5757

5858
//capability_flag_1 (2) -- lower 2 bytes of the Protocol::CapabilityFlags (optional)
59-
$i = $i + 2;
59+
$i += 2;
6060

6161
//character_set (1) -- default server character-set, only the lower 8-bits Protocol::CharacterSet (optional)
6262
self::$serverInfo['character_set'] = $pack[$i];
6363
$i++;
6464

6565
//status_flags (2) -- Protocol::StatusFlags (optional)
66-
$i = $i + 2;
66+
$i += 2;
6767

6868
//capability_flags_2 (2) -- upper 2 bytes of the Protocol::CapabilityFlags
69-
$i = $i + 2;
69+
$i += 2;
7070

7171
//auth_plugin_data_len (1) -- length of the combined auth_plugin_data, if auth_plugin_data_len is > 0
7272
$salt_len = ord($pack[$i]);
7373
$i++;
7474

7575
$salt_len = max(12, $salt_len - 9);
7676

77-
$i = $i + 10;
77+
$i += 10;
7878

7979
//next salt
8080
if ($length >= $i + $salt_len)

src/MySQLReplication/BinLog/Exception/BinLogException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
use MySQLReplication\Exception\MySQLReplicationException;
66

7+
/**
8+
* Class BinLogException
9+
* @package MySQLReplication\BinLog\Exception
10+
*/
711
class BinLogException extends MySQLReplicationException
812
{
913
}

src/MySQLReplication/BinaryDataReader/BinaryDataReaderBuilder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
namespace MySQLReplication\BinaryDataReader;
44

5+
/**
6+
* Class BinaryDataReaderBuilder
7+
* @package MySQLReplication\BinaryDataReader
8+
*/
59
class BinaryDataReaderBuilder
610
{
711
private $binaryData = '';

src/MySQLReplication/BinaryDataReader/BinaryDataReaderService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
namespace MySQLReplication\BinaryDataReader;
44

55
/**
6-
* Class PackageService
6+
* Class BinaryDataReaderService
77
* @package MySQLReplication\BinaryDataReader
88
*/
99
class BinaryDataReaderService
1010
{
1111
/**
12-
* @param string $binaryData
12+
* @param $binaryData
1313
* @return BinaryDataReader
1414
*/
1515
public function makePackageFromBinaryData($binaryData)

src/MySQLReplication/BinaryDataReader/Exception/BinaryDataReaderException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
use MySQLReplication\Exception\MySQLReplicationException;
66

7+
/**
8+
* Class BinaryDataReaderException
9+
* @package MySQLReplication\BinaryDataReader\Exception
10+
*/
711
class BinaryDataReaderException extends MySQLReplicationException
812
{
913
}

src/MySQLReplication/Config/ConfigBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace MySQLReplication\Config;
44

55
/**
6-
* Class Config
6+
* Class ConfigBuilder
77
* @package MySQLReplication\Config
88
*/
99
class ConfigBuilder

src/MySQLReplication/Config/ConfigService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace MySQLReplication\Config;
44

55
/**
6-
* Class ConfigFactory
6+
* Class ConfigService
77
* @package MySQLReplication\Config
88
*/
99
class ConfigService

src/MySQLReplication/Config/Exception/ConfigException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
use MySQLReplication\Exception\MySQLReplicationException;
66

7+
/**
8+
* Class ConfigException
9+
* @package MySQLReplication\Config\Exception
10+
*/
711
class ConfigException extends MySQLReplicationException
812
{
913
const USER_ERROR_MESSAGE = 'Incorrect user given';

src/MySQLReplication/Definitions/ConstCapabilityFlags.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
namespace MySQLReplication\Definitions;
44

55
/**
6-
* Capability flags
6+
* Class ConstCapabilityFlags
7+
* @package MySQLReplication\Definitions
78
* http://dev.mysql.com/doc/internals/en/capability-flags.html#packet-protocol::capabilityflags
89
* https://github.com/siddontang/mixer/blob/master/doc/protocol.txt
910
*/

src/MySQLReplication/Definitions/ConstEventsNames.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
namespace MySQLReplication\Definitions;
44

5+
/**
6+
* Class ConstEventsNames
7+
* @package MySQLReplication\Definitions
8+
*/
59
class ConstEventsNames
610
{
711
const TABLE_MAP = 'tableMap';

src/MySQLReplication/Event/DTO/EventDTO.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
/**
88
* Class EventDTO
99
* @package MySQLReplication\DTO
10+
*
11+
* @see https://dev.mysql.com/doc/internals/en/event-meanings.html
1012
*/
1113
abstract class EventDTO implements \JsonSerializable
1214
{

src/MySQLReplication/Event/DTO/GTIDLogDTO.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
use MySQLReplication\Event\EventInfo;
77

88
/**
9-
* Class GTIDLogEventDTO
10-
* @package MySQLReplication\DTO
9+
* Class GTIDLogDTO
10+
* @package MySQLReplication\Event\DTO
1111
*/
12-
class GTIDLogDTO extends EventDTO implements \JsonSerializable
12+
class GTIDLogDTO extends EventDTO
1313
{
1414
/**
1515
* @var bool
@@ -27,8 +27,8 @@ class GTIDLogDTO extends EventDTO implements \JsonSerializable
2727
/**
2828
* GTIDLogEventDTO constructor.
2929
* @param EventInfo $eventInfo
30-
* @param $commit
31-
* @param $gtid
30+
* @param bool $commit
31+
* @param string $gtid
3232
*/
3333
public function __construct(
3434
EventInfo $eventInfo,

src/MySQLReplication/Event/DTO/QueryDTO.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
use MySQLReplication\Event\EventInfo;
77

88
/**
9-
* Class QueryEventDTO
10-
* @package MySQLReplication\DTO
9+
* Class QueryDTO
10+
* @package MySQLReplication\Event\DTO
1111
*/
12-
class QueryDTO extends EventDTO implements \JsonSerializable
12+
class QueryDTO extends EventDTO
1313
{
1414
/**
1515
* @var int
@@ -31,9 +31,9 @@ class QueryDTO extends EventDTO implements \JsonSerializable
3131
/**
3232
* QueryEventDTO constructor.
3333
* @param EventInfo $eventInfo
34-
* @param $database
35-
* @param $executionTime
36-
* @param $query
34+
* @param string $database
35+
* @param int $executionTime
36+
* @param string $query
3737
*/
3838
public function __construct(
3939
EventInfo $eventInfo,
@@ -49,7 +49,7 @@ public function __construct(
4949
}
5050

5151
/**
52-
* @return mixed
52+
* @return string
5353
*/
5454
public function getDatabase()
5555
{

src/MySQLReplication/Event/DTO/RotateDTO.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Class RotateDTO
1010
* @package MySQLReplication\DTO
1111
*/
12-
class RotateDTO extends EventDTO implements \JsonSerializable
12+
class RotateDTO extends EventDTO
1313
{
1414
/**
1515
* @var int

src/MySQLReplication/Event/DTO/RowsDTO.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Class RowsDTO
1010
* @package MySQLReplication\DTO
1111
*/
12-
abstract class RowsDTO extends EventDTO implements \JsonSerializable
12+
abstract class RowsDTO extends EventDTO
1313
{
1414
/**
1515
* @var array
@@ -28,7 +28,7 @@ abstract class RowsDTO extends EventDTO implements \JsonSerializable
2828
* GTIDLogEventDTO constructor.
2929
* @param EventInfo $eventInfo
3030
* @param TableMap $tableMap
31-
* @param $changedRows
31+
* @param int $changedRows
3232
* @param array $values
3333
*/
3434
public function __construct(

src/MySQLReplication/Event/DTO/TableMapDTO.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Class TableMapDTO
1111
* @package MySQLReplication\DTO
1212
*/
13-
class TableMapDTO extends EventDTO implements \JsonSerializable
13+
class TableMapDTO extends EventDTO
1414
{
1515
/**
1616
* @var string

src/MySQLReplication/Event/DTO/XidDTO.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66
use MySQLReplication\Event\EventInfo;
77

88
/**
9-
* Class Xid
10-
* @package MySQLReplication\DTO
9+
* Class XidDTO
10+
* @package MySQLReplication\Event\DTO
1111
*/
12-
class XidDTO extends EventDTO implements \JsonSerializable
12+
class XidDTO extends EventDTO
1313
{
1414
/**
1515
* @var string
1616
*/
1717
private $type = ConstEventsNames::XID;
1818
/**
19-
* @var
19+
* @var string
2020
*/
2121
private $xid;
2222

2323
/**
2424
* GTIDLogEventDTO constructor.
2525
* @param EventInfo $eventInfo
26-
* @param $xid
26+
* @param string $xid
2727
*/
2828
public function __construct(
2929
EventInfo $eventInfo,
@@ -35,7 +35,7 @@ public function __construct(
3535
}
3636

3737
/**
38-
* @return mixed
38+
* @return string
3939
*/
4040
public function getXid()
4141
{

0 commit comments

Comments
 (0)