mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-19 03:35:12 +00:00
Merge pull request #375 from bantu/php5-construct
Change constructors from class name to __construct(). * bantu/php5-construct: Change constructors from class name to __construct(). Check for old-style constructor names via Code Sniffer.
This commit is contained in:
commit
c5421e3493
@ -45,6 +45,9 @@
|
||||
<!-- All code files MUST use only UTF-8 without BOM. -->
|
||||
<rule ref="Generic.Files.ByteOrderMark" />
|
||||
|
||||
<!-- Constructors MUST be called __construct() instead of after the class. -->
|
||||
<rule ref="Generic.NamingConventions.ConstructorName" />
|
||||
|
||||
<!-- Each file MUST end with exactly one newline character -->
|
||||
<rule ref="PSR2.Files.EndFileNewline" />
|
||||
|
||||
|
@ -109,7 +109,7 @@ define('CRYPT_AES_MODE_OFB', CRYPT_MODE_OFB);
|
||||
|
||||
/**#@+
|
||||
* @access private
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @see Crypt_Base::__construct()
|
||||
*/
|
||||
/**
|
||||
* Toggles the internal implementation
|
||||
|
@ -98,7 +98,7 @@ define('CRYPT_MODE_STREAM', 5);
|
||||
|
||||
/**#@+
|
||||
* @access private
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @see Crypt_Base::__construct()
|
||||
*/
|
||||
/**
|
||||
* Base value for the internal implementation $engine switch
|
||||
@ -123,7 +123,7 @@ class Crypt_Base
|
||||
/**
|
||||
* The Encryption Mode
|
||||
*
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @see Crypt_Base::__construct()
|
||||
* @var Integer
|
||||
* @access private
|
||||
*/
|
||||
@ -312,7 +312,7 @@ class Crypt_Base
|
||||
/**
|
||||
* Is the mode one that is paddable?
|
||||
*
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @see Crypt_Base::__construct()
|
||||
* @var Boolean
|
||||
* @access private
|
||||
*/
|
||||
@ -387,7 +387,7 @@ class Crypt_Base
|
||||
* $aes = new Crypt_AES(CRYPT_AES_MODE_CFB); // $aes will operate in cfb mode
|
||||
* $aes = new Crypt_AES(CRYPT_MODE_CFB); // identical
|
||||
*
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @see Crypt_Base::__construct()
|
||||
* @var String
|
||||
* @access private
|
||||
*/
|
||||
@ -443,7 +443,7 @@ class Crypt_Base
|
||||
* @param optional Integer $mode
|
||||
* @access public
|
||||
*/
|
||||
function Crypt_Base($mode = CRYPT_MODE_CBC)
|
||||
function __construct($mode = CRYPT_MODE_CBC)
|
||||
{
|
||||
$const_crypt_mode = 'CRYPT_' . $this->const_namespace . '_MODE';
|
||||
|
||||
|
@ -103,7 +103,7 @@ define('CRYPT_BLOWFISH_MODE_OFB', CRYPT_MODE_OFB);
|
||||
|
||||
/**#@+
|
||||
* @access private
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @see Crypt_Base::__construct()
|
||||
*/
|
||||
/**
|
||||
* Toggles the internal implementation
|
||||
|
@ -123,7 +123,7 @@ define('CRYPT_DES_MODE_OFB', CRYPT_MODE_OFB);
|
||||
|
||||
/**#@+
|
||||
* @access private
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @see Crypt_Base::__construct()
|
||||
*/
|
||||
/**
|
||||
* Toggles the internal implementation
|
||||
|
@ -58,7 +58,7 @@ use \phpseclib\Math\BigInteger;
|
||||
|
||||
/**#@+
|
||||
* @access private
|
||||
* @see Crypt_Hash::Crypt_Hash()
|
||||
* @see Crypt_Hash::__construct()
|
||||
*/
|
||||
/**
|
||||
* Toggles the internal implementation
|
||||
@ -153,7 +153,7 @@ class Crypt_Hash
|
||||
* @return Crypt_Hash
|
||||
* @access public
|
||||
*/
|
||||
function Crypt_Hash($hash = 'sha1')
|
||||
function __construct($hash = 'sha1')
|
||||
{
|
||||
if ( !defined('CRYPT_HASH_MODE') ) {
|
||||
switch (true) {
|
||||
|
@ -101,7 +101,7 @@ define('CRYPT_RC2_MODE_OFB', CRYPT_MODE_OFB);
|
||||
|
||||
/**#@+
|
||||
* @access private
|
||||
* @see Crypt_RC2::Crypt_RC2()
|
||||
* @see Crypt_RC2::__construct()
|
||||
*/
|
||||
/**
|
||||
* Toggles the internal implementation
|
||||
@ -334,13 +334,13 @@ class Crypt_RC2 extends Crypt_Base
|
||||
*
|
||||
* If not explicitly set, CRYPT_RC2_MODE_CBC will be used.
|
||||
*
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @see Crypt_Base::__construct()
|
||||
* @param optional Integer $mode
|
||||
* @access public
|
||||
*/
|
||||
function Crypt_RC2($mode = CRYPT_RC2_MODE_CBC)
|
||||
function __construct($mode = CRYPT_RC2_MODE_CBC)
|
||||
{
|
||||
parent::Crypt_Base($mode);
|
||||
parent::__construct($mode);
|
||||
$this->setKey('');
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ if (!class_exists('Crypt_Base')) {
|
||||
|
||||
/**#@+
|
||||
* @access private
|
||||
* @see Crypt_RC4::Crypt_RC4()
|
||||
* @see Crypt_RC4::__construct()
|
||||
*/
|
||||
/**
|
||||
* Toggles the internal implementation
|
||||
@ -172,13 +172,13 @@ class Crypt_RC4 extends Crypt_Base
|
||||
*
|
||||
* Determines whether or not the mcrypt extension should be used.
|
||||
*
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @see Crypt_Base::__construct()
|
||||
* @return Crypt_RC4
|
||||
* @access public
|
||||
*/
|
||||
function Crypt_RC4()
|
||||
function __construct()
|
||||
{
|
||||
parent::Crypt_Base(CRYPT_MODE_STREAM);
|
||||
parent::__construct(CRYPT_MODE_STREAM);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,7 +155,7 @@ define('CRYPT_RSA_ASN1_SEQUENCE', 48);
|
||||
|
||||
/**#@+
|
||||
* @access private
|
||||
* @see Crypt_RSA::Crypt_RSA()
|
||||
* @see Crypt_RSA::__construct()
|
||||
*/
|
||||
/**
|
||||
* To use the pure-PHP implementation
|
||||
@ -473,7 +473,7 @@ class Crypt_RSA
|
||||
* @return Crypt_RSA
|
||||
* @access public
|
||||
*/
|
||||
function Crypt_RSA()
|
||||
function __construct()
|
||||
{
|
||||
$this->configFile = CRYPT_RSA_OPENSSL_CONFIG;
|
||||
|
||||
|
@ -120,7 +120,7 @@ define('CRYPT_RIJNDAEL_MODE_OFB', CRYPT_MODE_OFB);
|
||||
|
||||
/**#@+
|
||||
* @access private
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @see Crypt_Base::__construct()
|
||||
*/
|
||||
/**
|
||||
* Toggles the internal implementation
|
||||
|
@ -181,18 +181,18 @@ class Crypt_TripleDES extends Crypt_DES
|
||||
*
|
||||
* If not explicitly set, CRYPT_DES_MODE_CBC will be used.
|
||||
*
|
||||
* @see Crypt_DES::Crypt_DES()
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @see Crypt_DES::__construct()
|
||||
* @see Crypt_Base::__construct()
|
||||
* @param optional Integer $mode
|
||||
* @access public
|
||||
*/
|
||||
function Crypt_TripleDES($mode = CRYPT_DES_MODE_CBC)
|
||||
function __construct($mode = CRYPT_DES_MODE_CBC)
|
||||
{
|
||||
switch ($mode) {
|
||||
// In case of CRYPT_DES_MODE_3CBC, we init as CRYPT_DES_MODE_CBC
|
||||
// and additional flag us internally as 3CBC
|
||||
case CRYPT_DES_MODE_3CBC:
|
||||
parent::Crypt_DES(CRYPT_DES_MODE_CBC);
|
||||
parent::__construct(CRYPT_DES_MODE_CBC);
|
||||
$this->mode_3cbc = true;
|
||||
|
||||
// This three $des'es will do the 3CBC work (if $key > 64bits)
|
||||
@ -209,7 +209,7 @@ class Crypt_TripleDES extends Crypt_DES
|
||||
break;
|
||||
// If not 3CBC, we init as usual
|
||||
default:
|
||||
parent::Crypt_DES($mode);
|
||||
parent::__construct($mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ define('CRYPT_TWOFISH_MODE_OFB', CRYPT_MODE_OFB);
|
||||
|
||||
/**#@+
|
||||
* @access private
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @see Crypt_Base::__construct()
|
||||
*/
|
||||
/**
|
||||
* Toggles the internal implementation
|
||||
|
@ -211,7 +211,7 @@ class File_ANSI
|
||||
* @return File_ANSI
|
||||
* @access public
|
||||
*/
|
||||
function File_ANSI()
|
||||
function __construct()
|
||||
{
|
||||
$this->setHistory(200);
|
||||
$this->setDimensions(80, 24);
|
||||
|
@ -133,7 +133,7 @@ class File_ASN1_Element
|
||||
* @return File_ASN1_Element
|
||||
* @access public
|
||||
*/
|
||||
function File_ASN1_Element($encoded)
|
||||
function __construct($encoded)
|
||||
{
|
||||
$this->element = $encoded;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ class File_X509
|
||||
* @return File_X509
|
||||
* @access public
|
||||
*/
|
||||
function File_X509()
|
||||
function __construct()
|
||||
{
|
||||
// Explicitly Tagged Module, 1988 Syntax
|
||||
// http://tools.ietf.org/html/rfc5280#appendix-A.1
|
||||
|
@ -122,7 +122,7 @@ class Net_SCP
|
||||
* @return Net_SCP
|
||||
* @access public
|
||||
*/
|
||||
function Net_SCP($ssh)
|
||||
function __construct($ssh)
|
||||
{
|
||||
if (!is_object($ssh)) {
|
||||
return;
|
||||
|
@ -124,7 +124,7 @@ class Net_SFTP extends Net_SSH2
|
||||
/**
|
||||
* Packet Types
|
||||
*
|
||||
* @see Net_SFTP::Net_SFTP()
|
||||
* @see Net_SFTP::__construct()
|
||||
* @var Array
|
||||
* @access private
|
||||
*/
|
||||
@ -133,7 +133,7 @@ class Net_SFTP extends Net_SSH2
|
||||
/**
|
||||
* Status Codes
|
||||
*
|
||||
* @see Net_SFTP::Net_SFTP()
|
||||
* @see Net_SFTP::__construct()
|
||||
* @var Array
|
||||
* @access private
|
||||
*/
|
||||
@ -245,7 +245,7 @@ class Net_SFTP extends Net_SSH2
|
||||
/**
|
||||
* Max SFTP Packet Size
|
||||
*
|
||||
* @see Net_SFTP::Net_SFTP()
|
||||
* @see Net_SFTP::__construct()
|
||||
* @see Net_SFTP::get()
|
||||
* @var Array
|
||||
* @access private
|
||||
@ -283,9 +283,9 @@ class Net_SFTP extends Net_SSH2
|
||||
* @return Net_SFTP
|
||||
* @access public
|
||||
*/
|
||||
function Net_SFTP($host, $port = 22, $timeout = 10)
|
||||
function __construct($host, $port = 22, $timeout = 10)
|
||||
{
|
||||
parent::Net_SSH2($host, $port, $timeout);
|
||||
parent::__construct($host, $port, $timeout);
|
||||
|
||||
$this->max_sftp_packet = 1 << 15;
|
||||
|
||||
|
@ -131,7 +131,7 @@ class Net_SFTP_Stream
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function Net_SFTP_Stream()
|
||||
function __construct()
|
||||
{
|
||||
if (defined('NET_SFTP_STREAM_LOGGING')) {
|
||||
echo "__construct()\r\n";
|
||||
|
@ -360,7 +360,7 @@ class Net_SSH1
|
||||
/**
|
||||
* Protocol Flags
|
||||
*
|
||||
* @see Net_SSH1::Net_SSH1()
|
||||
* @see Net_SSH1::__construct()
|
||||
* @var Array
|
||||
* @access private
|
||||
*/
|
||||
@ -463,7 +463,7 @@ class Net_SSH1
|
||||
/**
|
||||
* Hostname
|
||||
*
|
||||
* @see Net_SSH1::Net_SSH1()
|
||||
* @see Net_SSH1::__construct()
|
||||
* @see Net_SSH1::_connect()
|
||||
* @var String
|
||||
* @access private
|
||||
@ -473,7 +473,7 @@ class Net_SSH1
|
||||
/**
|
||||
* Port Number
|
||||
*
|
||||
* @see Net_SSH1::Net_SSH1()
|
||||
* @see Net_SSH1::__construct()
|
||||
* @see Net_SSH1::_connect()
|
||||
* @var Integer
|
||||
* @access private
|
||||
@ -488,7 +488,7 @@ class Net_SSH1
|
||||
* however, is non-optional. There will be a timeout, whether or not you set it. If you don't it'll be
|
||||
* 10 seconds. It is used by fsockopen() in that function.
|
||||
*
|
||||
* @see Net_SSH1::Net_SSH1()
|
||||
* @see Net_SSH1::__construct()
|
||||
* @see Net_SSH1::_connect()
|
||||
* @var Integer
|
||||
* @access private
|
||||
@ -498,7 +498,7 @@ class Net_SSH1
|
||||
/**
|
||||
* Default cipher
|
||||
*
|
||||
* @see Net_SSH1::Net_SSH1()
|
||||
* @see Net_SSH1::__construct()
|
||||
* @see Net_SSH1::_connect()
|
||||
* @var Integer
|
||||
* @access private
|
||||
@ -517,7 +517,7 @@ class Net_SSH1
|
||||
* @return Net_SSH1
|
||||
* @access public
|
||||
*/
|
||||
function Net_SSH1($host, $port = 22, $timeout = 10, $cipher = NET_SSH1_CIPHER_3DES)
|
||||
function __construct($host, $port = 22, $timeout = 10, $cipher = NET_SSH1_CIPHER_3DES)
|
||||
{
|
||||
// Include Crypt_Random
|
||||
// the class_exists() will only be called if the crypt_random_string function hasn't been defined and
|
||||
@ -1333,7 +1333,7 @@ class Net_SSH1
|
||||
* should be a number with the property that gcd($e, ($p - 1) * ($q - 1)) == 1. Could just make anything that
|
||||
* calls this call modexp, instead, but I think this makes things clearer, maybe...
|
||||
*
|
||||
* @see Net_SSH1::Net_SSH1()
|
||||
* @see Net_SSH1::__construct()
|
||||
* @param Math_BigInteger $m
|
||||
* @param Array $key
|
||||
* @return Math_BigInteger
|
||||
|
@ -299,7 +299,7 @@ class Net_SSH2
|
||||
*
|
||||
* -- http://tools.ietf.org/html/rfc4253#section-6
|
||||
*
|
||||
* @see Net_SSH2::Net_SSH2()
|
||||
* @see Net_SSH2::__construct()
|
||||
* @see Net_SSH2::_send_binary_packet()
|
||||
* @var Integer
|
||||
* @access private
|
||||
@ -309,7 +309,7 @@ class Net_SSH2
|
||||
/**
|
||||
* Block Size for Client to Server Encryption
|
||||
*
|
||||
* @see Net_SSH2::Net_SSH2()
|
||||
* @see Net_SSH2::__construct()
|
||||
* @see Net_SSH2::_get_binary_packet()
|
||||
* @var Integer
|
||||
* @access private
|
||||
@ -403,7 +403,7 @@ class Net_SSH2
|
||||
/**
|
||||
* Message Numbers
|
||||
*
|
||||
* @see Net_SSH2::Net_SSH2()
|
||||
* @see Net_SSH2::__construct()
|
||||
* @var Array
|
||||
* @access private
|
||||
*/
|
||||
@ -412,7 +412,7 @@ class Net_SSH2
|
||||
/**
|
||||
* Disconnection Message 'reason codes' defined in RFC4253
|
||||
*
|
||||
* @see Net_SSH2::Net_SSH2()
|
||||
* @see Net_SSH2::__construct()
|
||||
* @var Array
|
||||
* @access private
|
||||
*/
|
||||
@ -421,7 +421,7 @@ class Net_SSH2
|
||||
/**
|
||||
* SSH_MSG_CHANNEL_OPEN_FAILURE 'reason codes', defined in RFC4254
|
||||
*
|
||||
* @see Net_SSH2::Net_SSH2()
|
||||
* @see Net_SSH2::__construct()
|
||||
* @var Array
|
||||
* @access private
|
||||
*/
|
||||
@ -431,7 +431,7 @@ class Net_SSH2
|
||||
* Terminal Modes
|
||||
*
|
||||
* @link http://tools.ietf.org/html/rfc4254#section-8
|
||||
* @see Net_SSH2::Net_SSH2()
|
||||
* @see Net_SSH2::__construct()
|
||||
* @var Array
|
||||
* @access private
|
||||
*/
|
||||
@ -441,7 +441,7 @@ class Net_SSH2
|
||||
* SSH_MSG_CHANNEL_EXTENDED_DATA's data_type_codes
|
||||
*
|
||||
* @link http://tools.ietf.org/html/rfc4254#section-5.2
|
||||
* @see Net_SSH2::Net_SSH2()
|
||||
* @see Net_SSH2::__construct()
|
||||
* @var Array
|
||||
* @access private
|
||||
*/
|
||||
@ -789,7 +789,7 @@ class Net_SSH2
|
||||
/**
|
||||
* Hostname
|
||||
*
|
||||
* @see Net_SSH2::Net_SSH2()
|
||||
* @see Net_SSH2::__construct()
|
||||
* @see Net_SSH2::_connect()
|
||||
* @var String
|
||||
* @access private
|
||||
@ -799,7 +799,7 @@ class Net_SSH2
|
||||
/**
|
||||
* Port Number
|
||||
*
|
||||
* @see Net_SSH2::Net_SSH2()
|
||||
* @see Net_SSH2::__construct()
|
||||
* @see Net_SSH2::_connect()
|
||||
* @var Integer
|
||||
* @access private
|
||||
@ -814,7 +814,7 @@ class Net_SSH2
|
||||
* however, is non-optional. There will be a timeout, whether or not you set it. If you don't it'll be
|
||||
* 10 seconds. It is used by fsockopen() and the initial stream_select in that function.
|
||||
*
|
||||
* @see Net_SSH2::Net_SSH2()
|
||||
* @see Net_SSH2::__construct()
|
||||
* @see Net_SSH2::_connect()
|
||||
* @var Integer
|
||||
* @access private
|
||||
@ -831,7 +831,7 @@ class Net_SSH2
|
||||
* @return Net_SSH2
|
||||
* @access public
|
||||
*/
|
||||
function Net_SSH2($host, $port = 22, $timeout = 10)
|
||||
function __construct($host, $port = 22, $timeout = 10)
|
||||
{
|
||||
if (!function_exists('crypt_random_string')) {
|
||||
include_once 'Crypt/Random.php';
|
||||
|
@ -115,7 +115,7 @@ class System_SSH_Agent_Identity
|
||||
* @return System_SSH_Agent_Identity
|
||||
* @access private
|
||||
*/
|
||||
function System_SSH_Agent_Identity($fsock)
|
||||
function __construct($fsock)
|
||||
{
|
||||
$this->fsock = $fsock;
|
||||
}
|
||||
@ -231,7 +231,7 @@ class System_SSH_Agent
|
||||
* @return System_SSH_Agent
|
||||
* @access public
|
||||
*/
|
||||
function System_SSH_Agent()
|
||||
function __construct()
|
||||
{
|
||||
switch (true) {
|
||||
case isset($_SERVER['SSH_AUTH_SOCK']):
|
||||
|
Loading…
Reference in New Issue
Block a user