Skip to content

Commit 9af9cf4

Browse files
committed
PSR-4 support for #70 plus PhpDoc
1 parent a0f07fa commit 9af9cf4

17 files changed

+259
-98
lines changed

Example.php renamed to Examples/Example.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
2-
require __DIR__ . '/SourceQuery/SourceQuery.class.php';
2+
require __DIR__ . '/../SourceQuery/bootstrap.php';
3+
4+
use xPaw\SourceQuery\SourceQuery;
35

46
// For the sake of this example
57
Header( 'Content-Type: text/plain' );

RconExample.php renamed to Examples/RconExample.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
2-
require __DIR__ . '/SourceQuery/SourceQuery.class.php';
2+
require __DIR__ . '/../SourceQuery/bootstrap.php';
3+
4+
use xPaw\SourceQuery\SourceQuery;
35

46
// For the sake of this example
57
Header( 'Content-Type: text/plain' );

View.php renamed to Examples/View.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
2-
require __DIR__ . '/SourceQuery/SourceQuery.class.php';
2+
require __DIR__ . '/../SourceQuery/bootstrap.php';
3+
4+
use xPaw\SourceQuery\SourceQuery;
35

46
// Edit this ->
57
define( 'SQ_SERVER_ADDR', 'localhost' );
@@ -56,7 +58,7 @@
5658
</head>
5759

5860
<body>
59-
<div class="container">
61+
<div class="container">
6062
<div class="jumbotron">
6163
<h1>Source Query PHP Class</h1>
6264

SourceQuery/Buffer.class.php renamed to SourceQuery/Buffer.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
<?php
22
/**
3-
* Class written by xPaw
3+
* @author Pavel Djundik <[email protected]>
44
*
5-
* Website: https://xpaw.me
6-
* GitHub: https://github.com/xPaw/PHP-Source-Query-Class
5+
* @link https://xpaw.me
6+
* @link https://github.com/xPaw/PHP-Source-Query-Class
7+
*
8+
* @license GNU Lesser General Public License, version 2.1
9+
*
10+
* @internal
11+
*/
12+
13+
namespace xPaw\SourceQuery;
14+
15+
/**
16+
* Class Buffer
17+
*
18+
* @package xPaw\SourceQuery
719
*/
8-
9-
class SourceQueryBuffer
20+
class Buffer
1021
{
1122
/**
1223
* Buffer
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
/**
3+
* @author Pavel Djundik <[email protected]>
4+
*
5+
* @link https://xpaw.me
6+
* @link https://github.com/xPaw/PHP-Source-Query-Class
7+
*
8+
* @license GNU Lesser General Public License, version 2.1
9+
*
10+
* @internal
11+
*/
12+
13+
namespace xPaw\SourceQuery\Exception;
14+
15+
class AuthenticationException extends SourceQueryException
16+
{
17+
const BAD_PASSWORD = 1;
18+
const BANNED = 2;
19+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* @author Pavel Djundik <[email protected]>
4+
*
5+
* @link https://xpaw.me
6+
* @link https://github.com/xPaw/PHP-Source-Query-Class
7+
*
8+
* @license GNU Lesser General Public License, version 2.1
9+
*
10+
* @internal
11+
*/
12+
13+
namespace xPaw\SourceQuery\Exception;
14+
15+
class InvalidArgumentException extends SourceQueryException
16+
{
17+
const TIMEOUT_NOT_INTEGER = 1;
18+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
/**
3+
* @author Pavel Djundik <[email protected]>
4+
*
5+
* @link https://xpaw.me
6+
* @link https://github.com/xPaw/PHP-Source-Query-Class
7+
*
8+
* @license GNU Lesser General Public License, version 2.1
9+
*
10+
* @internal
11+
*/
12+
13+
namespace xPaw\SourceQuery\Exception;
14+
15+
class InvalidPacketException extends SourceQueryException
16+
{
17+
const PACKET_HEADER_MISMATCH = 1;
18+
const BUFFER_EMPTY = 2;
19+
const BUFFER_NOT_EMPTY = 3;
20+
const CHECKSUM_MISMATCH = 4;
21+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* @author Pavel Djundik <[email protected]>
4+
*
5+
* @link https://xpaw.me
6+
* @link https://github.com/xPaw/PHP-Source-Query-Class
7+
*
8+
* @license GNU Lesser General Public License, version 2.1
9+
*
10+
* @internal
11+
*/
12+
13+
namespace xPaw\SourceQuery\Exception;
14+
15+
class SocketException extends SourceQueryException
16+
{
17+
const COULD_NOT_CREATE_SOCKET = 1;
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* @author Pavel Djundik <[email protected]>
4+
*
5+
* @link https://xpaw.me
6+
* @link https://github.com/xPaw/PHP-Source-Query-Class
7+
*
8+
* @license GNU Lesser General Public License, version 2.1
9+
*
10+
* @internal
11+
*/
12+
13+
namespace xPaw\SourceQuery\Exception;
14+
15+
abstract class SourceQueryException extends \Exception
16+
{
17+
// Base exception class
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* @author Pavel Djundik <[email protected]>
4+
*
5+
* @link https://xpaw.me
6+
* @link https://github.com/xPaw/PHP-Source-Query-Class
7+
*
8+
* @license GNU Lesser General Public License, version 2.1
9+
*
10+
* @internal
11+
*/
12+
13+
namespace xPaw\SourceQuery\Exception;
14+
15+
class TimeoutException extends SourceQueryException
16+
{
17+
const TIMEOUT_CONNECT = 1;
18+
}

0 commit comments

Comments
 (0)