PSR-4 support for #70 plus PhpDoc
parent
a0f07fa801
commit
9af9cf4f6b
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require __DIR__ . '/SourceQuery/SourceQuery.class.php';
|
require __DIR__ . '/../SourceQuery/bootstrap.php';
|
||||||
|
|
||||||
|
use xPaw\SourceQuery\SourceQuery;
|
||||||
|
|
||||||
// For the sake of this example
|
// For the sake of this example
|
||||||
Header( 'Content-Type: text/plain' );
|
Header( 'Content-Type: text/plain' );
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require __DIR__ . '/SourceQuery/SourceQuery.class.php';
|
require __DIR__ . '/../SourceQuery/bootstrap.php';
|
||||||
|
|
||||||
|
use xPaw\SourceQuery\SourceQuery;
|
||||||
|
|
||||||
// For the sake of this example
|
// For the sake of this example
|
||||||
Header( 'Content-Type: text/plain' );
|
Header( 'Content-Type: text/plain' );
|
@ -1,12 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Class written by xPaw
|
* @author Pavel Djundik <sourcequery@xpaw.me>
|
||||||
*
|
*
|
||||||
* Website: https://xpaw.me
|
* @link https://xpaw.me
|
||||||
* GitHub: https://github.com/xPaw/PHP-Source-Query-Class
|
* @link https://github.com/xPaw/PHP-Source-Query-Class
|
||||||
|
*
|
||||||
|
* @license GNU Lesser General Public License, version 2.1
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace xPaw\SourceQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Buffer
|
||||||
|
*
|
||||||
|
* @package xPaw\SourceQuery
|
||||||
*/
|
*/
|
||||||
|
class Buffer
|
||||||
class SourceQueryBuffer
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Buffer
|
* Buffer
|
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Pavel Djundik <sourcequery@xpaw.me>
|
||||||
|
*
|
||||||
|
* @link https://xpaw.me
|
||||||
|
* @link https://github.com/xPaw/PHP-Source-Query-Class
|
||||||
|
*
|
||||||
|
* @license GNU Lesser General Public License, version 2.1
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace xPaw\SourceQuery\Exception;
|
||||||
|
|
||||||
|
class AuthenticationException extends SourceQueryException
|
||||||
|
{
|
||||||
|
const BAD_PASSWORD = 1;
|
||||||
|
const BANNED = 2;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Pavel Djundik <sourcequery@xpaw.me>
|
||||||
|
*
|
||||||
|
* @link https://xpaw.me
|
||||||
|
* @link https://github.com/xPaw/PHP-Source-Query-Class
|
||||||
|
*
|
||||||
|
* @license GNU Lesser General Public License, version 2.1
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace xPaw\SourceQuery\Exception;
|
||||||
|
|
||||||
|
class InvalidArgumentException extends SourceQueryException
|
||||||
|
{
|
||||||
|
const TIMEOUT_NOT_INTEGER = 1;
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Pavel Djundik <sourcequery@xpaw.me>
|
||||||
|
*
|
||||||
|
* @link https://xpaw.me
|
||||||
|
* @link https://github.com/xPaw/PHP-Source-Query-Class
|
||||||
|
*
|
||||||
|
* @license GNU Lesser General Public License, version 2.1
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace xPaw\SourceQuery\Exception;
|
||||||
|
|
||||||
|
class InvalidPacketException extends SourceQueryException
|
||||||
|
{
|
||||||
|
const PACKET_HEADER_MISMATCH = 1;
|
||||||
|
const BUFFER_EMPTY = 2;
|
||||||
|
const BUFFER_NOT_EMPTY = 3;
|
||||||
|
const CHECKSUM_MISMATCH = 4;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Pavel Djundik <sourcequery@xpaw.me>
|
||||||
|
*
|
||||||
|
* @link https://xpaw.me
|
||||||
|
* @link https://github.com/xPaw/PHP-Source-Query-Class
|
||||||
|
*
|
||||||
|
* @license GNU Lesser General Public License, version 2.1
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace xPaw\SourceQuery\Exception;
|
||||||
|
|
||||||
|
class SocketException extends SourceQueryException
|
||||||
|
{
|
||||||
|
const COULD_NOT_CREATE_SOCKET = 1;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Pavel Djundik <sourcequery@xpaw.me>
|
||||||
|
*
|
||||||
|
* @link https://xpaw.me
|
||||||
|
* @link https://github.com/xPaw/PHP-Source-Query-Class
|
||||||
|
*
|
||||||
|
* @license GNU Lesser General Public License, version 2.1
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace xPaw\SourceQuery\Exception;
|
||||||
|
|
||||||
|
abstract class SourceQueryException extends \Exception
|
||||||
|
{
|
||||||
|
// Base exception class
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Pavel Djundik <sourcequery@xpaw.me>
|
||||||
|
*
|
||||||
|
* @link https://xpaw.me
|
||||||
|
* @link https://github.com/xPaw/PHP-Source-Query-Class
|
||||||
|
*
|
||||||
|
* @license GNU Lesser General Public License, version 2.1
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace xPaw\SourceQuery\Exception;
|
||||||
|
|
||||||
|
class TimeoutException extends SourceQueryException
|
||||||
|
{
|
||||||
|
const TIMEOUT_CONNECT = 1;
|
||||||
|
}
|
@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Class written by xPaw
|
|
||||||
*
|
|
||||||
* Website: https://xpaw.me
|
|
||||||
* GitHub: https://github.com/xPaw/PHP-Source-Query-Class
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace xPaw\SourceQuery\Exception;
|
|
||||||
|
|
||||||
abstract class SourceQueryException extends \Exception
|
|
||||||
{
|
|
||||||
// Base exception class
|
|
||||||
}
|
|
||||||
|
|
||||||
class InvalidArgumentException extends SourceQueryException
|
|
||||||
{
|
|
||||||
const TIMEOUT_NOT_INTEGER = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
class TimeoutException extends SourceQueryException
|
|
||||||
{
|
|
||||||
const TIMEOUT_CONNECT = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
class InvalidPacketException extends SourceQueryException
|
|
||||||
{
|
|
||||||
const PACKET_HEADER_MISMATCH = 1;
|
|
||||||
const BUFFER_EMPTY = 2;
|
|
||||||
const BUFFER_NOT_EMPTY = 3;
|
|
||||||
const CHECKSUM_MISMATCH = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
class AuthenticationException extends SourceQueryException
|
|
||||||
{
|
|
||||||
const BAD_PASSWORD = 1;
|
|
||||||
const BANNED = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
class SocketException extends SourceQueryException
|
|
||||||
{
|
|
||||||
const COULD_NOT_CREATE_SOCKET = 1;
|
|
||||||
}
|
|
@ -1,28 +1,43 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Class written by xPaw
|
* @author Pavel Djundik <sourcequery@xpaw.me>
|
||||||
*
|
*
|
||||||
* Website: https://xpaw.me
|
* @link https://xpaw.me
|
||||||
* GitHub: https://github.com/xPaw/PHP-Source-Query-Class
|
* @link https://github.com/xPaw/PHP-Source-Query-Class
|
||||||
|
*
|
||||||
|
* @license GNU Lesser General Public License, version 2.1
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace xPaw\SourceQuery;
|
||||||
|
|
||||||
use xPaw\SourceQuery\Exception\AuthenticationException;
|
use xPaw\SourceQuery\Exception\AuthenticationException;
|
||||||
use xPaw\SourceQuery\Exception\TimeoutException;
|
use xPaw\SourceQuery\Exception\TimeoutException;
|
||||||
use xPaw\SourceQuery\Exception\InvalidPacketException;
|
use xPaw\SourceQuery\Exception\InvalidPacketException;
|
||||||
|
|
||||||
class SourceQuerySourceRcon
|
/**
|
||||||
|
* Class SourceRcon
|
||||||
|
*
|
||||||
|
* @package xPaw\SourceQuery
|
||||||
|
*
|
||||||
|
* @uses xPaw\SourceQuery\Exception\AuthenticationException
|
||||||
|
* @uses xPaw\SourceQuery\Exception\TimeoutException
|
||||||
|
* @uses xPaw\SourceQuery\Exception\InvalidPacketException
|
||||||
|
*/
|
||||||
|
class SourceRcon
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Points to buffer class
|
* Points to buffer class
|
||||||
*
|
*
|
||||||
* @var SourceQueryBuffer
|
* @var Buffer
|
||||||
*/
|
*/
|
||||||
private $Buffer;
|
private $Buffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Points to socket class
|
* Points to socket class
|
||||||
*
|
*
|
||||||
* @var SourceQuerySocket
|
* @var Socket
|
||||||
*/
|
*/
|
||||||
private $Socket;
|
private $Socket;
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Library to query servers that implement Source Engine Query protocol.
|
||||||
|
*
|
||||||
|
* Special thanks to koraktor for his awesome Steam Condenser class,
|
||||||
|
* I used it as a reference at some points.
|
||||||
|
*
|
||||||
|
* @author Pavel Djundik <sourcequery@xpaw.me>
|
||||||
|
*
|
||||||
|
* @link https://xpaw.me
|
||||||
|
* @link https://github.com/xPaw/PHP-Source-Query-Class
|
||||||
|
*
|
||||||
|
* @license GNU Lesser General Public License, version 2.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once __DIR__ . '/Exception/SourceQueryException.php';
|
||||||
|
require_once __DIR__ . '/Exception/AuthenticationException.php';
|
||||||
|
require_once __DIR__ . '/Exception/InvalidArgumentException.php';
|
||||||
|
require_once __DIR__ . '/Exception/SocketException.php';
|
||||||
|
require_once __DIR__ . '/Exception/InvalidPacketException.php';
|
||||||
|
require_once __DIR__ . '/Exception/TimeoutException.php';
|
||||||
|
|
||||||
|
require_once __DIR__ . '/Buffer.php';
|
||||||
|
require_once __DIR__ . '/Socket.php';
|
||||||
|
require_once __DIR__ . '/SourceRcon.php';
|
||||||
|
require_once __DIR__ . '/GoldSourceRcon.php';
|
||||||
|
require_once __DIR__ . '/SourceQuery.php';
|
Loading…
Reference in new issue