';
+ $open .= '';
}
if ($last_attr->foreground != 'white') {
$close = '' . $close;
@@ -482,7 +482,7 @@ class ANSI
}
if ($last_attr->background != $cur_attr->background) {
if ($cur_attr->background != 'black') {
- $open.= '';
+ $open .= '';
}
if ($last_attr->background != 'black') {
$close = '' . $close;
@@ -490,29 +490,29 @@ class ANSI
}
if ($last_attr->bold != $cur_attr->bold) {
if ($cur_attr->bold) {
- $open.= '';
+ $open .= '';
} else {
$close = '' . $close;
}
}
if ($last_attr->underline != $cur_attr->underline) {
if ($cur_attr->underline) {
- $open.= '';
+ $open .= '';
} else {
$close = '' . $close;
}
}
if ($last_attr->blink != $cur_attr->blink) {
if ($cur_attr->blink) {
- $open.= '';
diff --git a/phpseclib/File/ASN1.php b/phpseclib/File/ASN1.php
index 426f7780..92e498be 100644
--- a/phpseclib/File/ASN1.php
+++ b/phpseclib/File/ASN1.php
@@ -187,7 +187,7 @@ abstract class ASN1
* @var array
* @access public
*/
- const STRING_TYPE_SIZE = [
+ const STRING_TYPE_SIZE = [
self::TYPE_UTF8_STRING => 0,
self::TYPE_BMP_STRING => 2,
self::TYPE_UNIVERSAL_STRING => 4,
@@ -266,7 +266,7 @@ abstract class ASN1
} while ($loop);
}
- $start+= $startOffset;
+ $start += $startOffset;
// Length, as discussed in paragraph 8.1.3 of X.690-0207.pdf#page=13
if (!isset($encoded[$encoded_pos])) {
@@ -281,16 +281,16 @@ abstract class ASN1
} elseif ($length & 0x80) { // definite length, long form
// technically, the long form of the length can be represented by up to 126 octets (bytes), but we'll only
// support it up to four.
- $length&= 0x7F;
+ $length &= 0x7F;
$temp = substr($encoded, $encoded_pos, $length);
$encoded_pos += $length;
// tags of indefinte length don't really have a header length; this length includes the tag
- $current+= ['headerlength' => $length + 2];
- $start+= $length;
+ $current += ['headerlength' => $length + 2];
+ $start += $length;
extract(unpack('Nlength', substr(str_pad($temp, 4, chr(0), STR_PAD_LEFT), -4)));
/** @var integer $length */
} else {
- $current+= ['headerlength' => 2];
+ $current += ['headerlength' => 2];
}
if ($length > (strlen($encoded) - $encoded_pos)) {
@@ -335,13 +335,13 @@ abstract class ASN1
$length = $temp['length'];
// end-of-content octets - see paragraph 8.1.5
if (substr($content, $content_pos + $length, 2) == "\0\0") {
- $length+= 2;
- $start+= $length;
+ $length += 2;
+ $start += $length;
$newcontent[] = $temp;
break;
}
- $start+= $length;
- $remainingLength-= $length;
+ $start += $length;
+ $remainingLength -= $length;
$newcontent[] = $temp;
$content_pos += $length;
}
@@ -358,7 +358,7 @@ abstract class ASN1
] + $current;
}
- $current+= ['type' => $tag];
+ $current += ['type' => $tag];
// decode UNIVERSAL tags
switch ($tag) {
@@ -389,14 +389,14 @@ abstract class ASN1
if ($temp === false) {
return false;
}
- $length-= (strlen($content) - $content_pos);
+ $length -= (strlen($content) - $content_pos);
$last = count($temp) - 1;
for ($i = 0; $i < $last; $i++) {
// all subtags should be bit strings
if ($temp[$i]['type'] != self::TYPE_BIT_STRING) {
return false;
}
- $current['content'].= substr($temp[$i]['content'], 1);
+ $current['content'] .= substr($temp[$i]['content'], 1);
}
// all subtags should be bit strings
if ($temp[$last]['type'] != self::TYPE_BIT_STRING) {
@@ -421,11 +421,11 @@ abstract class ASN1
if ($temp['type'] != self::TYPE_OCTET_STRING) {
return false;
}
- $current['content'].= $temp['content'];
- $length+= $temp['length'];
+ $current['content'] .= $temp['content'];
+ $length += $temp['length'];
}
if (substr($content, $content_pos, 2) == "\0\0") {
- $length+= 2; // +2 for the EOC
+ $length += 2; // +2 for the EOC
}
}
break;
@@ -456,7 +456,7 @@ abstract class ASN1
}
$content_pos += $temp['length'];
$current['content'][] = $temp;
- $offset+= $temp['length'];
+ $offset += $temp['length'];
}
break;
case self::TYPE_OBJECT_IDENTIFIER:
@@ -512,7 +512,7 @@ abstract class ASN1
return false;
}
- $start+= $length;
+ $start += $length;
// ie. length is the length of the full TLV encoding - it's not just the length of the value
return $current + ['length' => $start - $current['start']];
@@ -664,7 +664,7 @@ abstract class ASN1
}
// Fail mapping if all input items have not been consumed.
- return $i < $n ? null: $map;
+ return $i < $n ? null : $map;
// the main diff between sets and sequences is the encapsulation of the foreach in another for loop
case self::TYPE_SET:
@@ -834,7 +834,7 @@ abstract class ASN1
{
$length = ord(Strings::shift($string));
if ($length & 0x80) { // definite length, long form
- $length&= 0x7F;
+ $length &= 0x7F;
$temp = Strings::shift($string, $length);
list(, $length) = unpack('N', substr(str_pad($temp, 4, chr(0), STR_PAD_LEFT), -4));
}
@@ -894,7 +894,7 @@ abstract class ASN1
switch ($tag) {
case self::TYPE_SET: // Children order is not important, thus process in sequence.
case self::TYPE_SEQUENCE:
- $tag|= 0x20; // set the constructed bit
+ $tag |= 0x20; // set the constructed bit
// ignore the min and max
if (isset($mapping['min']) && isset($mapping['max'])) {
@@ -906,7 +906,7 @@ abstract class ASN1
if ($temp === false) {
return false;
}
- $value[]= $temp;
+ $value[] = $temp;
}
/* "The encodings of the component values of a set-of value shall appear in ascending order, the encodings being compared
as octet strings with the shorter components being padded at their trailing end with 0-octets.
@@ -959,7 +959,7 @@ abstract class ASN1
$temp = $subtag . substr($temp, 1);
}
}
- $value.= $temp;
+ $value .= $temp;
}
break;
case self::TYPE_CHOICE:
@@ -1026,7 +1026,7 @@ abstract class ASN1
case self::TYPE_UTC_TIME:
case self::TYPE_GENERALIZED_TIME:
$format = $mapping['type'] == self::TYPE_UTC_TIME ? 'y' : 'Y';
- $format.= 'mdHis';
+ $format .= 'mdHis';
// if $source does _not_ include timezone information within it then assume that the timezone is GMT
$date = new \DateTime($source, new \DateTimeZone('GMT'));
// if $source _does_ include timezone information within it then convert the time to GMT
@@ -1060,7 +1060,7 @@ abstract class ASN1
$bits = implode('', array_pad($bits, $size + $offset + 1, 0));
$bytes = explode(' ', rtrim(chunk_split($bits, 8, ' ')));
foreach ($bytes as $byte) {
- $value.= chr(bindec($byte));
+ $value .= chr(bindec($byte));
}
break;
@@ -1255,7 +1255,7 @@ abstract class ASN1
}
$temp[strlen($temp) - 1] = $temp[strlen($temp) - 1] & chr(0x7F);
}
- $value.= $temp;
+ $value .= $temp;
}
return $value;
@@ -1293,7 +1293,7 @@ abstract class ASN1
$prefix = substr($content, 0, 2) >= 50 ? '19' : '20';
$content = $prefix . $content;
} elseif (strpos($content, '.') !== false) {
- $format.= '.u';
+ $format .= '.u';
}
if ($content[strlen($content) - 1] == 'Z') {
@@ -1301,7 +1301,7 @@ abstract class ASN1
}
if (strpos($content, '-') !== false || strpos($content, '+') !== false) {
- $format.= 'O';
+ $format .= 'O';
}
// error supression isn't necessary as of PHP 7.0:
@@ -1333,7 +1333,7 @@ abstract class ASN1
*/
public static function loadOIDs($oids)
{
- self::$reverseOIDs+= $oids;
+ self::$reverseOIDs += $oids;
self::$oids = array_flip(self::$reverseOIDs);
}
diff --git a/phpseclib/File/ASN1/Maps/Attribute.php b/phpseclib/File/ASN1/Maps/Attribute.php
index a80dad31..5e8f2614 100644
--- a/phpseclib/File/ASN1/Maps/Attribute.php
+++ b/phpseclib/File/ASN1/Maps/Attribute.php
@@ -30,7 +30,7 @@ abstract class Attribute
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'type' => AttributeType::MAP,
- 'value'=> [
+ 'value' => [
'type' => ASN1::TYPE_SET,
'min' => 1,
'max' => -1,
diff --git a/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php b/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php
index ff4faa07..da825d0b 100644
--- a/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php
+++ b/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php
@@ -30,7 +30,7 @@ abstract class AttributeTypeAndValue
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
'type' => AttributeType::MAP,
- 'value'=> AttributeValue::MAP
+ 'value' => AttributeValue::MAP
]
];
}
diff --git a/phpseclib/File/ASN1/Maps/Characteristic_two.php b/phpseclib/File/ASN1/Maps/Characteristic_two.php
index b73e0ba2..2645077b 100644
--- a/phpseclib/File/ASN1/Maps/Characteristic_two.php
+++ b/phpseclib/File/ASN1/Maps/Characteristic_two.php
@@ -37,4 +37,4 @@ abstract class Characteristic_two
]
]
];
-}
\ No newline at end of file
+}
diff --git a/phpseclib/File/ASN1/Maps/DSAPrivateKey.php b/phpseclib/File/ASN1/Maps/DSAPrivateKey.php
index eaec347d..7e61aecf 100644
--- a/phpseclib/File/ASN1/Maps/DSAPrivateKey.php
+++ b/phpseclib/File/ASN1/Maps/DSAPrivateKey.php
@@ -37,4 +37,4 @@ abstract class DSAPrivateKey
'x' => ['type' => ASN1::TYPE_INTEGER]
]
];
-}
\ No newline at end of file
+}
diff --git a/phpseclib/File/ASN1/Maps/FieldID.php b/phpseclib/File/ASN1/Maps/FieldID.php
index 13c6ac49..fe3a6716 100644
--- a/phpseclib/File/ASN1/Maps/FieldID.php
+++ b/phpseclib/File/ASN1/Maps/FieldID.php
@@ -36,4 +36,4 @@ abstract class FieldID
]
]
];
-}
\ No newline at end of file
+}
diff --git a/phpseclib/File/ASN1/Maps/HashAlgorithm.php b/phpseclib/File/ASN1/Maps/HashAlgorithm.php
index 02f587d1..d74ad593 100644
--- a/phpseclib/File/ASN1/Maps/HashAlgorithm.php
+++ b/phpseclib/File/ASN1/Maps/HashAlgorithm.php
@@ -27,4 +27,4 @@ use phpseclib3\File\ASN1;
abstract class HashAlgorithm
{
const MAP = AlgorithmIdentifier::MAP;
-}
\ No newline at end of file
+}
diff --git a/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php b/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php
index f4b35b38..a3a9c63c 100644
--- a/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php
+++ b/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php
@@ -60,7 +60,7 @@ abstract class IssuingDistributionPoint
'default' => false,
'implicit' => true
],
- 'onlyContainsAttributeCerts' =>[
+ 'onlyContainsAttributeCerts' => [
'type' => ASN1::TYPE_BOOLEAN,
'constant' => 5,
'optional' => true,
diff --git a/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php b/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php
index 5e0e26f0..115f1c53 100644
--- a/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php
+++ b/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php
@@ -27,4 +27,4 @@ use phpseclib3\File\ASN1;
abstract class MaskGenAlgorithm
{
const MAP = AlgorithmIdentifier::MAP;
-}
\ No newline at end of file
+}
diff --git a/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php b/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php
index 9a5c1687..dbc7f839 100644
--- a/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php
+++ b/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php
@@ -35,7 +35,7 @@ abstract class OneAsymmetricKey
'type' => ASN1::TYPE_INTEGER,
'mapping' => ['v1', 'v2']
],
- 'privateKeyAlgorithm'=> AlgorithmIdentifier::MAP,
+ 'privateKeyAlgorithm' => AlgorithmIdentifier::MAP,
'privateKey' => PrivateKey::MAP,
'attributes' => [
'constant' => 0,
diff --git a/phpseclib/File/ASN1/Maps/PBES2params.php b/phpseclib/File/ASN1/Maps/PBES2params.php
index 1d807db7..13befe91 100644
--- a/phpseclib/File/ASN1/Maps/PBES2params.php
+++ b/phpseclib/File/ASN1/Maps/PBES2params.php
@@ -31,7 +31,7 @@ abstract class PBES2params
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
- 'keyDerivationFunc'=> AlgorithmIdentifier::MAP,
+ 'keyDerivationFunc' => AlgorithmIdentifier::MAP,
'encryptionScheme' => AlgorithmIdentifier::MAP
]
];
diff --git a/phpseclib/File/ASN1/Maps/PBKDF2params.php b/phpseclib/File/ASN1/Maps/PBKDF2params.php
index 16d37a95..b6fbbdd3 100644
--- a/phpseclib/File/ASN1/Maps/PBKDF2params.php
+++ b/phpseclib/File/ASN1/Maps/PBKDF2params.php
@@ -33,8 +33,8 @@ abstract class PBKDF2params
'children' => [
// technically, this is a CHOICE in RFC2898 but the other "choice" is, currently, more of a placeholder
// in the RFC
- 'salt'=> ['type' => ASN1::TYPE_OCTET_STRING],
- 'iterationCount'=> ['type' => ASN1::TYPE_INTEGER],
+ 'salt' => ['type' => ASN1::TYPE_OCTET_STRING],
+ 'iterationCount' => ['type' => ASN1::TYPE_INTEGER],
'keyLength' => [
'type' => ASN1::TYPE_INTEGER,
'optional' => true
diff --git a/phpseclib/File/ASN1/Maps/PBMAC1params.php b/phpseclib/File/ASN1/Maps/PBMAC1params.php
index f375aa16..2b259671 100644
--- a/phpseclib/File/ASN1/Maps/PBMAC1params.php
+++ b/phpseclib/File/ASN1/Maps/PBMAC1params.php
@@ -31,8 +31,8 @@ abstract class PBMAC1params
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
- 'keyDerivationFunc'=> AlgorithmIdentifier::MAP,
- 'messageAuthScheme'=> AlgorithmIdentifier::MAP
+ 'keyDerivationFunc' => AlgorithmIdentifier::MAP,
+ 'messageAuthScheme' => AlgorithmIdentifier::MAP
]
];
}
diff --git a/phpseclib/File/ASN1/Maps/PKCS9String.php b/phpseclib/File/ASN1/Maps/PKCS9String.php
index 11c638bd..95d68c4b 100644
--- a/phpseclib/File/ASN1/Maps/PKCS9String.php
+++ b/phpseclib/File/ASN1/Maps/PKCS9String.php
@@ -1,7 +1,7 @@
* @access public
*/
-abstract class PKCS9String
+abstract class PKCS9String
{
const MAP = [
'type' => ASN1::TYPE_CHOICE,
diff --git a/phpseclib/File/ASN1/Maps/Pentanomial.php b/phpseclib/File/ASN1/Maps/Pentanomial.php
index 493cd299..1af566b8 100644
--- a/phpseclib/File/ASN1/Maps/Pentanomial.php
+++ b/phpseclib/File/ASN1/Maps/Pentanomial.php
@@ -34,4 +34,4 @@ abstract class Pentanomial
'k3' => ['type' => ASN1::TYPE_INTEGER], // k3 > h2
]
];
-}
\ No newline at end of file
+}
diff --git a/phpseclib/File/ASN1/Maps/Prime_p.php b/phpseclib/File/ASN1/Maps/Prime_p.php
index 09c8006b..4a57c463 100644
--- a/phpseclib/File/ASN1/Maps/Prime_p.php
+++ b/phpseclib/File/ASN1/Maps/Prime_p.php
@@ -27,4 +27,4 @@ use phpseclib3\File\ASN1;
abstract class Prime_p
{
const MAP = ['type' => ASN1::TYPE_INTEGER];
-}
\ No newline at end of file
+}
diff --git a/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php b/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php
index 170f6f27..3b5c8c60 100644
--- a/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php
+++ b/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php
@@ -33,7 +33,7 @@ abstract class PrivateKeyInfo
'type' => ASN1::TYPE_INTEGER,
'mapping' => ['v1']
],
- 'privateKeyAlgorithm'=> AlgorithmIdentifier::MAP,
+ 'privateKeyAlgorithm' => AlgorithmIdentifier::MAP,
'privateKey' => PrivateKey::MAP,
'attributes' => [
'constant' => 0,
diff --git a/phpseclib/File/ASN1/Maps/PublicKeyInfo.php b/phpseclib/File/ASN1/Maps/PublicKeyInfo.php
index 587230bc..81aea29e 100644
--- a/phpseclib/File/ASN1/Maps/PublicKeyInfo.php
+++ b/phpseclib/File/ASN1/Maps/PublicKeyInfo.php
@@ -32,7 +32,7 @@ abstract class PublicKeyInfo
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
- 'publicKeyAlgorithm'=> AlgorithmIdentifier::MAP,
+ 'publicKeyAlgorithm' => AlgorithmIdentifier::MAP,
'publicKey' => ['type' => ASN1::TYPE_BIT_STRING]
]
];
diff --git a/phpseclib/File/ASN1/Maps/RC2CBCParameter.php b/phpseclib/File/ASN1/Maps/RC2CBCParameter.php
index 3697f103..597f02df 100644
--- a/phpseclib/File/ASN1/Maps/RC2CBCParameter.php
+++ b/phpseclib/File/ASN1/Maps/RC2CBCParameter.php
@@ -31,11 +31,11 @@ abstract class RC2CBCParameter
const MAP = [
'type' => ASN1::TYPE_SEQUENCE,
'children' => [
- 'rc2ParametersVersion'=> [
+ 'rc2ParametersVersion' => [
'type' => ASN1::TYPE_INTEGER,
'optional' => true
],
- 'iv'=> ['type' => ASN1::TYPE_OCTET_STRING]
+ 'iv' => ['type' => ASN1::TYPE_OCTET_STRING]
]
];
}
diff --git a/phpseclib/File/ASN1/Maps/Trinomial.php b/phpseclib/File/ASN1/Maps/Trinomial.php
index 7cd4ba27..55e7be81 100644
--- a/phpseclib/File/ASN1/Maps/Trinomial.php
+++ b/phpseclib/File/ASN1/Maps/Trinomial.php
@@ -27,4 +27,4 @@ use phpseclib3\File\ASN1;
abstract class Trinomial
{
const MAP = ['type' => ASN1::TYPE_INTEGER];
-}
\ No newline at end of file
+}
diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php
index 5423407f..092bc720 100644
--- a/phpseclib/File/X509.php
+++ b/phpseclib/File/X509.php
@@ -334,7 +334,7 @@ class X509
//'id-ad' => '1.3.6.1.5.5.7.48',
'id-qt-cps' => '1.3.6.1.5.5.7.2.1',
'id-qt-unotice' => '1.3.6.1.5.5.7.2.2',
- 'id-ad-ocsp' =>'1.3.6.1.5.5.7.48.1',
+ 'id-ad-ocsp' => '1.3.6.1.5.5.7.48.1',
'id-ad-caIssuers' => '1.3.6.1.5.5.7.48.2',
'id-ad-timeStamping' => '1.3.6.1.5.5.7.48.3',
'id-ad-caRepository' => '1.3.6.1.5.5.7.48.5',
@@ -681,7 +681,7 @@ class X509
if ($value['extnId'] == $id) {
$extensions[$key] = $newext;
continue 2;
- }
+ }
}
}
$extensions[] = $newext;
@@ -1148,7 +1148,7 @@ class X509
$notBefore = new \DateTimeImmutable($notBefore, new \DateTimeZone(@date_default_timezone_get()));
$notAfter = new \DateTimeImmutable($notAfter, new \DateTimeZone(@date_default_timezone_get()));
- return $date >= $notBefore && $date<= $notAfter;
+ return $date >= $notBefore && $date <= $notAfter;
}
/**
@@ -1192,7 +1192,7 @@ class X509
if ($temp === false) {
return false;
}
- $data.= $temp;
+ $data .= $temp;
}
break;
@@ -1694,7 +1694,7 @@ class X509
$this->dn['rdnSequence'][] = [
[
'type' => $propName,
- 'value'=> $v
+ 'value' => $v
]
];
}
@@ -1827,7 +1827,7 @@ class X509
// handles everything else
$results = preg_split('#((?:^|, *|/)(?:C=|O=|OU=|CN=|L=|ST=|SN=|postalCode=|streetAddress=|emailAddress=|serialNumber=|organizationalUnitName=|title=|description=|role=|x500UniqueIdentifier=|postalAddress=))#', $dn, -1, PREG_SPLIT_DELIM_CAPTURE);
- for ($i = 1; $i < count($results); $i+=2) {
+ for ($i = 1; $i < count($results); $i += 2) {
$prop = trim($results[$i], ', =/');
$value = $results[$i + 1];
if (!$this->setDNProp($prop, $value, $type)) {
@@ -1949,7 +1949,7 @@ class X509
}
if (!$start) {
- $output.= $delim;
+ $output .= $delim;
}
if (is_array($value)) {
foreach ($value as $type => $v) {
@@ -1966,10 +1966,12 @@ class X509
$value = array_pop($value); // Always strip data type.
}
} elseif (is_object($value) && $value instanceof Element) {
- $callback = function($x) { return '\x' . bin2hex($x[0]); };
+ $callback = function ($x) {
+ return '\x' . bin2hex($x[0]);
+ };
$value = strtoupper(preg_replace_callback('#[^\x20-\x7E]#', $callback, $value->element));
}
- $output.= $desc . '=' . $value;
+ $output .= $desc . '=' . $value;
$result[$desc] = isset($result[$desc]) ?
array_merge((array) $result[$desc], [$value]) :
$value;
@@ -3457,7 +3459,7 @@ class X509
* @access public
* @return mixed
*/
- public function getExtension($id, $cert = null, $path=null)
+ public function getExtension($id, $cert = null, $path = null)
{
return $this->getExtensionHelper($id, $cert, $path);
}
@@ -3656,7 +3658,7 @@ class X509
$attributes[$last]['value'][] = $value;
break;
default:
- $attributes[] = ['type' => $id, 'value' => $disposition == self::ATTR_ALL ? $value: [$value]];
+ $attributes[] = ['type' => $id, 'value' => $disposition == self::ATTR_ALL ? $value : [$value]];
break;
}
@@ -4004,7 +4006,7 @@ class X509
if (is_array($rclist = $this->subArray($crl, 'tbsCertList/revokedCertificates'))) {
if (($i = $this->revokedCertificate($rclist, $serial)) !== false) {
- return $this->getExtension($id, $crl, "tbsCertList/revokedCertificates/$i/crlEntryExtensions");
+ return $this->getExtension($id, $crl, "tbsCertList/revokedCertificates/$i/crlEntryExtensions");
}
}
diff --git a/phpseclib/Math/BigInteger.php b/phpseclib/Math/BigInteger.php
index 6bc11261..68cdec6b 100644
--- a/phpseclib/Math/BigInteger.php
+++ b/phpseclib/Math/BigInteger.php
@@ -204,7 +204,7 @@ class BigInteger
*/
public function __toString()
{
- return (string) $this->value;
+ return (string)$this->value;
}
/**
@@ -248,7 +248,7 @@ class BigInteger
* @param bool $twos_compliment
* @return string
*/
- function toBits($twos_compliment = false)
+ public function toBits($twos_compliment = false)
{
return $this->value->toBits($twos_compliment);
}
@@ -270,7 +270,7 @@ class BigInteger
* @param BigInteger $y
* @return BigInteger
*/
- function subtract(BigInteger $y)
+ public function subtract(BigInteger $y)
{
return new static($this->value->subtract($y->value));
}
@@ -324,8 +324,9 @@ class BigInteger
* Calculates modular inverses.
*
* Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses.
- * @return BigInteger
+ *
* @param BigInteger $n
+ * @return BigInteger
*/
public function modInverse(BigInteger $n)
{
@@ -336,8 +337,9 @@ class BigInteger
* Calculates modular inverses.
*
* Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses.
- * @return BigInteger[]
+ *
* @param BigInteger $n
+ * @return BigInteger[]
*/
public function extendedGCD(BigInteger $n)
{
@@ -375,7 +377,7 @@ class BigInteger
*/
public function abs()
{
- return new static($this->value->abs());
+ return new static($this->value->abs());
}
/**
@@ -470,8 +472,8 @@ class BigInteger
/**
* Compares two numbers.
*
- * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is
- * demonstrated thusly:
+ * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this
+ * is demonstrated thusly:
*
* $x > $y: $x->compare($y) > 0
* $x < $y: $x->compare($y) < 0
@@ -612,7 +614,7 @@ class BigInteger
$class = self::$mainEngine;
extract($class::minMaxBits($bits));
/** @var BigInteger $min
- * @var BigInteger $max
+ * @var BigInteger $max
*/
return [
'min' => new static($min),
@@ -754,7 +756,9 @@ class BigInteger
public static function min(BigInteger ...$nums)
{
$class = self::$mainEngine;
- $nums = array_map(function($num) { return $num->value; }, $nums);
+ $nums = array_map(function ($num) {
+ return $num->value;
+ }, $nums);
return new static($class::min(...$nums));
}
@@ -767,7 +771,9 @@ class BigInteger
public static function max(BigInteger ...$nums)
{
$class = self::$mainEngine;
- $nums = array_map(function($num) { return $num->value; }, $nums);
+ $nums = array_map(function ($num) {
+ return $num->value;
+ }, $nums);
return new static($class::max(...$nums));
}
@@ -859,7 +865,7 @@ class BigInteger
public function createRecurringModuloFunction()
{
$func = $this->value->createRecurringModuloFunction();
- return function(BigInteger $x) use ($func) {
+ return function (BigInteger $x) use ($func) {
return new static($func($x->value));
};
}
@@ -874,7 +880,7 @@ class BigInteger
*/
public function bitwise_split($split)
{
- return array_map(function($val) {
+ return array_map(function ($val) {
return new static($val);
}, $this->value->bitwise_split($split));
}
diff --git a/phpseclib/Math/BigInteger/Engines/BCMath.php b/phpseclib/Math/BigInteger/Engines/BCMath.php
index 0c592b3d..01e1c1c0 100644
--- a/phpseclib/Math/BigInteger/Engines/BCMath.php
+++ b/phpseclib/Math/BigInteger/Engines/BCMath.php
@@ -89,8 +89,8 @@ class BCMath extends Engine
/**
* Test for engine validity
*
- * @see parent::__construct()
* @return bool
+ * @see parent::__construct()
*/
public static function isValidEngine()
{
@@ -102,8 +102,8 @@ class BCMath extends Engine
*
* @param mixed $x integer Base-10 number or base-$base number if $base set.
* @param int $base
- * @see parent::__construct()
* @return \phpseclib3\Math\BigInteger\Engines\BCMath
+ * @see parent::__construct()
*/
public function __construct($x = 0, $base = 10)
{
@@ -135,9 +135,15 @@ class BCMath extends Engine
$x = str_pad($this->value, $len, chr(0), STR_PAD_LEFT);
$this->value = '0';
- for ($i = 0; $i < $len; $i+= 4) {
+ for ($i = 0; $i < $len; $i += 4) {
$this->value = bcmul($this->value, '4294967296', 0); // 4294967296 == 2**32
- $this->value = bcadd($this->value, 0x1000000 * ord($x[$i]) + ((ord($x[$i + 1]) << 16) | (ord($x[$i + 2]) << 8) | ord($x[$i + 3])), 0);
+ $this->value = bcadd(
+ $this->value,
+ 0x1000000 * ord($x[$i]) + ((ord($x[$i + 1]) << 16) | (ord(
+ $x[$i + 2]
+ ) << 8) | ord($x[$i + 3])),
+ 0
+ );
}
if ($this->is_negative) {
@@ -153,7 +159,7 @@ class BCMath extends Engine
case 10:
// explicitly casting $x to a string is necessary, here, since doing $x[0] on -1 yields different
// results then doing it on '-1' does (modInverse does $x[0])
- $this->value = $this->value === '-' ? '0' : (string) $this->value;
+ $this->value = $this->value === '-' ? '0' : (string)$this->value;
}
}
@@ -177,7 +183,7 @@ class BCMath extends Engine
* @param bool $twos_compliment
* @return string
*/
- function toBytes($twos_compliment = false)
+ public function toBytes($twos_compliment = false)
{
if ($twos_compliment) {
return $this->toBytesHelper();
@@ -274,8 +280,8 @@ class BCMath extends Engine
*
* Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses.
*
- * @return false|BCMath
* @param \phpseclib3\Math\BigInteger\Engines\BCMath $n
+ * @return false|BCMath
*/
public function modInverse(BCMath $n)
{
@@ -325,8 +331,8 @@ class BCMath extends Engine
return [
'gcd' => $this->normalize(new static($u)),
- 'x' => $this->normalize(new static($a)),
- 'y' => $this->normalize(new static($b))
+ 'x' => $this->normalize(new static($a)),
+ 'y' => $this->normalize(new static($b))
];
}
@@ -428,8 +434,8 @@ class BCMath extends Engine
/**
* Compares two numbers.
*
- * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is
- * demonstrated thusly:
+ * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this
+ * is demonstrated thusly:
*
* $x > $y: $x->compare($y) > 0
* $x < $y: $x->compare($y) < 0
@@ -604,9 +610,9 @@ class BCMath extends Engine
*
* ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s));
*
- * @see self::isPrime()
* @param BCMath $r
* @return int
+ * @see self::isPrime()
*/
public static function scan1divide(BCMath $r)
{
@@ -672,8 +678,8 @@ class BCMath extends Engine
/**
* Set Bitmask
*
- * @return Engine
* @param int $bits
+ * @return Engine
* @see self::setPrecision()
*/
protected static function setBitmask($bits)
diff --git a/phpseclib/Math/BigInteger/Engines/BCMath/Base.php b/phpseclib/Math/BigInteger/Engines/BCMath/Base.php
index 0e189b70..1f7cdf53 100644
--- a/phpseclib/Math/BigInteger/Engines/BCMath/Base.php
+++ b/phpseclib/Math/BigInteger/Engines/BCMath/Base.php
@@ -113,4 +113,4 @@ abstract class Base extends BCMath
{
return static::reduce(bcmul($x, $x), $n);
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php b/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php
index f312be15..cda5e934 100644
--- a/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php
+++ b/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php
@@ -41,4 +41,4 @@ abstract class BuiltIn extends BCMath
return $x->normalize($temp);
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/BCMath/DefaultEngine.php b/phpseclib/Math/BigInteger/Engines/BCMath/DefaultEngine.php
index a6d175f5..0872da76 100644
--- a/phpseclib/Math/BigInteger/Engines/BCMath/DefaultEngine.php
+++ b/phpseclib/Math/BigInteger/Engines/BCMath/DefaultEngine.php
@@ -26,4 +26,4 @@ use phpseclib3\Math\BigInteger\Engines\BCMath\Reductions\Barrett;
*/
abstract class DefaultEngine extends Barrett
{
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/BCMath/OpenSSL.php b/phpseclib/Math/BigInteger/Engines/BCMath/OpenSSL.php
index df7c965d..093a605d 100644
--- a/phpseclib/Math/BigInteger/Engines/BCMath/OpenSSL.php
+++ b/phpseclib/Math/BigInteger/Engines/BCMath/OpenSSL.php
@@ -26,4 +26,4 @@ use phpseclib3\Math\BigInteger\Engines\OpenSSL as Progenitor;
*/
abstract class OpenSSL extends Progenitor
{
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php b/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php
index 2d8f6783..31d8272c 100644
--- a/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php
+++ b/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php
@@ -92,7 +92,7 @@ abstract class Barrett extends Base
$cache[self::DATA][] = [
'u' => $u, // m.length >> 1 (technically (m.length >> 1) + 1)
- 'm1'=> $m1 // m.length
+ 'm1' => $m1 // m.length
];
} else {
extract($cache[self::DATA][$key]);
diff --git a/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php b/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php
index 80acbdb5..d65e6d94 100644
--- a/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php
+++ b/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php
@@ -76,9 +76,9 @@ abstract class EvalBarrett extends Base
$m = "'$m'";
$u = "'$u'";
- $m1= "'$m1'";
+ $m1 = "'$m1'";
- $code.= '
+ $code .= '
$lsd = substr($n, -' . $cutoff . ');
$msd = substr($n, 0, -' . $cutoff . ');
@@ -109,4 +109,4 @@ abstract class EvalBarrett extends Base
return $func;
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/Engine.php b/phpseclib/Math/BigInteger/Engines/Engine.php
index 717a48cc..edcc5ecb 100644
--- a/phpseclib/Math/BigInteger/Engines/Engine.php
+++ b/phpseclib/Math/BigInteger/Engines/Engine.php
@@ -109,7 +109,7 @@ abstract class Engine
switch ($base) {
case -256:
- case 256:
+ case 256:
if ($base == -256 && (ord($x[0]) & 0x80)) {
$this->value = ~$x;
$this->is_negative = true;
@@ -126,7 +126,7 @@ abstract class Engine
}
break;
case -16:
- case 16:
+ case 16:
if ($base > 0 && $x[0] == '-') {
$this->is_negative = true;
$x = substr($x, 1);
@@ -149,7 +149,7 @@ abstract class Engine
}
break;
case -10:
- case 10:
+ case 10:
// (? 0 && $x[0] == '-') {
$this->is_negative = true;
$x = substr($x, 1);
@@ -494,9 +494,9 @@ abstract class Engine
}
if ($shift < 0) {
- $shift+= $precision;
+ $shift += $precision;
}
- $shift%= $precision;
+ $shift %= $precision;
if (!$shift) {
return clone $this;
@@ -1132,7 +1132,7 @@ abstract class Engine
}
return [
- 'gcd'=> $u,
+ 'gcd' => $u,
'x' => $a,
'y' => $b
];
diff --git a/phpseclib/Math/BigInteger/Engines/GMP.php b/phpseclib/Math/BigInteger/Engines/GMP.php
index cf848305..0e4f37f4 100644
--- a/phpseclib/Math/BigInteger/Engines/GMP.php
+++ b/phpseclib/Math/BigInteger/Engines/GMP.php
@@ -90,8 +90,8 @@ class GMP extends Engine
/**
* Test for engine validity
*
- * @see parent::__construct()
* @return bool
+ * @see parent::__construct()
*/
public static function isValidEngine()
{
@@ -103,8 +103,8 @@ class GMP extends Engine
*
* @param mixed $x integer Base-10 number or base-$base number if $base set.
* @param int $base
- * @see parent::__construct()
* @return \phpseclib3\Math\BigInteger\Engines\GMP
+ * @see parent::__construct()
*/
public function __construct($x = 0, $base = 10)
{
@@ -156,7 +156,7 @@ class GMP extends Engine
*/
public function toString()
{
- return (string) $this->value;
+ return (string)$this->value;
}
/**
@@ -191,7 +191,7 @@ class GMP extends Engine
* @param bool $twos_compliment
* @return string
*/
- function toBytes($twos_compliment = false)
+ public function toBytes($twos_compliment = false)
{
if ($twos_compliment) {
return $this->toBytesHelper();
@@ -278,8 +278,8 @@ class GMP extends Engine
/**
* Compares two numbers.
*
- * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is
- * demonstrated thusly:
+ * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this
+ * is demonstrated thusly:
*
* $x > $y: $x->compare($y) > 0
* $x < $y: $x->compare($y) < 0
@@ -352,8 +352,8 @@ class GMP extends Engine
return [
'gcd' => $this->normalize(new self($g)),
- 'x' => $this->normalize(new self($s)),
- 'y' => $this->normalize(new self($t))
+ 'x' => $this->normalize(new self($s)),
+ 'y' => $this->normalize(new self($t))
];
}
@@ -680,7 +680,7 @@ class GMP extends Engine
public function createRecurringModuloFunction()
{
$temp = $this->value;
- return function(GMP $x) use ($temp) {
+ return function (GMP $x) use ($temp) {
return new GMP($x->value % $temp);
};
}
@@ -744,4 +744,4 @@ class GMP extends Engine
return $temp;
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/GMP/DefaultEngine.php b/phpseclib/Math/BigInteger/Engines/GMP/DefaultEngine.php
index 9889271e..860a1837 100644
--- a/phpseclib/Math/BigInteger/Engines/GMP/DefaultEngine.php
+++ b/phpseclib/Math/BigInteger/Engines/GMP/DefaultEngine.php
@@ -41,4 +41,4 @@ abstract class DefaultEngine extends GMP
return $x->normalize($temp);
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/OpenSSL.php b/phpseclib/Math/BigInteger/Engines/OpenSSL.php
index 6109def7..25468e54 100644
--- a/phpseclib/Math/BigInteger/Engines/OpenSSL.php
+++ b/phpseclib/Math/BigInteger/Engines/OpenSSL.php
@@ -69,4 +69,4 @@ abstract class OpenSSL
$class = get_class($x);
return new $class($result, 256);
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP.php b/phpseclib/Math/BigInteger/Engines/PHP.php
index 599f967a..09560d1b 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP.php
@@ -34,7 +34,7 @@ abstract class PHP extends Engine
* multiply() or whatever, we'll just work directly on arrays, taking them in as parameters and returning them.
*
* @access protected
- */
+ */
/**
* $result[self::VALUE] contains the value.
*/
@@ -76,8 +76,8 @@ abstract class PHP extends Engine
*
* @param mixed $x integer Base-10 number or base-$base number if $base set.
* @param int $base
- * @see parent::__construct()
* @return \phpseclib3\Math\BigInteger\Engines\PHP
+ * @see parent::__construct()
*/
public function __construct($x = 0, $base = 10)
{
@@ -119,7 +119,12 @@ abstract class PHP extends Engine
$x = substr($x, 1);
}
- $x = str_pad($x, strlen($x) + ((static::MAX10LEN - 1) * strlen($x)) % static::MAX10LEN, 0, STR_PAD_LEFT);
+ $x = str_pad(
+ $x,
+ strlen($x) + ((static::MAX10LEN - 1) * strlen($x)) % static::MAX10LEN,
+ 0,
+ STR_PAD_LEFT
+ );
while (strlen($x)) {
$temp = $temp->multiply($multiplier);
$temp = $temp->add(new static($this->int2bytes(substr($x, 0, static::MAX10LEN)), 256));
@@ -165,7 +170,12 @@ abstract class PHP extends Engine
$result = '';
while (count($temp->value)) {
list($temp, $mod) = $temp->divide($divisor);
- $result = str_pad(isset($mod->value[0]) ? $mod->value[0] : '', static::MAX10LEN, '0', STR_PAD_LEFT) . $result;
+ $result = str_pad(
+ isset($mod->value[0]) ? $mod->value[0] : '',
+ static::MAX10LEN,
+ '0',
+ STR_PAD_LEFT
+ ) . $result;
}
$result = ltrim($result, '0');
if (empty($result)) {
@@ -199,7 +209,12 @@ abstract class PHP extends Engine
$result = implode('', array_map('chr', $result));
return $this->precision > 0 ?
- str_pad(substr($result, -(($this->precision + 7) >> 3)), ($this->precision + 7) >> 3, chr(0), STR_PAD_LEFT) :
+ str_pad(
+ substr($result, -(($this->precision + 7) >> 3)),
+ ($this->precision + 7) >> 3,
+ chr(0),
+ STR_PAD_LEFT
+ ) :
$result;
}
@@ -240,7 +255,7 @@ abstract class PHP extends Engine
$temp = self::subtractHelper($x_value, false, $y_value, false);
$temp[self::SIGN] = self::compareHelper($x_value, false, $y_value, false) > 0 ?
- $x_negative : $y_negative;
+ $x_negative : $y_negative;
return $temp;
}
@@ -256,7 +271,7 @@ abstract class PHP extends Engine
$value[count($value)] = 0; // just in case the carry adds an extra digit
$carry = 0;
- for ($i = 0, $j = 1; $j < $size; $i+=2, $j+=2) {
+ for ($i = 0, $j = 1; $j < $size; $i += 2, $j += 2) {
//$sum = $x_value[$j] * static::BASE_FULL + $x_value[$i] + $y_value[$j] * static::BASE_FULL + $y_value[$i] + $carry;
$sum = ($x_value[$j] + $y_value[$j]) * static::BASE_FULL + $x_value[$i] + $y_value[$i] + $carry;
$carry = $sum >= static::MAX_DIGIT2; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1
@@ -264,7 +279,7 @@ abstract class PHP extends Engine
$temp = static::BASE === 26 ? intval($sum / 0x4000000) : ($sum >> 31);
- $value[$i] = (int) ($sum - static::BASE_FULL * $temp); // eg. a faster alternative to fmod($sum, 0x4000000)
+ $value[$i] = (int)($sum - static::BASE_FULL * $temp); // eg. a faster alternative to fmod($sum, 0x4000000)
$value[$j] = $temp;
}
@@ -297,7 +312,7 @@ abstract class PHP extends Engine
* @param bool $y_negative
* @return array
*/
- static function subtractHelper(array $x_value, $x_negative, array $y_value, $y_negative)
+ public static function subtractHelper(array $x_value, $x_negative, array $y_value, $y_negative)
{
$x_size = count($x_value);
$y_size = count($y_value);
@@ -346,7 +361,7 @@ abstract class PHP extends Engine
// at this point, $x_value should be at least as big as - if not bigger than - $y_value
$carry = 0;
- for ($i = 0, $j = 1; $j < $y_size; $i+=2, $j+=2) {
+ for ($i = 0, $j = 1; $j < $y_size; $i += 2, $j += 2) {
$sum = ($x_value[$j] - $y_value[$j]) * static::BASE_FULL + $x_value[$i] - $y_value[$i] - $carry;
$carry = $sum < 0; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1
@@ -354,7 +369,7 @@ abstract class PHP extends Engine
$temp = static::BASE === 26 ? intval($sum / 0x4000000) : ($sum >> 31);
- $x_value[$i] = (int) ($sum - static::BASE_FULL * $temp);
+ $x_value[$i] = (int)($sum - static::BASE_FULL * $temp);
$x_value[$j] = $temp;
}
@@ -485,7 +500,7 @@ abstract class PHP extends Engine
for ($j = 0; $j < $x_length; ++$j) { // ie. $i = 0
$temp = $x_value[$j] * $y_value[0] + $carry; // $product_value[$k] == 0
$carry = static::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31);
- $product_value[$j] = (int) ($temp - static::BASE_FULL * $carry);
+ $product_value[$j] = (int)($temp - static::BASE_FULL * $carry);
}
$product_value[$j] = $carry;
@@ -498,7 +513,7 @@ abstract class PHP extends Engine
for ($j = 0, $k = $i; $j < $x_length; ++$j, ++$k) {
$temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry;
$carry = static::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31);
- $product_value[$k] = (int) ($temp - static::BASE_FULL * $carry);
+ $product_value[$k] = (int)($temp - static::BASE_FULL * $carry);
}
$product_value[$k] = $carry;
@@ -517,7 +532,8 @@ abstract class PHP extends Engine
*
* @param \phpseclib3\Math\BigInteger\engines\PHP $y
* @return array
- * @internal This function is based off of {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=9 HAC 14.20}.
+ * @internal This function is based off of
+ * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=9 HAC 14.20}.
*/
protected function divideHelper(PHP $y)
{
@@ -575,13 +591,13 @@ abstract class PHP extends Engine
static $temp, $lhs, $rhs;
if (!isset($temp)) {
$temp = new static();
- $lhs = new static();
- $rhs = new static();
+ $lhs = new static();
+ $rhs = new static();
}
- if (static::class != get_class($temp)) {
+ if (static::class != get_class($temp)) {
$temp = new static();
- $lhs = new static();
- $rhs = new static();
+ $lhs = new static();
+ $rhs = new static();
}
$temp_value = &$temp->value;
$rhs_value = &$rhs->value;
@@ -683,7 +699,7 @@ abstract class PHP extends Engine
for ($i = count($dividend) - 1; $i >= 0; --$i) {
$temp = static::BASE_FULL * $carry + $dividend[$i];
$result[$i] = self::safe_divide($temp, $divisor);
- $carry = (int) ($temp - $divisor * $result[$i]);
+ $carry = (int)($temp - $divisor * $result[$i]);
}
return [$result, $carry];
@@ -704,7 +720,7 @@ abstract class PHP extends Engine
private static function safe_divide($x, $y)
{
if (static::BASE === 26) {
- return (int) ($x / $y);
+ return (int)($x / $y);
}
// static::BASE === 31
@@ -886,7 +902,7 @@ abstract class PHP extends Engine
* @return array
*/
protected static function array_repeat($input, $multiplier)
- {
+ {
return $multiplier ? array_fill(0, $multiplier, $input) : [];
}
@@ -903,7 +919,7 @@ abstract class PHP extends Engine
return;
}
- $num_digits = (int) ($shift / static::BASE);
+ $num_digits = (int)($shift / static::BASE);
$shift %= static::BASE;
$shift = 1 << $shift;
@@ -912,7 +928,7 @@ abstract class PHP extends Engine
for ($i = 0; $i < count($this->value); ++$i) {
$temp = $this->value[$i] * $shift + $carry;
$carry = static::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31);
- $this->value[$i] = (int) ($temp - $carry * static::BASE_FULL);
+ $this->value[$i] = (int)($temp - $carry * static::BASE_FULL);
}
if ($carry) {
@@ -937,7 +953,7 @@ abstract class PHP extends Engine
return;
}
- $num_digits = (int) ($shift / static::BASE);
+ $num_digits = (int)($shift / static::BASE);
$shift %= static::BASE;
$carry_shift = static::BASE - $shift;
$carry_mask = (1 << $shift) - 1;
@@ -1009,13 +1025,13 @@ abstract class PHP extends Engine
$temp = $square_value[$i2] + $value[$i] * $value[$i];
$carry = static::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31);
- $square_value[$i2] = (int) ($temp - static::BASE_FULL * $carry);
+ $square_value[$i2] = (int)($temp - static::BASE_FULL * $carry);
// note how we start from $i+1 instead of 0 as we do in multiplication.
for ($j = $i + 1, $k = $i2 + 1; $j <= $max_index; ++$j, ++$k) {
$temp = $square_value[$k] + 2 * $value[$j] * $value[$i] + $carry;
$carry = static::BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31);
- $square_value[$k] = (int) ($temp - static::BASE_FULL * $carry);
+ $square_value[$k] = (int)($temp - static::BASE_FULL * $carry);
}
// the following line can yield values larger 2**15. at this point, PHP should switch
@@ -1108,9 +1124,9 @@ abstract class PHP extends Engine
*
* ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s));
*
- * @see self::isPrime()
* @param PHP $r
* @return int
+ * @see self::isPrime()
*/
public static function scan1divide(PHP $r)
{
@@ -1156,7 +1172,7 @@ abstract class PHP extends Engine
*/
public function isOdd()
{
- return (bool) ($this->value[0] & 1);
+ return (bool)($this->value[0] & 1);
}
/**
@@ -1173,7 +1189,7 @@ abstract class PHP extends Engine
return false;
}
- return (bool) ($this->value[$digit] & (1 << $bit));
+ return (bool)($this->value[$digit] & (1 << $bit));
}
/**
@@ -1215,7 +1231,7 @@ abstract class PHP extends Engine
throw new \RuntimeException('Offset must be greater than 1');
}
- $width = (int) ($split / static::BASE);
+ $width = (int)($split / static::BASE);
if (!$width) {
$arr = $this->bitwise_small_split($split);
return array_map(function ($digit) {
@@ -1234,7 +1250,7 @@ abstract class PHP extends Engine
$digit = [];
if (!$overflow) {
$digit = array_slice($val, $i, $width);
- $i+= $width;
+ $i += $width;
$overflow = $split % static::BASE;
if ($overflow) {
$mask = (1 << $overflow) - 1;
@@ -1244,9 +1260,9 @@ abstract class PHP extends Engine
} else {
$remaining = static::BASE - $overflow;
$tempsplit = $split - $remaining;
- $tempwidth = (int) ($tempsplit / static::BASE + 1);
+ $tempwidth = (int)($tempsplit / static::BASE + 1);
$digit = array_slice($val, $i, $tempwidth);
- $i+= $tempwidth;
+ $i += $tempwidth;
$tempoverflow = $tempsplit % static::BASE;
if ($tempoverflow) {
$tempmask = (1 << $tempoverflow) - 1;
@@ -1289,9 +1305,9 @@ abstract class PHP extends Engine
$remaining = static::BASE;
while ($i != $len) {
$digit = $val[$i] & $mask;
- $val[$i]>>= $split;
+ $val[$i] >>= $split;
if (!$overflow) {
- $remaining-= $split;
+ $remaining -= $split;
$overflow = $split <= $remaining ? 0 : $split - $remaining;
if (!$remaining) {
@@ -1299,10 +1315,10 @@ abstract class PHP extends Engine
$remaining = static::BASE;
$overflow = 0;
}
- } else if (++$i != $len) {
+ } elseif (++$i != $len) {
$tempmask = (1 << $overflow) - 1;
- $digit|= ($val[$i] & $tempmask) << $remaining;
- $val[$i]>>= $overflow;
+ $digit |= ($val[$i] & $tempmask) << $remaining;
+ $val[$i] >>= $overflow;
$remaining = static::BASE - $overflow;
$overflow = $split <= $remaining ? 0 : $split - $remaining;
}
@@ -1316,4 +1332,4 @@ abstract class PHP extends Engine
return array_reverse($vals);
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP/Base.php b/phpseclib/Math/BigInteger/Engines/PHP/Base.php
index fb781c94..cec7337b 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP/Base.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP/Base.php
@@ -94,7 +94,7 @@ abstract class Base extends PHP
}
if ($e->value == [2]) {
- $temp = new $class;
+ $temp = new $class();
$temp->value = $class::square($x->value);
list(, $temp) = $temp->divide($n);
return $x->normalize($temp);
@@ -146,4 +146,4 @@ abstract class Base extends PHP
{
return static::reduce($class::square($x), $n, $class);
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP/DefaultEngine.php b/phpseclib/Math/BigInteger/Engines/PHP/DefaultEngine.php
index 138deb1f..bf5934a7 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP/DefaultEngine.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP/DefaultEngine.php
@@ -26,4 +26,4 @@ use phpseclib3\Math\BigInteger\Engines\PHP\Reductions\EvalBarrett;
*/
abstract class DefaultEngine extends EvalBarrett
{
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP/Montgomery.php b/phpseclib/Math/BigInteger/Engines/PHP/Montgomery.php
index 5bee6d02..58334cc8 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP/Montgomery.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP/Montgomery.php
@@ -60,7 +60,7 @@ abstract class Montgomery extends Base
if ($n->value[$i]) {
$temp = decbin($n->value[$i]);
$j = strlen($temp) - strrpos($temp, '1') - 1;
- $j+= $class::BASE * $i;
+ $j += $class::BASE * $i;
break;
}
}
@@ -89,4 +89,4 @@ abstract class Montgomery extends Base
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP/OpenSSL.php b/phpseclib/Math/BigInteger/Engines/PHP/OpenSSL.php
index 1b7b5b40..4e0315eb 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP/OpenSSL.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP/OpenSSL.php
@@ -26,4 +26,4 @@ use phpseclib3\Math\BigInteger\Engines\OpenSSL as Progenitor;
*/
abstract class OpenSSL extends Progenitor
{
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php
index 03e0f8aa..e262adb2 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php
@@ -91,7 +91,7 @@ abstract class Barrett extends Base
$cache[self::DATA][] = [
'u' => $u, // m.length >> 1 (technically (m.length >> 1) + 1)
- 'm1'=> $m1 // m.length
+ 'm1' => $m1 // m.length
];
} else {
extract($cache[self::DATA][$key]);
@@ -281,4 +281,4 @@ abstract class Barrett extends Base
self::SIGN => $x_negative != $y_negative
];
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Classic.php b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Classic.php
index aef167de..95309fca 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Classic.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Classic.php
@@ -43,4 +43,4 @@ abstract class Classic extends Base
list(, $temp) = $lhs->divide($rhs);
return $temp->value;
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/EvalBarrett.php b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/EvalBarrett.php
index 84f21708..e45a261e 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/EvalBarrett.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/EvalBarrett.php
@@ -117,19 +117,19 @@ abstract class EvalBarrett extends Base
$lsd = array_slice($n, 0, ' . $cutoff . ');
$msd = array_slice($n, ' . $cutoff . ');';
- $code.= self::generateInlineTrim('msd');
- $code.= self::generateInlineMultiply('msd', $m1, 'temp', $class);
- $code.= self::generateInlineAdd('lsd', 'temp', 'n', $class);
+ $code .= self::generateInlineTrim('msd');
+ $code .= self::generateInlineMultiply('msd', $m1, 'temp', $class);
+ $code .= self::generateInlineAdd('lsd', 'temp', 'n', $class);
- $code.= '$temp = array_slice($n, ' . (count($m) - 1) . ');';
- $code.= self::generateInlineMultiply('temp', $u, 'temp2', $class);
- $code.= self::generateInlineTrim('temp2');
+ $code .= '$temp = array_slice($n, ' . (count($m) - 1) . ');';
+ $code .= self::generateInlineMultiply('temp', $u, 'temp2', $class);
+ $code .= self::generateInlineTrim('temp2');
- $code.= $class::BASE == 26 ?
+ $code .= $class::BASE == 26 ?
'$temp = array_slice($temp2, ' . (count($m) + 1) . ');' :
'$temp = array_slice($temp2, ' . ((count($m) >> 1) + 1) . ');';
- $code.= self::generateInlineMultiply('temp', $m, 'temp2', $class);
- $code.= self::generateInlineTrim('temp2');
+ $code .= self::generateInlineMultiply('temp', $m, 'temp2', $class);
+ $code .= self::generateInlineTrim('temp2');
/*
if ($class::BASE == 26) {
@@ -138,14 +138,14 @@ abstract class EvalBarrett extends Base
}
*/
- $code.= self::generateInlineSubtract2('n', 'temp2', 'temp', $class);
+ $code .= self::generateInlineSubtract2('n', 'temp2', 'temp', $class);
$subcode = self::generateInlineSubtract1('temp', $m, 'temp2', $class);
- $subcode.= '$temp = $temp2;';
+ $subcode .= '$temp = $temp2;';
- $code.= self::generateInlineCompare($m, 'temp', $subcode);
+ $code .= self::generateInlineCompare($m, 'temp', $subcode);
- $code.= 'return $temp;';
+ $code .= 'return $temp;';
eval('$func = function ($n) { ' . $code . '};');
@@ -198,51 +198,51 @@ abstract class EvalBarrett extends Base
$' . $output . ' = array_fill(0, $length + ' . count($arr) . ', 0);
$carry = 0;';
- for ($i = 0; $i < count($arr); $i++) {
- $regular.= '
+ for ($i = 0; $i < count($arr); $i++) {
+ $regular .= '
$subtemp = $' . $input . '[0] * ' . $arr[$i];
- $regular.= $i ? ' + $carry;' : ';';
+ $regular .= $i ? ' + $carry;' : ';';
- $regular.= '$carry = ';
- $regular.= $class::BASE === 26 ?
- 'intval($subtemp / 0x4000000);' :
- '$subtemp >> 31;';
- $regular.=
- '$' . $output . '[' . $i . '] = ';
+ $regular .= '$carry = ';
+ $regular .= $class::BASE === 26 ?
+ 'intval($subtemp / 0x4000000);' :
+ '$subtemp >> 31;';
+ $regular .=
+ '$' . $output . '[' . $i . '] = ';
if ($class::BASE === 26) {
- $regular.= '(int) (';
+ $regular .= '(int) (';
}
- $regular.= '$subtemp - ' . $class::BASE_FULL . ' * $carry';
- $regular.= $class::BASE === 26 ? ');' : ';';
+ $regular .= '$subtemp - ' . $class::BASE_FULL . ' * $carry';
+ $regular .= $class::BASE === 26 ? ');' : ';';
}
- $regular.= '$' . $output . '[' . count($arr) . '] = $carry;';
+ $regular .= '$' . $output . '[' . count($arr) . '] = $carry;';
- $regular.= '
+ $regular .= '
for ($i = 1; $i < $length; ++$i) {';
for ($j = 0; $j < count($arr); $j++) {
- $regular.= $j ? '$k++;' : '$k = $i;';
- $regular.= '
+ $regular .= $j ? '$k++;' : '$k = $i;';
+ $regular .= '
$subtemp = $' . $output . '[$k] + $' . $input . '[$i] * ' . $arr[$j];
- $regular.= $j ? ' + $carry;' : ';';
+ $regular .= $j ? ' + $carry;' : ';';
- $regular.= '$carry = ';
- $regular.= $class::BASE === 26 ?
+ $regular .= '$carry = ';
+ $regular .= $class::BASE === 26 ?
'intval($subtemp / 0x4000000);' :
'$subtemp >> 31;';
- $regular.=
+ $regular .=
'$' . $output . '[$k] = ';
if ($class::BASE === 26) {
- $regular.= '(int) (';
+ $regular .= '(int) (';
}
- $regular.= '$subtemp - ' . $class::BASE_FULL . ' * $carry';
- $regular.= $class::BASE === 26 ? ');' : ';';
+ $regular .= '$subtemp - ' . $class::BASE_FULL . ' * $carry';
+ $regular .= $class::BASE === 26 ? ');' : ';';
}
- $regular.= '$' . $output. '[++$k] = $carry; $carry = 0;';
+ $regular .= '$' . $output . '[++$k] = $carry; $carry = 0;';
- $regular.= '}}';
+ $regular .= '}}';
//if (count($arr) < 2 * self::KARATSUBA_CUTOFF) {
//}
@@ -273,10 +273,10 @@ abstract class EvalBarrett extends Base
$carry = $sum >= ' . self::float2string($class::MAX_DIGIT2) . ';
$sum = $carry ? $sum - ' . self::float2string($class::MAX_DIGIT2) . ' : $sum;';
- $code.= $class::BASE === 26 ?
+ $code .= $class::BASE === 26 ?
'$upper = intval($sum / 0x4000000); $' . $result . '[$i] = (int) ($sum - ' . $class::BASE_FULL . ' * $upper);' :
'$upper = $sum >> 31; $' . $result . '[$i] = $sum - ' . $class::BASE_FULL . ' * $upper;';
- $code.= '
+ $code .= '
$' . $result . '[$j] = $upper;
}
if ($j == $length) {
@@ -290,7 +290,7 @@ abstract class EvalBarrett extends Base
}
++$' . $result . '[$i];
}';
- $code.= self::generateInlineTrim($result);
+ $code .= self::generateInlineTrim($result);
return $code;
}
@@ -309,7 +309,7 @@ abstract class EvalBarrett extends Base
private static function generateInlineSubtract2($known, $unknown, $result, $class)
{
$code = '
- $' . $result .' = $' . $known . ';
+ $' . $result . ' = $' . $known . ';
$carry = 0;
$size = count($' . $unknown . ');
for ($i = 0, $j = 1; $j < $size; $i+= 2, $j+= 2) {
@@ -321,18 +321,18 @@ abstract class EvalBarrett extends Base
$sum+= ' . self::float2string($class::MAX_DIGIT2) . ';
}
$subtemp = ';
- $code.= $class::BASE === 26 ?
+ $code .= $class::BASE === 26 ?
'intval($sum / 0x4000000);' :
'$sum >> 31;';
- $code.= '$' . $result . '[$i] = ';
+ $code .= '$' . $result . '[$i] = ';
if ($class::BASE === 26) {
- $code.= '(int) (';
+ $code .= '(int) (';
}
- $code.= '$sum - ' . $class::BASE_FULL . ' * $subtemp';
+ $code .= '$sum - ' . $class::BASE_FULL . ' * $subtemp';
if ($class::BASE === 26) {
- $code.= ')';
+ $code .= ')';
}
- $code.= ';
+ $code .= ';
$' . $result . '[$j] = $subtemp;
}
if ($j == $size) {
@@ -349,7 +349,7 @@ abstract class EvalBarrett extends Base
--$' . $result . '[$i];
}';
- $code.= self::generateInlineTrim($result);
+ $code .= self::generateInlineTrim($result);
return $code;
}
@@ -368,52 +368,52 @@ abstract class EvalBarrett extends Base
private static function generateInlineSubtract1($unknown, array $known, $result, $class)
{
$code = '$' . $result . ' = $' . $unknown . ';';
- for ($i = 0, $j = 1; $j < count($known); $i+=2, $j+=2) {
- $code.= '$sum = $' . $unknown . '[' . $j . '] * ' . $class::BASE_FULL . ' + $' . $unknown . '[' . $i . '] - ';
- $code.= self::float2string($known[$j] * $class::BASE_FULL + $known[$i]);
+ for ($i = 0, $j = 1; $j < count($known); $i += 2, $j += 2) {
+ $code .= '$sum = $' . $unknown . '[' . $j . '] * ' . $class::BASE_FULL . ' + $' . $unknown . '[' . $i . '] - ';
+ $code .= self::float2string($known[$j] * $class::BASE_FULL + $known[$i]);
if ($i != 0) {
- $code.= ' - $carry';
+ $code .= ' - $carry';
}
- $code.= ';
+ $code .= ';
if ($carry = $sum < 0) {
$sum+= ' . self::float2string($class::MAX_DIGIT2) . ';
}
$subtemp = ';
- $code.= $class::BASE === 26 ?
+ $code .= $class::BASE === 26 ?
'intval($sum / 0x4000000);' :
'$sum >> 31;';
- $code.= '
+ $code .= '
$' . $result . '[' . $i . '] = ';
if ($class::BASE === 26) {
- $code.= ' (int) (';
+ $code .= ' (int) (';
}
- $code.= '$sum - ' . $class::BASE_FULL . ' * $subtemp';
+ $code .= '$sum - ' . $class::BASE_FULL . ' * $subtemp';
if ($class::BASE === 26) {
- $code.= ')';
+ $code .= ')';
}
- $code.= ';
+ $code .= ';
$' . $result . '[' . $j . '] = $subtemp;';
}
- $code.= '$i = ' . $i . ';';
+ $code .= '$i = ' . $i . ';';
if ($j == count($known)) {
- $code.= '
+ $code .= '
$sum = $' . $unknown . '[' . $i . '] - ' . $known[$i] . ' - $carry;
$carry = $sum < 0;
$' . $result . '[' . $i . '] = $carry ? $sum + ' . $class::BASE_FULL . ' : $sum;
++$i;';
}
- $code.= '
+ $code .= '
if ($carry) {
for (; !$' . $result . '[$i]; ++$i) {
$' . $result . '[$i] = ' . $class::MAX_DIGIT . ';
}
--$' . $result . '[$i];
}';
- $code.= self::generateInlineTrim($result);
+ $code .= self::generateInlineTrim($result);
return $code;
}
@@ -438,13 +438,13 @@ abstract class EvalBarrett extends Base
goto end_' . $uniqid . ';
case $clength > ' . count($known) . ':';
for ($i = count($known) - 1; $i >= 0; $i--) {
- $code.= '
+ $code .= '
case $' . $unknown . '[' . $i . '] > ' . $known[$i] . ':
goto subcode_' . $uniqid . ';
case $' . $unknown . '[' . $i . '] < ' . $known[$i] . ':
goto end_' . $uniqid . ';';
}
- $code.= '
+ $code .= '
default:
// do subcode
}
@@ -484,4 +484,4 @@ abstract class EvalBarrett extends Base
return $temp;
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Montgomery.php b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Montgomery.php
index 79db314d..e7364722 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Montgomery.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Montgomery.php
@@ -127,4 +127,4 @@ abstract class Montgomery extends Progenitor
($result * (2 - ($x * $result) % $class::BASE_FULL)) % $class::BASE_FULL;
return $result & $class::MAX_DIGIT;
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/MontgomeryMult.php b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/MontgomeryMult.php
index 0c21d034..54fd2bba 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/MontgomeryMult.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/MontgomeryMult.php
@@ -15,7 +15,6 @@
namespace phpseclib3\Math\BigInteger\Engines\PHP\Reductions;
-
/**
* PHP Montgomery Modular Exponentiation Engine with interleaved multiplication
*
@@ -77,4 +76,4 @@ abstract class MontgomeryMult extends Montgomery
}
return $a[self::VALUE];
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/PowerOfTwo.php b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/PowerOfTwo.php
index 73f133d0..c6ec026d 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP/Reductions/PowerOfTwo.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP/Reductions/PowerOfTwo.php
@@ -60,4 +60,4 @@ abstract class PowerOfTwo extends Base
$result = $lhs->bitwise_and($rhs->subtract($temp));
return $result->value;
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP32.php b/phpseclib/Math/BigInteger/Engines/PHP32.php
index e1d15554..169bd6d0 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP32.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP32.php
@@ -15,7 +15,6 @@
namespace phpseclib3\Math\BigInteger\Engines;
-
/**
* Pure-PHP 32-bit Engine.
*
@@ -110,7 +109,7 @@ class PHP32 extends PHP
}
while (true) {
- $i-= 4;
+ $i -= 4;
if ($i < 0) {
if ($i == -4) {
break;
@@ -125,10 +124,10 @@ class PHP32 extends PHP
list(, $digit) = unpack('N', substr($val, $i, 4));
$step = count($vals) & 3;
if ($step) {
- $digit>>= 2 * $step;
+ $digit >>= 2 * $step;
}
if ($step != 3) {
- $digit&= static::MAX_DIGIT;
+ $digit &= static::MAX_DIGIT;
$i++;
}
$vals[] = $digit;
@@ -414,4 +413,4 @@ class PHP32 extends PHP
{
return $this->compare($min) >= 0 && $this->compare($max) <= 0;
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BigInteger/Engines/PHP64.php b/phpseclib/Math/BigInteger/Engines/PHP64.php
index 08754d51..35b07fb7 100644
--- a/phpseclib/Math/BigInteger/Engines/PHP64.php
+++ b/phpseclib/Math/BigInteger/Engines/PHP64.php
@@ -15,7 +15,6 @@
namespace phpseclib3\Math\BigInteger\Engines;
-
/**
* Pure-PHP 64-bit Engine.
*
@@ -110,7 +109,7 @@ class PHP64 extends PHP
}
while (true) {
- $i-= 4;
+ $i -= 4;
if ($i < 0) {
if ($i == -4) {
break;
@@ -125,15 +124,15 @@ class PHP64 extends PHP
list(, $digit) = unpack('N', substr($val, $i, 4));
$step = count($vals) & 7;
if (!$step) {
- $digit&= static::MAX_DIGIT;
+ $digit &= static::MAX_DIGIT;
$i++;
} else {
$shift = 8 - $step;
- $digit>>= $shift;
+ $digit >>= $shift;
$shift = 32 - $shift;
- $digit&= (1 << $shift) - 1;
+ $digit &= (1 << $shift) - 1;
$temp = $i > 0 ? ord($val[$i - 1]) : 0;
- $digit|= ($temp << $shift) & 0x7F000000;
+ $digit |= ($temp << $shift) & 0x7F000000;
}
$vals[] = $digit;
}
@@ -418,4 +417,4 @@ class PHP64 extends PHP
{
return $this->compare($min) >= 0 && $this->compare($max) <= 0;
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BinaryField.php b/phpseclib/Math/BinaryField.php
index 096b482b..5c9d57d1 100644
--- a/phpseclib/Math/BinaryField.php
+++ b/phpseclib/Math/BinaryField.php
@@ -74,7 +74,7 @@ class BinaryField extends FiniteField
// implements algorithm 2.40 (in section 2.3.5) in "Guide to Elliptic Curve Cryptography"
// with W = 8
- $reduce = function($c) use ($u, $mStart, $m, $t, $finalMask, $pad, $h) {
+ $reduce = function ($c) use ($u, $mStart, $m, $t, $finalMask, $pad, $h) {
$c = str_pad($c, $pad, "\0", STR_PAD_LEFT);
for ($i = $mStart; $i >= $m;) {
$g = $h >> 3;
@@ -159,7 +159,7 @@ class BinaryField extends FiniteField
* Converts a base-2 string to a base-256 string
*
* @param string $x
- * @param integer $size
+ * @param integer $size
* @return string
*/
public static function base2ToBase256($x, $size = null)
@@ -192,4 +192,4 @@ class BinaryField extends FiniteField
return Strings::bin2bits($x);
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/BinaryField/Integer.php b/phpseclib/Math/BinaryField/Integer.php
index 8d176a93..0df47a57 100644
--- a/phpseclib/Math/BinaryField/Integer.php
+++ b/phpseclib/Math/BinaryField/Integer.php
@@ -216,7 +216,7 @@ class Integer extends Base
for ($i = 0; $i < strlen($y); $i++) {
if ($y[$i] == '1') {
$temp = $precomputed[$i & 7] . str_repeat("\0", $i >> 3);
- $result^= str_pad($temp, $size, "\0", STR_PAD_LEFT);
+ $result ^= str_pad($temp, $size, "\0", STR_PAD_LEFT);
}
}
@@ -304,10 +304,10 @@ class Integer extends Base
$z2 = ($x0 * $y2) ^ ($x1 * $y1) ^ ($x2 * $y0) ^ ($x3 * $y3);
$z3 = ($x0 * $y3) ^ ($x1 * $y2) ^ ($x2 * $y1) ^ ($x3 * $y0);
- $z0&= 0x1111111111111111;
- $z1&= 0x2222222222222222;
- $z2&= 0x4444444444444444;
- $z3&= -8608480567731124088; // 0x8888888888888888 gets interpreted as a float
+ $z0 &= 0x1111111111111111;
+ $z1 &= 0x2222222222222222;
+ $z2 &= 0x4444444444444444;
+ $z3 &= -8608480567731124088; // 0x8888888888888888 gets interpreted as a float
$z = $z0 | $z1 | $z2 | $z3;
@@ -517,4 +517,4 @@ class Integer extends Base
{
return ['value' => $this->toHex()];
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/Common/FiniteField.php b/phpseclib/Math/Common/FiniteField.php
index c2294a04..599959ff 100644
--- a/phpseclib/Math/Common/FiniteField.php
+++ b/phpseclib/Math/Common/FiniteField.php
@@ -23,4 +23,4 @@ namespace phpseclib3\Math\Common;
*/
abstract class FiniteField
{
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/Common/FiniteField/Integer.php b/phpseclib/Math/Common/FiniteField/Integer.php
index d163f552..ab968e26 100644
--- a/phpseclib/Math/Common/FiniteField/Integer.php
+++ b/phpseclib/Math/Common/FiniteField/Integer.php
@@ -23,4 +23,4 @@ namespace phpseclib3\Math\Common\FiniteField;
*/
abstract class Integer
{
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/PrimeField.php b/phpseclib/Math/PrimeField.php
index 7e15f906..d38991e0 100644
--- a/phpseclib/Math/PrimeField.php
+++ b/phpseclib/Math/PrimeField.php
@@ -119,4 +119,4 @@ class PrimeField extends FiniteField
{
Integer::cleanupCache($this->instanceID);
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Math/PrimeField/Integer.php b/phpseclib/Math/PrimeField/Integer.php
index 825aaf8e..71024882 100644
--- a/phpseclib/Math/PrimeField/Integer.php
+++ b/phpseclib/Math/PrimeField/Integer.php
@@ -405,4 +405,4 @@ class Integer extends Base
{
return ['value' => $this->toHex()];
}
-}
\ No newline at end of file
+}
diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php
index eaa403fa..b70073bd 100644
--- a/phpseclib/Net/SFTP.php
+++ b/phpseclib/Net/SFTP.php
@@ -600,7 +600,7 @@ class SFTP extends SSH2
if ($response === false) {
return false;
}
- } else if ($response === true && $this->isTimeout()) {
+ } elseif ($response === true && $this->isTimeout()) {
return false;
}
@@ -914,7 +914,7 @@ class SFTP extends SSH2
$dir = './';
// suffix a slash if needed
} elseif ($dir[strlen($dir) - 1] != '/') {
- $dir.= '/';
+ $dir .= '/';
}
$dir = $this->realpath($dir);
@@ -1207,8 +1207,8 @@ class SFTP extends SSH2
}
break;
case 'mode':
- $a[$sort]&= 07777;
- $b[$sort]&= 07777;
+ $a[$sort] &= 07777;
+ $b[$sort] &= 07777;
default:
if ($a[$sort] === $b[$sort]) {
break;
@@ -1246,7 +1246,7 @@ class SFTP extends SSH2
return;
}
$len = count($args) & 0x7FFFFFFE;
- for ($i = 0; $i < $len; $i+=2) {
+ for ($i = 0; $i < $len; $i += 2) {
$this->sortOptions[$args[$i]] = $args[$i + 1];
}
if (!count($this->sortOptions)) {
@@ -1389,7 +1389,7 @@ class SFTP extends SSH2
}
if (isset($stat['type'])) {
if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) {
- $filename.= '/.';
+ $filename .= '/.';
}
$this->update_stat_cache($filename, (object) ['stat' => $stat]);
return $stat;
@@ -1402,7 +1402,7 @@ class SFTP extends SSH2
$this->pwd = $pwd;
if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) {
- $filename.= '/.';
+ $filename .= '/.';
}
$this->update_stat_cache($filename, (object) ['stat' => $stat]);
@@ -1446,7 +1446,7 @@ class SFTP extends SSH2
}
if (isset($lstat['type'])) {
if ($lstat['type'] == NET_SFTP_TYPE_DIRECTORY) {
- $filename.= '/.';
+ $filename .= '/.';
}
$this->update_stat_cache($filename, (object) ['lstat' => $lstat]);
return $lstat;
@@ -1467,7 +1467,7 @@ class SFTP extends SSH2
$this->pwd = $pwd;
if ($lstat['type'] == NET_SFTP_TYPE_DIRECTORY) {
- $filename.= '/.';
+ $filename .= '/.';
}
$this->update_stat_cache($filename, (object) ['lstat' => $lstat]);
@@ -1555,10 +1555,10 @@ class SFTP extends SSH2
Strings::packSSH2('NQ2', NET_SFTP_ATTR_ACCESSTIME | NET_SFTP_ATTR_MODIFYTIME, $atime, $time);
$packet = Strings::packSSH2('s', $filename);
- $packet.= $this->version >= 5 ?
+ $packet .= $this->version >= 5 ?
pack('N2', 0, NET_SFTP_OPEN_OPEN_EXISTING) :
pack('N', NET_SFTP_OPEN_WRITE | NET_SFTP_OPEN_CREATE | NET_SFTP_OPEN_EXCL);
- $packet.= $attr;
+ $packet .= $attr;
$this->send_sftp_packet(NET_SFTP_OPEN, $packet);
@@ -1731,7 +1731,7 @@ class SFTP extends SSH2
}
$packet = Strings::packSSH2('s', $filename);
- $packet.= $this->version >= 4 ?
+ $packet .= $this->version >= 4 ?
pack('a*Ca*', substr($attr, 0, 4), NET_SFTP_TYPE_UNKNOWN, substr($attr, 4)) :
$attr;
$this->send_sftp_packet(NET_SFTP_SETSTAT, $packet);
@@ -1800,7 +1800,7 @@ class SFTP extends SSH2
}
} else {
$packet = Strings::packSSH2('s', $temp);
- $packet.= $this->version >= 4 ?
+ $packet .= $this->version >= 4 ?
pack('Ca*', NET_SFTP_TYPE_UNKNOWN, $attr) :
$attr;
$this->send_sftp_packet(NET_SFTP_SETSTAT, $packet);
@@ -1817,7 +1817,7 @@ class SFTP extends SSH2
}
$packet = Strings::packSSH2('s', $path);
- $packet.= $this->version >= 4 ?
+ $packet .= $this->version >= 4 ?
pack('Ca*', NET_SFTP_TYPE_UNKNOWN, $attr) :
$attr;
$this->send_sftp_packet(NET_SFTP_SETSTAT, $packet);
@@ -2134,14 +2134,14 @@ class SFTP extends SSH2
if ($this->version >= 5) {
$flags = NET_SFTP_OPEN_CREATE_TRUNCATE;
} else {
- $flags|= NET_SFTP_OPEN_TRUNCATE;
+ $flags |= NET_SFTP_OPEN_TRUNCATE;
}
}
$this->remove_from_stat_cache($remote_file);
$packet = Strings::packSSH2('s', $remote_file);
- $packet.= $this->version >= 5 ?
+ $packet .= $this->version >= 5 ?
pack('N3', 0, $flags, 0) :
pack('N2', $flags, 0);
$this->send_sftp_packet(NET_SFTP_OPEN, $packet);
@@ -2196,7 +2196,7 @@ class SFTP extends SSH2
if ($local_start >= 0) {
fseek($fp, $local_start);
- $size-= $local_start;
+ $size -= $local_start;
}
} elseif ($dataCallback) {
$size = 0;
@@ -2209,7 +2209,7 @@ class SFTP extends SSH2
$sftp_packet_size = $this->max_sftp_packet;
// make the SFTP packet be exactly the SFTP packet size by including the bytes in the NET_SFTP_WRITE packets "header"
- $sftp_packet_size-= strlen($handle) + 25;
+ $sftp_packet_size -= strlen($handle) + 25;
$i = $j = 0;
while ($dataCallback || ($size === 0 || $sent < $size)) {
if ($dataCallback) {
@@ -2234,7 +2234,7 @@ class SFTP extends SSH2
}
throw $e;
}
- $sent+= strlen($temp);
+ $sent += strlen($temp);
if (is_callable($progressCallback)) {
$progressCallback($sent);
}
@@ -2368,7 +2368,7 @@ class SFTP extends SSH2
}
$packet = Strings::packSSH2('s', $remote_file);
- $packet.= $this->version >= 5 ?
+ $packet .= $this->version >= 5 ?
pack('N3', 0, NET_SFTP_OPEN_OPEN_EXISTING, 0) :
pack('N2', NET_SFTP_OPEN_READ, 0);
$this->send_sftp_packet(NET_SFTP_OPEN, $packet);
@@ -2424,7 +2424,7 @@ class SFTP extends SSH2
throw $e;
}
$packet = null;
- $read+= $packet_size;
+ $read += $packet_size;
$i++;
}
@@ -2448,9 +2448,9 @@ class SFTP extends SSH2
switch ($this->packet_type) {
case NET_SFTP_DATA:
$temp = substr($response, 4);
- $offset+= strlen($temp);
+ $offset += strlen($temp);
if ($local_file === false) {
- $content.= $temp;
+ $content .= $temp;
} elseif (is_callable($local_file)) {
$local_file($temp);
} else {
@@ -2984,7 +2984,7 @@ class SFTP extends SSH2
SSH_FXP_RENAME_NATIVE 0x00000004
(none of these are currently supported) */
- $packet.= "\0\0\0\0";
+ $packet .= "\0\0\0\0";
}
$this->send_sftp_packet(NET_SFTP_RENAME, $packet);
@@ -3096,21 +3096,21 @@ class SFTP extends SSH2
list($attr['mode']) = Strings::unpackSSH2('N', $response);
$fileType = $this->parseMode($attr['mode']);
if ($this->version < 4 && $fileType !== false) {
- $attr+= ['type' => $fileType];
+ $attr += ['type' => $fileType];
}
break;
case NET_SFTP_ATTR_ACCESSTIME: // 0x00000008
if ($this->version >= 4) {
- $attr+= $this->parseTime('atime', $flags, $response);
+ $attr += $this->parseTime('atime', $flags, $response);
break;
}
list($attr['atime'], $attr['mtime']) = Strings::unpackSSH2('NN', $response);
break;
case NET_SFTP_ATTR_CREATETIME: // 0x00000010 (SFTPv4+)
- $attr+= $this->parseTime('createtime', $flags, $response);
+ $attr += $this->parseTime('createtime', $flags, $response);
break;
case NET_SFTP_ATTR_MODIFYTIME: // 0x00000020
- $attr+= $this->parseTime('mtime', $flags, $response);
+ $attr += $this->parseTime('mtime', $flags, $response);
break;
case NET_SFTP_ATTR_ACL: // 0x00000040
// access control list
@@ -3165,7 +3165,7 @@ class SFTP extends SSH2
case NET_SFTP_ATTR_CTIME: // 0x00008000
// 'ctime' contains the last time the file attributes were changed. The
// exact meaning of this field depends on the server.
- $attr+= $this->parseTime('ctime', $flags, $response);
+ $attr += $this->parseTime('ctime', $flags, $response);
break;
case NET_SFTP_ATTR_EXTENDED: // 0x80000000
list($count) = Strings::unpackSSH2('N', $response);
@@ -3275,7 +3275,7 @@ class SFTP extends SSH2
$packet = $this->use_request_id ?
pack('NCNa*', strlen($data) + 5, $type, $request_id, $data) :
- pack('NCa*', strlen($data) + 1, $type, $data);
+ pack('NCa*', strlen($data) + 1, $type, $data);
$start = microtime(true);
$result = $this->send_channel_packet(self::CHANNEL, $packet);
@@ -3362,7 +3362,7 @@ class SFTP extends SSH2
$this->packet_buffer = '';
return false;
}
- $this->packet_buffer.= $temp;
+ $this->packet_buffer .= $temp;
}
if (strlen($this->packet_buffer) < 4) {
throw new \RuntimeException('Packet is too small');
@@ -3371,7 +3371,7 @@ class SFTP extends SSH2
/** @var integer $length */
$tempLength = $length;
- $tempLength-= strlen($this->packet_buffer);
+ $tempLength -= strlen($this->packet_buffer);
// 256 * 1024 is what SFTP_MAX_MSG_LENGTH is set to in OpenSSH's sftp-common.h
if (!$this->allow_arbitrary_length_packets && !$this->use_request_id && $tempLength > 256 * 1024) {
@@ -3386,8 +3386,8 @@ class SFTP extends SSH2
$this->packet_buffer = '';
return false;
}
- $this->packet_buffer.= $temp;
- $tempLength-= strlen($temp);
+ $this->packet_buffer .= $temp;
+ $tempLength -= strlen($temp);
}
$stop = microtime(true);
@@ -3396,9 +3396,9 @@ class SFTP extends SSH2
if ($this->use_request_id) {
extract(unpack('Npacket_id', Strings::shift($this->packet_buffer, 4))); // remove the request id
- $length-= 5; // account for the request id and the packet type
+ $length -= 5; // account for the request id and the packet type
} else {
- $length-= 1; // account for the packet type
+ $length -= 1; // account for the packet type
}
$packet = Strings::shift($this->packet_buffer, $length);
diff --git a/phpseclib/Net/SFTP/Stream.php b/phpseclib/Net/SFTP/Stream.php
index 4bf201bc..ccee1593 100644
--- a/phpseclib/Net/SFTP/Stream.php
+++ b/phpseclib/Net/SFTP/Stream.php
@@ -37,7 +37,7 @@ class Stream
*
* @var array
*/
- static $instances;
+ public static $instances;
/**
* SFTP instance
@@ -157,14 +157,14 @@ class Stream
$orig = $path;
extract(parse_url($path) + ['port' => 22]);
if (isset($query)) {
- $path.= '?' . $query;
+ $path .= '?' . $query;
} elseif (preg_match('/(\?|\?#)$/', $orig)) {
- $path.= '?';
+ $path .= '?';
}
if (isset($fragment)) {
- $path.= '#' . $fragment;
+ $path .= '#' . $fragment;
} elseif ($orig[strlen($orig) - 1] == '#') {
- $path.= '#';
+ $path .= '#';
}
if (!isset($host)) {
@@ -329,7 +329,7 @@ class Stream
$this->eof = true;
return false;
}
- $this->pos+= strlen($result);
+ $this->pos += strlen($result);
return $result;
}
@@ -361,7 +361,7 @@ class Stream
if ($result === false) {
return false;
}
- $this->pos+= strlen($data);
+ $this->pos += strlen($data);
if ($this->pos > $this->size) {
$this->size = $this->pos;
}
@@ -415,10 +415,10 @@ class Stream
}
break;
case SEEK_CUR:
- $offset+= $this->pos;
+ $offset += $this->pos;
break;
case SEEK_END:
- $offset+= $this->size;
+ $offset += $this->size;
}
$this->pos = $offset;
diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php
index d18bf1e2..d053f507 100644
--- a/phpseclib/Net/SSH2.php
+++ b/phpseclib/Net/SSH2.php
@@ -1409,7 +1409,7 @@ class SSH2
$elapsed = microtime(true) - $start;
if ($this->curTimeout) {
- $this->curTimeout-= $elapsed;
+ $this->curTimeout -= $elapsed;
if ($this->curTimeout < 0) {
throw new \RuntimeException('Connection timed out whilst attempting to open socket connection');
}
@@ -1446,7 +1446,7 @@ class SSH2
throw new \RuntimeException('Connection timed out whilst receiving server identification string');
}
$elapsed = microtime(true) - $start;
- $this->curTimeout-= $elapsed;
+ $this->curTimeout -= $elapsed;
}
$temp = stream_get_line($this->fsock, 255, "\n");
@@ -1457,7 +1457,7 @@ class SSH2
continue;
}
- $line.= "$temp\n";
+ $line .= "$temp\n";
// quoting RFC4253, "Implementers who wish to maintain
// compatibility with older, undocumented versions of this protocol may
@@ -1472,7 +1472,7 @@ class SSH2
break;
}
- $data.= $line;
+ $data .= $line;
}
if (feof($this->fsock)) {
@@ -1516,7 +1516,7 @@ class SSH2
$this->key_exchange();
}
- $this->bitmap|= self::MASK_CONNECTED;
+ $this->bitmap |= self::MASK_CONNECTED;
return true;
}
@@ -1618,7 +1618,7 @@ class SSH2
$client_cookie = Random::string(16);
$kexinit_payload_client = pack('Ca*', NET_SSH2_MSG_KEXINIT, $client_cookie);
- $kexinit_payload_client.= Strings::packSSH2(
+ $kexinit_payload_client .= Strings::packSSH2(
'L10bN',
$kex_algorithms,
$server_host_key_algorithms,
@@ -1867,15 +1867,17 @@ class SSH2
$keyBytes = "\0$keyBytes";
}
- $this->exchange_hash = Strings::packSSH2('s5',
+ $this->exchange_hash = Strings::packSSH2(
+ 's5',
$this->identifier,
$this->server_identifier,
$kexinit_payload_client,
$kexinit_payload_server,
$this->server_public_host_key
);
- $this->exchange_hash.= $exchange_hash_rfc4419;
- $this->exchange_hash.= Strings::packSSH2('s3',
+ $this->exchange_hash .= $exchange_hash_rfc4419;
+ $this->exchange_hash .= Strings::packSSH2(
+ 's3',
$ourPublicBytes,
$theirPublicBytes,
$keyBytes
@@ -1937,7 +1939,7 @@ class SSH2
if ($this->encrypt->usesIV()) {
$iv = $kexHash->hash($keyBytes . $this->exchange_hash . 'A' . $this->session_id);
while ($this->encrypt_block_size > strlen($iv)) {
- $iv.= $kexHash->hash($keyBytes . $this->exchange_hash . $iv);
+ $iv .= $kexHash->hash($keyBytes . $this->exchange_hash . $iv);
}
$this->encrypt->setIV(substr($iv, 0, $this->encrypt_block_size));
}
@@ -1956,7 +1958,7 @@ class SSH2
$key = $kexHash->hash($keyBytes . $this->exchange_hash . 'C' . $this->session_id);
while ($encryptKeyLength > strlen($key)) {
- $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key);
+ $key .= $kexHash->hash($keyBytes . $this->exchange_hash . $key);
}
switch ($encrypt) {
case 'chacha20-poly1305@openssh.com':
@@ -1981,7 +1983,7 @@ class SSH2
if ($this->decrypt->usesIV()) {
$iv = $kexHash->hash($keyBytes . $this->exchange_hash . 'B' . $this->session_id);
while ($this->decrypt_block_size > strlen($iv)) {
- $iv.= $kexHash->hash($keyBytes . $this->exchange_hash . $iv);
+ $iv .= $kexHash->hash($keyBytes . $this->exchange_hash . $iv);
}
$this->decrypt->setIV(substr($iv, 0, $this->decrypt_block_size));
}
@@ -2001,7 +2003,7 @@ class SSH2
$key = $kexHash->hash($keyBytes . $this->exchange_hash . 'D' . $this->session_id);
while ($decryptKeyLength > strlen($key)) {
- $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key);
+ $key .= $kexHash->hash($keyBytes . $this->exchange_hash . $key);
}
switch ($decrypt) {
case 'chacha20-poly1305@openssh.com':
@@ -2030,7 +2032,7 @@ class SSH2
if (!$this->encrypt->usesNonce()) {
list($this->hmac_create, $createKeyLength) = self::mac_algorithm_to_hash_instance($mac_algorithm_out);
} else {
- $this->hmac_create = new \stdClass;
+ $this->hmac_create = new \stdClass();
$this->hmac_create_name = $mac_algorithm_out;
//$mac_algorithm_out = 'none';
$createKeyLength = 0;
@@ -2039,7 +2041,7 @@ class SSH2
if ($this->hmac_create instanceof Hash) {
$key = $kexHash->hash($keyBytes . $this->exchange_hash . 'E' . $this->session_id);
while ($createKeyLength > strlen($key)) {
- $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key);
+ $key .= $kexHash->hash($keyBytes . $this->exchange_hash . $key);
}
$this->hmac_create->setKey(substr($key, 0, $createKeyLength));
$this->hmac_create_name = $mac_algorithm_out;
@@ -2050,7 +2052,7 @@ class SSH2
list($this->hmac_check, $checkKeyLength) = self::mac_algorithm_to_hash_instance($mac_algorithm_in);
$this->hmac_size = $this->hmac_check->getLengthInBytes();
} else {
- $this->hmac_check = new \stdClass;
+ $this->hmac_check = new \stdClass();
$this->hmac_check_name = $mac_algorithm_in;
//$mac_algorithm_in = 'none';
$checkKeyLength = 0;
@@ -2060,7 +2062,7 @@ class SSH2
if ($this->hmac_check instanceof Hash) {
$key = $kexHash->hash($keyBytes . $this->exchange_hash . 'F' . $this->session_id);
while ($checkKeyLength > strlen($key)) {
- $key.= $kexHash->hash($keyBytes . $this->exchange_hash . $key);
+ $key .= $kexHash->hash($keyBytes . $this->exchange_hash . $key);
}
$this->hmac_check->setKey(substr($key, 0, $checkKeyLength));
$this->hmac_check_name = $mac_algorithm_in;
@@ -2409,12 +2411,12 @@ class SSH2
}
if (!isset($password)) {
- $packet = Strings::packSSH2(
- 'Cs3',
- NET_SSH2_MSG_USERAUTH_REQUEST,
- $username,
- 'ssh-connection',
- 'none'
+ $packet = Strings::packSSH2(
+ 'Cs3',
+ NET_SSH2_MSG_USERAUTH_REQUEST,
+ $username,
+ 'ssh-connection',
+ 'none'
);
$this->send_binary_packet($packet);
@@ -2589,8 +2591,8 @@ class SSH2
// see http://tools.ietf.org/html/rfc4256#section-3.4
$packet = $logged = pack('CN', NET_SSH2_MSG_USERAUTH_INFO_RESPONSE, count($responses));
for ($i = 0; $i < count($responses); $i++) {
- $packet.= Strings::packSSH2('s', $responses[$i]);
- $logged.= Strings::packSSH2('s', 'dummy-answer');
+ $packet .= Strings::packSSH2('s', $responses[$i]);
+ $logged .= Strings::packSSH2('s', 'dummy-answer');
}
$this->send_binary_packet($packet, $logged);
@@ -2657,7 +2659,7 @@ class SSH2
$privatekey = $privatekey->withPadding(RSA::SIGNATURE_PKCS1);
$algos = ['rsa-sha2-256', 'rsa-sha2-512', 'ssh-rsa'];
if (isset($this->preferred['hostkey'])) {
- $algos = array_intersect($this->preferred['hostkey'] , $algos);
+ $algos = array_intersect($this->preferred['hostkey'], $algos);
}
$algo = self::array_intersect_first($algos, $this->server_host_key_algorithms);
switch ($algo) {
@@ -2674,7 +2676,7 @@ class SSH2
$hash = 'sha1';
$signatureType = 'ssh-rsa';
}
- } else if ($publickey instanceof EC) {
+ } elseif ($publickey instanceof EC) {
$privatekey = $privatekey->withSignatureFormat('SSH2');
$curveName = $privatekey->getCurve();
switch ($curveName) {
@@ -2700,7 +2702,7 @@ class SSH2
}
throw new UnsupportedCurveException('Named Curve of ' . $curveName . ' is not supported by phpseclib3\'s SSH2 implementation');
}
- } else if ($publickey instanceof DSA) {
+ } elseif ($publickey instanceof DSA) {
$privatekey = $privatekey->withSignatureFormat('SSH2');
$hash = 'sha1';
$signatureType = 'ssh-dss';
@@ -2750,7 +2752,7 @@ class SSH2
if ($publickey instanceof RSA) {
$signature = Strings::packSSH2('ss', $signatureType, $signature);
}
- $packet.= Strings::packSSH2('s', $signature);
+ $packet .= Strings::packSSH2('s', $signature);
$this->send_binary_packet($packet);
@@ -2794,7 +2796,7 @@ class SSH2
* @param int $interval
* @access public
*/
- function setKeepAlive($interval)
+ public function setKeepAlive($interval)
{
$this->keepAlive = $interval;
}
@@ -2931,7 +2933,7 @@ class SSH2
return true;
}
} else {
- $output.= $temp;
+ $output .= $temp;
}
}
}
@@ -3135,7 +3137,7 @@ class SSH2
return Strings::shift($this->interactiveBuffer, strlen($this->interactiveBuffer));
}
- $this->interactiveBuffer.= $response;
+ $this->interactiveBuffer .= $response;
}
}
@@ -3420,11 +3422,11 @@ class SSH2
if (!@stream_select($read, $write, $except, $this->keepAlive)) {
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0));
$elapsed = microtime(true) - $start;
- $this->curTimeout-= $elapsed;
+ $this->curTimeout -= $elapsed;
return $this->get_binary_packet(true);
}
$elapsed = microtime(true) - $start;
- $this->curTimeout-= $elapsed;
+ $this->curTimeout -= $elapsed;
}
$sec = (int) floor($this->curTimeout);
@@ -3436,7 +3438,7 @@ class SSH2
return true;
}
$elapsed = microtime(true) - $start;
- $this->curTimeout-= $elapsed;
+ $this->curTimeout -= $elapsed;
}
}
@@ -3468,7 +3470,7 @@ class SSH2
* @var integer $packet_length
*/
- $raw.= $this->read_remaining_bytes($packet_length - $this->decrypt_block_size + 4);
+ $raw .= $this->read_remaining_bytes($packet_length - $this->decrypt_block_size + 4);
$stop = microtime(true);
$tag = stream_get_contents($this->fsock, $this->decrypt_block_size);
$this->decrypt->setTag($tag);
@@ -3491,7 +3493,7 @@ class SSH2
* @var integer $packet_length
*/
- $raw.= $this->read_remaining_bytes($packet_length - $this->decrypt_block_size + 4);
+ $raw .= $this->read_remaining_bytes($packet_length - $this->decrypt_block_size + 4);
$stop = microtime(true);
$tag = stream_get_contents($this->fsock, 16);
@@ -3519,7 +3521,7 @@ class SSH2
/**
* @var integer $packet_length
*/
- $raw.= $this->read_remaining_bytes($packet_length - $this->decrypt_block_size + 4);
+ $raw .= $this->read_remaining_bytes($packet_length - $this->decrypt_block_size + 4);
$stop = microtime(true);
$encrypted = $temp . $raw;
$raw = $temp . $this->decrypt->decrypt($raw);
@@ -3547,7 +3549,7 @@ class SSH2
$stop = microtime(true);
}
if (strlen($buffer)) {
- $raw.= $this->decrypt ? $this->decrypt->decrypt($buffer) : $buffer;
+ $raw .= $this->decrypt ? $this->decrypt->decrypt($buffer) : $buffer;
}
$payload = Strings::shift($raw, $packet_length - $padding_length - 1);
@@ -3648,7 +3650,7 @@ class SSH2
case $this->decryptName == 'aes256-gcm@openssh.com':
case $this->decryptName == 'chacha20-poly1305@openssh.com':
case $this->hmac_check instanceof Hash && $this->hmac_check_etm:
- $remaining_length+= $this->decrypt_block_size - 4;
+ $remaining_length += $this->decrypt_block_size - 4;
$adjustLength = true;
}
}
@@ -3667,7 +3669,7 @@ class SSH2
}
if ($adjustLength) {
- $remaining_length-= $this->decrypt_block_size - 4;
+ $remaining_length -= $this->decrypt_block_size - 4;
}
$buffer = '';
@@ -3677,8 +3679,8 @@ class SSH2
$this->disconnect_helper(NET_SSH2_DISCONNECT_CONNECTION_LOST);
throw new \RuntimeException('Error reading from socket');
}
- $buffer.= $temp;
- $remaining_length-= strlen($temp);
+ $buffer .= $temp;
+ $remaining_length -= strlen($temp);
}
return $buffer;
@@ -3830,7 +3832,7 @@ class SSH2
Strings::shift($payload, 1);
list($channel, $window_size) = Strings::unpackSSH2('NN', $payload);
- $this->window_size_client_to_server[$channel]+= $window_size;
+ $this->window_size_client_to_server[$channel] += $window_size;
$payload = ($this->bitmap & self::MASK_WINDOW_ADJUST) ? true : $this->get_binary_packet($skip_channel_filter);
}
@@ -3977,7 +3979,7 @@ class SSH2
// will not be setup yet on incoming channel open request
if (isset($channel) && isset($this->channel_status[$channel]) && isset($this->window_size_server_to_client[$channel])) {
- $this->window_size_server_to_client[$channel]-= strlen($response);
+ $this->window_size_server_to_client[$channel] -= strlen($response);
// resize the window, if appropriate
if ($this->window_size_server_to_client[$channel] < 0) {
@@ -3985,7 +3987,7 @@ class SSH2
//if ($this->window_size_server_to_client[$channel] < 0x3FFFFFFF) {
$packet = pack('CNN', NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST, $this->server_channels[$channel], $this->window_resize);
$this->send_binary_packet($packet);
- $this->window_size_server_to_client[$channel]+= $this->window_resize;
+ $this->window_size_server_to_client[$channel] += $this->window_resize;
}
switch ($type) {
@@ -3997,7 +3999,7 @@ class SSH2
*/
// currently, there's only one possible value for $data_type_code: NET_SSH2_EXTENDED_DATA_STDERR
list($data_type_code, $data) = Strings::unpackSSH2('Ns', $response);
- $this->stdErrorLog.= $data;
+ $this->stdErrorLog .= $data;
if ($skip_extended || $this->quiet_mode) {
continue 2;
}
@@ -4023,7 +4025,7 @@ class SSH2
$this->errors[] = "SSH_MSG_CHANNEL_REQUEST (exit-signal): $signal_name";
if (strlen($error_message)) {
- $this->errors[count($this->errors) - 1].= "\r\n$error_message";
+ $this->errors[count($this->errors) - 1] .= "\r\n$error_message";
}
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel]));
@@ -4057,8 +4059,8 @@ class SSH2
) = Strings::unpackSSH2('NNN', $response);
if ($window_size < 0) {
- $window_size&= 0x7FFFFFFF;
- $window_size+= 0x80000000;
+ $window_size &= 0x7FFFFFFF;
+ $window_size += 0x80000000;
}
$this->window_size_client_to_server[$channel] = $window_size;
$result = $client_channel == $channel ? true : $this->get_channel_packet($client_channel, $skip_extended);
@@ -4126,7 +4128,7 @@ class SSH2
$this->curTimeout = 5;
if ($this->bitmap & self::MASK_SHELL) {
- $this->bitmap&= ~self::MASK_SHELL;
+ $this->bitmap &= ~self::MASK_SHELL;
}
if ($this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_EOF) {
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel]));
@@ -4188,17 +4190,17 @@ class SSH2
// 4 (packet length) + 1 (padding length) + 4 (minimal padding amount) == 9
$packet_length = strlen($data) + 9;
if ($this->encrypt && $this->encrypt->usesNonce()) {
- $packet_length-= 4;
+ $packet_length -= 4;
}
// round up to the nearest $this->encrypt_block_size
- $packet_length+= (($this->encrypt_block_size - 1) * $packet_length) % $this->encrypt_block_size;
+ $packet_length += (($this->encrypt_block_size - 1) * $packet_length) % $this->encrypt_block_size;
// subtracting strlen($data) is obvious - subtracting 5 is necessary because of packet_length and padding_length
$padding_length = $packet_length - strlen($data) - 5;
switch (true) {
case $this->encrypt && $this->encrypt->usesNonce():
case $this->hmac_create instanceof Hash && $this->hmac_create_etm:
- $padding_length+= 4;
- $packet_length+= 4;
+ $padding_length += 4;
+ $packet_length += 4;
}
$padding = Random::string($padding_length);
@@ -4270,7 +4272,7 @@ class SSH2
$this->send_seq_no++;
- $packet.= $this->encrypt && $this->encrypt->usesNonce() ? $this->encrypt->getTag() : $hmac;
+ $packet .= $this->encrypt && $this->encrypt->usesNonce() ? $this->encrypt->getTag() : $hmac;
$start = microtime(true);
$sent = @fputs($this->fsock, $packet);
@@ -4315,10 +4317,10 @@ class SSH2
// the most useful log for SSH2
case self::LOG_COMPLEX:
$this->message_number_log[] = $message_number;
- $this->log_size+= strlen($message);
+ $this->log_size += strlen($message);
$this->message_log[] = $message;
while ($this->log_size > self::LOG_MAX_SIZE) {
- $this->log_size-= strlen(array_shift($this->message_log));
+ $this->log_size -= strlen(array_shift($this->message_log));
array_shift($this->message_number_log);
}
break;
@@ -4355,10 +4357,10 @@ class SSH2
$entry = $this->format_log([$message], [$message_number]);
if ($this->realtime_log_wrap) {
$temp = "<<< START >>>\r\n";
- $entry.= $temp;
+ $entry .= $temp;
fseek($this->realtime_log_file, ftell($this->realtime_log_file) - strlen($temp));
}
- $this->realtime_log_size+= strlen($entry);
+ $this->realtime_log_size += strlen($entry);
if ($this->realtime_log_size > self::LOG_MAX_SIZE) {
fseek($this->realtime_log_file, 0);
$this->realtime_log_size = strlen($entry);
@@ -4382,10 +4384,10 @@ class SSH2
{
while (strlen($data)) {
if (!$this->window_size_client_to_server[$client_channel]) {
- $this->bitmap^= self::MASK_WINDOW_ADJUST;
+ $this->bitmap ^= self::MASK_WINDOW_ADJUST;
// using an invalid channel will let the buffers be built up for the valid channels
$this->get_channel_packet(-1);
- $this->bitmap^= self::MASK_WINDOW_ADJUST;
+ $this->bitmap ^= self::MASK_WINDOW_ADJUST;
}
/* The maximum amount of data allowed is determined by the maximum
@@ -4404,7 +4406,7 @@ class SSH2
$this->server_channels[$client_channel],
$temp
);
- $this->window_size_client_to_server[$client_channel]-= strlen($temp);
+ $this->window_size_client_to_server[$client_channel] -= strlen($temp);
$this->send_binary_packet($packet);
}
@@ -4449,7 +4451,7 @@ class SSH2
}
if ($this->bitmap & self::MASK_SHELL) {
- $this->bitmap&= ~self::MASK_SHELL;
+ $this->bitmap &= ~self::MASK_SHELL;
}
}
@@ -4538,12 +4540,12 @@ class SSH2
{
$output = '';
for ($i = 0; $i < count($message_log); $i++) {
- $output.= $message_number_log[$i] . "\r\n";
+ $output .= $message_number_log[$i] . "\r\n";
$current_log = $message_log[$i];
$j = 0;
do {
if (strlen($current_log)) {
- $output.= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 ';
+ $output .= str_pad(dechex($j), 7, '0', STR_PAD_LEFT) . '0 ';
}
$fragment = Strings::shift($current_log, $this->log_short_width);
$hex = substr(preg_replace_callback('#.#s', function ($matches) {
@@ -4553,10 +4555,10 @@ class SSH2
// http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters
// also replace < with a . since < messes up the output on web browsers
$raw = preg_replace('#[^\x20-\x7E]|<#', '.', $fragment);
- $output.= str_pad($hex, $this->log_long_width - $this->log_short_width, ' ') . $raw . "\r\n";
+ $output .= str_pad($hex, $this->log_long_width - $this->log_short_width, ' ') . $raw . "\r\n";
$j++;
} while (strlen($current_log));
- $output.= "\r\n";
+ $output .= "\r\n";
}
return $output;
@@ -5232,7 +5234,7 @@ class SSH2
return self::$connections;
}
$temp = [];
- foreach (self::$connections as $key=>$ref) {
+ foreach (self::$connections as $key => $ref) {
$temp[$key] = $ref->get();
}
return $temp;
diff --git a/phpseclib/System/SSH/Agent.php b/phpseclib/System/SSH/Agent.php
index 07666bbb..8b412f0f 100644
--- a/phpseclib/System/SSH/Agent.php
+++ b/phpseclib/System/SSH/Agent.php
@@ -192,7 +192,7 @@ class Agent
case 'ecdsa-sha2-nistp256':
case 'ecdsa-sha2-nistp384':
case 'ecdsa-sha2-nistp521':
- $key = PublicKeyLoader::load($key_type . ' ' . base64_encode($key_blob));
+ $key = PublicKeyLoader::load($key_type . ' ' . base64_encode($key_blob));
}
// resources are passed by reference by default
if (isset($key)) {
@@ -267,7 +267,7 @@ class Agent
public function forwardData($data)
{
if ($this->expected_bytes > 0) {
- $this->socket_buffer.= $data;
+ $this->socket_buffer .= $data;
$this->expected_bytes -= strlen($data);
} else {
$agent_data_bytes = current(unpack('N', $data));
diff --git a/phpseclib/bootstrap.php b/phpseclib/bootstrap.php
index 5829d328..517106c3 100644
--- a/phpseclib/bootstrap.php
+++ b/phpseclib/bootstrap.php
@@ -9,6 +9,7 @@
*
* @license http://www.opensource.org/licenses/mit-license.html MIT License
*/
+
if (extension_loaded('mbstring')) {
// 2 - MB_OVERLOAD_STRING
// mbstring.func_overload is deprecated in php 7.2 and removed in php 8.0.
diff --git a/tests/Functional/Net/SFTPUserStoryTest.php b/tests/Functional/Net/SFTPUserStoryTest.php
index 56b2809a..d1a9f991 100644
--- a/tests/Functional/Net/SFTPUserStoryTest.php
+++ b/tests/Functional/Net/SFTPUserStoryTest.php
@@ -10,10 +10,10 @@ use phpseclib3\Net\SFTP;
class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
{
- static protected $scratchDir;
- static protected $exampleData;
- static protected $exampleDataLength;
- static protected $buffer;
+ protected static $scratchDir;
+ protected static $exampleData;
+ protected static $exampleDataLength;
+ protected static $buffer;
public static function setUpBeforeClass()
{
@@ -135,7 +135,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
return $sftp;
}
- static function demoCallback($length)
+ public static function demoCallback($length)
{
$r = substr(self::$buffer, 0, $length);
self::$buffer = substr(self::$buffer, $length);
@@ -486,6 +486,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
/**
* on older versions this would result in a fatal error
+ *
* @depends testStatOnCWD
* @group github402
*/
@@ -764,7 +765,14 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
$list_cache_disabled = $sftp->rawlist('.', true);
- $this->assertEquals($list_cache_enabled, $list_cache_disabled, 'The files should be the same regardless of stat cache', 0.0, 10, true);
+ $this->assertEquals(
+ $list_cache_enabled,
+ $list_cache_disabled,
+ 'The files should be the same regardless of stat cache',
+ 0.0,
+ 10,
+ true
+ );
return $sftp;
}
diff --git a/tests/Functional/Net/SFTPWrongServerTest.php b/tests/Functional/Net/SFTPWrongServerTest.php
index f1287028..c9fd53e5 100644
--- a/tests/Functional/Net/SFTPWrongServerTest.php
+++ b/tests/Functional/Net/SFTPWrongServerTest.php
@@ -14,8 +14,8 @@ class SFTPWrongServerTest extends TestCase
} catch (UnableToConnectException $e) {
// getaddrinfo message seems not to return stable text
static::assertSame(
- 'Cannot connect to dummy-server:22. Error 0. php_network_getaddresses: getaddrinfo',
- substr($e->getMessage(),0,81)
+ 'Cannot connect to dummy-server:22. Error 0. php_network_getaddresses: getaddrinfo',
+ substr($e->getMessage(), 0, 81)
);
}
}
diff --git a/tests/Functional/Net/SSH2AgentTest.php b/tests/Functional/Net/SSH2AgentTest.php
index 99aaa95a..178d7f8d 100644
--- a/tests/Functional/Net/SSH2AgentTest.php
+++ b/tests/Functional/Net/SSH2AgentTest.php
@@ -24,7 +24,7 @@ class Functional_Net_SSH2AgentTest extends PhpseclibFunctionalTestCase
public function testAgentLogin()
{
$ssh = new SSH2($this->getEnv('SSH_HOSTNAME'));
- $agent = new Agent;
+ $agent = new Agent();
$this->assertTrue(
$ssh->login($this->getEnv('SSH_USERNAME'), $agent),
diff --git a/tests/PhpseclibFunctionalTestCase.php b/tests/PhpseclibFunctionalTestCase.php
index b49aebdb..f9f18516 100644
--- a/tests/PhpseclibFunctionalTestCase.php
+++ b/tests/PhpseclibFunctionalTestCase.php
@@ -1,4 +1,5 @@
* @copyright 2014 Andreas Fischer
diff --git a/tests/PhpseclibTestCase.php b/tests/PhpseclibTestCase.php
index 3eaff1c7..31e8f609 100644
--- a/tests/PhpseclibTestCase.php
+++ b/tests/PhpseclibTestCase.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
diff --git a/tests/Unit/Crypt/AES/EvalTest.php b/tests/Unit/Crypt/AES/EvalTest.php
index 9426a995..dff0ef34 100644
--- a/tests/Unit/Crypt/AES/EvalTest.php
+++ b/tests/Unit/Crypt/AES/EvalTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
diff --git a/tests/Unit/Crypt/AES/McryptTest.php b/tests/Unit/Crypt/AES/McryptTest.php
index e1b981ed..b6fa1f14 100644
--- a/tests/Unit/Crypt/AES/McryptTest.php
+++ b/tests/Unit/Crypt/AES/McryptTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
diff --git a/tests/Unit/Crypt/AES/OpenSSLTest.php b/tests/Unit/Crypt/AES/OpenSSLTest.php
index fe3a6adf..69e237cb 100644
--- a/tests/Unit/Crypt/AES/OpenSSLTest.php
+++ b/tests/Unit/Crypt/AES/OpenSSLTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
diff --git a/tests/Unit/Crypt/AES/PurePHPTest.php b/tests/Unit/Crypt/AES/PurePHPTest.php
index 27e5f5b2..f5433b16 100644
--- a/tests/Unit/Crypt/AES/PurePHPTest.php
+++ b/tests/Unit/Crypt/AES/PurePHPTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
diff --git a/tests/Unit/Crypt/AES/TestCase.php b/tests/Unit/Crypt/AES/TestCase.php
index 46164418..ba29648a 100644
--- a/tests/Unit/Crypt/AES/TestCase.php
+++ b/tests/Unit/Crypt/AES/TestCase.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
@@ -188,7 +189,7 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
$result = '';
foreach ($test as $len) {
$temp = str_repeat('d', $len);
- $str.= $temp;
+ $str .= $temp;
}
$c1 = $aes->$op($str);
@@ -204,7 +205,7 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
foreach ($test as $len) {
$temp = str_repeat('d', $len);
$output = $aes->$op($temp);
- $result.= $output;
+ $result .= $output;
}
$c2 = $result;
@@ -237,7 +238,7 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
$result = '';
foreach ($test as $len) {
$temp = str_repeat('d', $len);
- $str.= $temp;
+ $str .= $temp;
}
$c1 = $aes->$op($str);
@@ -252,7 +253,7 @@ abstract class Unit_Crypt_AES_TestCase extends PhpseclibTestCase
foreach ($test as $len) {
$temp = str_repeat('d', $len);
$output = $aes->$op($temp);
- $result.= $output;
+ $result .= $output;
}
$c2 = $result;
diff --git a/tests/Unit/Crypt/BlowfishTest.php b/tests/Unit/Crypt/BlowfishTest.php
index 5289c67f..bb496698 100644
--- a/tests/Unit/Crypt/BlowfishTest.php
+++ b/tests/Unit/Crypt/BlowfishTest.php
@@ -1,4 +1,5 @@
* @copyright MMXIII Andreas Fischer
diff --git a/tests/Unit/Crypt/ChaCha20Test.php b/tests/Unit/Crypt/ChaCha20Test.php
index ab5c784b..676807c2 100644
--- a/tests/Unit/Crypt/ChaCha20Test.php
+++ b/tests/Unit/Crypt/ChaCha20Test.php
@@ -1,4 +1,5 @@
* @copyright 2014 Jim Wigginton
@@ -92,7 +93,7 @@ class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
$expected = str_replace(':', '', $expected);
$expected = pack('H*', $expected);
- $c = new ChaCha20;
+ $c = new ChaCha20();
$c->setPoly1305Key($key);
$r = new \ReflectionClass(get_class($c));
// this unit test is testing Poly1305 independent of ChaCha20, which phpseclib doesn't
@@ -209,7 +210,7 @@ class Unit_Crypt_ChaCha20Test extends PhpseclibTestCase
$p1 = $c->encrypt($plaintext);
$p2 = '';
foreach ($partitions as $partition) {
- $p2.= $c2->encrypt(str_repeat("\0", $partition));
+ $p2 .= $c2->encrypt(str_repeat("\0", $partition));
}
$this->assertSame($p1, $p2, "Failed asserting that ciphertext matches expected value with $engine engine");
diff --git a/tests/Unit/Crypt/DHTest.php b/tests/Unit/Crypt/DHTest.php
index 71314b74..d3025dcf 100644
--- a/tests/Unit/Crypt/DHTest.php
+++ b/tests/Unit/Crypt/DHTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
@@ -231,11 +232,13 @@ Q3ADAIcv9LEmTBnSAOsCs1K9ExAmSv/T2/4+9dW28UYb+p/uV477d1wf+nCWS6VU
{
// utilizing test vector from https://tools.ietf.org/html/rfc7748#section-6.2
- $alicePrivate = EC::loadFormat('MontgomeryPrivate', pack('H*',
+ $alicePrivate = EC::loadFormat('MontgomeryPrivate', pack(
+ 'H*',
'9a8f4925d1519f5775cf46b04b5800d4ee9ee8bae8bc5565d498c28d' .
'd9c9baf574a9419744897391006382a6f127ab1d9ac2d8c0a598726b'
));
- $bobPrivate = EC::loadFormat('MontgomeryPrivate', pack('H*',
+ $bobPrivate = EC::loadFormat('MontgomeryPrivate', pack(
+ 'H*',
'1c306a7ac2a0e2e0990b294470cba339e6453772b075811d8fad0d1d' .
'6927c120bb5ee8972b0d3e21374c9c921b09d1b0366f10b65173992d'
));
@@ -255,7 +258,8 @@ Q3ADAIcv9LEmTBnSAOsCs1K9ExAmSv/T2/4+9dW28UYb+p/uV477d1wf+nCWS6VU
bin2hex($bobPublic->toString('MontgomeryPublic'))
);
- $expected = pack('H*',
+ $expected = pack(
+ 'H*',
'07fff4181ac6cc95ec1c16a94a0f74d12da232ce40a77552281d282b' .
'b60c0b56fd2464c335543936521c24403085d59a449a5037514a879d'
);
diff --git a/tests/Unit/Crypt/DSA/LoadDSAKeyTest.php b/tests/Unit/Crypt/DSA/LoadDSAKeyTest.php
index 53ecf568..f851775f 100644
--- a/tests/Unit/Crypt/DSA/LoadDSAKeyTest.php
+++ b/tests/Unit/Crypt/DSA/LoadDSAKeyTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Jim Wigginton
diff --git a/tests/Unit/Crypt/EC/CurveTest.php b/tests/Unit/Crypt/EC/CurveTest.php
index e43a4f7a..de89e769 100644
--- a/tests/Unit/Crypt/EC/CurveTest.php
+++ b/tests/Unit/Crypt/EC/CurveTest.php
@@ -114,7 +114,7 @@ class Unit_Crypt_EC_CurveTest extends PhpseclibTestCase
public function testBasePoint($name)
{
$class = 'phpseclib3\Crypt\EC\Curves\\' . $name;
- $curve = new $class;
+ $curve = new $class();
$this->assertTrue($curve->verifyPoint($curve->getBasePoint()), "Failed to verify basepoint of curve $name");
}
@@ -127,7 +127,7 @@ class Unit_Crypt_EC_CurveTest extends PhpseclibTestCase
public function testKeyGeneration($name)
{
$class = 'phpseclib3\Crypt\EC\Curves\\' . $name;
- $curve = new $class;
+ $curve = new $class();
$dA = $curve->createRandomMultiplier();
$QA = $curve->multiplyPoint($curve->getBasePoint(), $dA);
$this->assertTrue($curve->verifyPoint($QA), "Failed to verify point multiplication on curve $name with $dA");
diff --git a/tests/Unit/Crypt/EC/KeyTest.php b/tests/Unit/Crypt/EC/KeyTest.php
index cbe96a09..3e8c31c8 100644
--- a/tests/Unit/Crypt/EC/KeyTest.php
+++ b/tests/Unit/Crypt/EC/KeyTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Jim Wigginton
@@ -348,7 +349,6 @@ Private-MAC: 97a990a3d5f6b8f268d4be9c4ab9ebfd8fa79849
OpenSSH::setComment('ecdsa-key-20181105');
$this->assertSameNL($expected, $key->toString('OpenSSH'));
-
}
public function testPuTTYnistp521()
diff --git a/tests/Unit/Crypt/GCMTest.php b/tests/Unit/Crypt/GCMTest.php
index 090f2152..dc83efcd 100644
--- a/tests/Unit/Crypt/GCMTest.php
+++ b/tests/Unit/Crypt/GCMTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
diff --git a/tests/Unit/Crypt/HashTest.php b/tests/Unit/Crypt/HashTest.php
index 84c1b924..f31fef71 100644
--- a/tests/Unit/Crypt/HashTest.php
+++ b/tests/Unit/Crypt/HashTest.php
@@ -1,4 +1,5 @@
* @copyright 2012 Andreas Fischer
diff --git a/tests/Unit/Crypt/RC2Test.php b/tests/Unit/Crypt/RC2Test.php
index bd1ed161..0e99ce0f 100644
--- a/tests/Unit/Crypt/RC2Test.php
+++ b/tests/Unit/Crypt/RC2Test.php
@@ -1,4 +1,5 @@
* @copyright MMXIII Andreas Fischer
@@ -9,7 +10,7 @@ use phpseclib3\Crypt\RC2;
class Unit_Crypt_RC2Test extends PhpseclibTestCase
{
- var $engines = [
+ public $engines = [
'PHP',
'Eval',
'mcrypt',
@@ -99,7 +100,7 @@ class Unit_Crypt_RC2Test extends PhpseclibTestCase
$rc2->setPreferredEngine('OpenSSL');
if ($rc2->getEngine() == 'OpenSSL') {
$openssl = $rc2->encrypt('d');
- $this->assertEquals($result, $openssl, 'Failed asserting that the OpenSSL engine produced the correct result');
+ $this->assertEquals($result, $openssl, 'Failed asserting that the OpenSSL engine produced the correct result');
} else {
self::markTestSkipped('Unable to initialize OpenSSL engine');
}
diff --git a/tests/Unit/Crypt/RC4Test.php b/tests/Unit/Crypt/RC4Test.php
index e634afcd..5cbc9d88 100644
--- a/tests/Unit/Crypt/RC4Test.php
+++ b/tests/Unit/Crypt/RC4Test.php
@@ -1,4 +1,5 @@
* @copyright 2014 Jim Wigginton
diff --git a/tests/Unit/Crypt/RSA/LoadKeyTest.php b/tests/Unit/Crypt/RSA/LoadKeyTest.php
index 756ab090..8f471aed 100644
--- a/tests/Unit/Crypt/RSA/LoadKeyTest.php
+++ b/tests/Unit/Crypt/RSA/LoadKeyTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Jim Wigginton
@@ -335,11 +336,11 @@ Ao8eayMp6FcvNucIpUndo1X8dKMv3Y26ZQIDAQAB
public function testSSHPubKeyFingerprint()
{
- $key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD9K+ebJRMN10kGanhi6kDz6EYFqZttZWZh0'.
- 'YoEbIbbere9N2Yvfc7oIoCTHYowhXND9WSJaIs1E4bx0085CZnofWaqf4NbZTzAh18iZup08ec'.
- 'COB5gJVS1efpgVSviDF2L7jxMsBVoOBfqsmA8m0RwDDVezyWvw4y+STSuVzu2jI8EfwN7ZFGC6'.
- 'Yo8m/Z94qIGzqPYGKJLuCeidB0TnUE0ZtzOJTiOc/WoTm/NOpCdfQZEJggd1MOTi+QUnqRu4Wu'.
- 'b6wYtY/q/WtUFr3nK+x0lgOtokhnJfRR/6fnmC1CztPnIT4BWK81VGKWONAxuhMyQ5XChyu6S9'.
+ $key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD9K+ebJRMN10kGanhi6kDz6EYFqZttZWZh0' .
+ 'YoEbIbbere9N2Yvfc7oIoCTHYowhXND9WSJaIs1E4bx0085CZnofWaqf4NbZTzAh18iZup08ec' .
+ 'COB5gJVS1efpgVSviDF2L7jxMsBVoOBfqsmA8m0RwDDVezyWvw4y+STSuVzu2jI8EfwN7ZFGC6' .
+ 'Yo8m/Z94qIGzqPYGKJLuCeidB0TnUE0ZtzOJTiOc/WoTm/NOpCdfQZEJggd1MOTi+QUnqRu4Wu' .
+ 'b6wYtY/q/WtUFr3nK+x0lgOtokhnJfRR/6fnmC1CztPnIT4BWK81VGKWONAxuhMyQ5XChyu6S9' .
'mWG5tUlUI/5';
$rsa = PublicKeyLoader::load($key, 'password');
@@ -997,8 +998,8 @@ IBgv3a3Lyb+IQtT75LE1yjE=
$key = $rsa->toString('PSS');
$r2 = PSS::load($key);
- $this->assertSame($r['hash'], $r2['hash']);
- $this->assertSame($r['MGFHash'], $r2['MGFHash']);
+ $this->assertSame($r['hash'], $r2['hash']);
+ $this->assertSame($r['MGFHash'], $r2['MGFHash']);
$this->assertSame($r['saltLength'], $r2['saltLength']);
}
diff --git a/tests/Unit/Crypt/RSA/ModeTest.php b/tests/Unit/Crypt/RSA/ModeTest.php
index c7ec8dcb..e4b6d9e0 100644
--- a/tests/Unit/Crypt/RSA/ModeTest.php
+++ b/tests/Unit/Crypt/RSA/ModeTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Jim Wigginton
diff --git a/tests/Unit/Crypt/RandomTest.php b/tests/Unit/Crypt/RandomTest.php
index 5385826c..daf130f1 100644
--- a/tests/Unit/Crypt/RandomTest.php
+++ b/tests/Unit/Crypt/RandomTest.php
@@ -1,4 +1,5 @@
* @copyright 2014 Andreas Fischer
diff --git a/tests/Unit/Crypt/Salsa20Test.php b/tests/Unit/Crypt/Salsa20Test.php
index 81d7570c..debbb143 100644
--- a/tests/Unit/Crypt/Salsa20Test.php
+++ b/tests/Unit/Crypt/Salsa20Test.php
@@ -1,4 +1,5 @@
* @copyright 2014 Jim Wigginton
diff --git a/tests/Unit/Crypt/TripleDESTest.php b/tests/Unit/Crypt/TripleDESTest.php
index 252af485..0e5e49e3 100644
--- a/tests/Unit/Crypt/TripleDESTest.php
+++ b/tests/Unit/Crypt/TripleDESTest.php
@@ -1,4 +1,5 @@
* @copyright 2014 Jim Wigginton
@@ -9,7 +10,7 @@ use phpseclib3\Crypt\TripleDES;
class Unit_Crypt_TripleDESTest extends PhpseclibTestCase
{
- var $engines = [
+ public $engines = [
'PHP',
'Eval',
'mcrypt',
diff --git a/tests/Unit/Crypt/TwofishTest.php b/tests/Unit/Crypt/TwofishTest.php
index e9f3f78d..677fb9d0 100644
--- a/tests/Unit/Crypt/TwofishTest.php
+++ b/tests/Unit/Crypt/TwofishTest.php
@@ -1,4 +1,5 @@
* @copyright MMXIII Andreas Fischer
diff --git a/tests/Unit/File/ANSITest.php b/tests/Unit/File/ANSITest.php
index 0cc4a029..0d2eb144 100644
--- a/tests/Unit/File/ANSITest.php
+++ b/tests/Unit/File/ANSITest.php
@@ -1,4 +1,5 @@
* @copyright 2014 Jim Wigginton
@@ -12,19 +13,19 @@ class Unit_File_ANSITest extends PhpseclibTestCase
public function testCase1()
{
$str = "\x1B[07m"; // turn reverse video on
- $str.= "aaaaaaaaaaaaaaaaaa";
- $str.= "\x1B[10D"; // move cursor left 10 lines
- $str.= "\x1B[m"; // reset everything
- $str.= "bbb";
+ $str .= "aaaaaaaaaaaaaaaaaa";
+ $str .= "\x1B[10D"; // move cursor left 10 lines
+ $str .= "\x1B[m"; // reset everything
+ $str .= "bbb";
$ansi = new ANSI();
$ansi->appendString($str);
$expected = '';
- $expected.= 'aaaaaaaa';
- $expected.= 'bbb';
- $expected.= 'aaaaaaa';
- $expected.= '
';
+ $expected .= 'aaaaaaaa';
+ $expected .= 'bbb';
+ $expected .= 'aaaaaaa';
+ $expected .= '';
$this->assertSame($ansi->getScreen(), $expected);
}
@@ -32,15 +33,15 @@ class Unit_File_ANSITest extends PhpseclibTestCase
public function testCaseJ()
{
$str = "\x1B[H"; // Move cursor to upper left corner
- $str.= "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
- $str.= "\x1B[H"; // Move cursor to upper left corner
- $str.= "\x1B[J"; // Clear screen from cursor down
+ $str .= "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
+ $str .= "\x1B[H"; // Move cursor to upper left corner
+ $str .= "\x1B[J"; // Clear screen from cursor down
$ansi = new ANSI();
$ansi->appendString($str);
$expected = '';
- $expected.= '
';
+ $expected .= '';
$this->assertSame($ansi->getScreen(), $expected);
}
@@ -49,9 +50,9 @@ class Unit_File_ANSITest extends PhpseclibTestCase
{
$str = '';
foreach (range('a', 'y') as $char) {
- $str.= "$char\r\n";
+ $str .= "$char\r\n";
}
- $str.= str_repeat('z', 100);
+ $str .= str_repeat('z', 100);
$ansi = new ANSI();
$ansi->appendString($str);
diff --git a/tests/Unit/File/ASN1Test.php b/tests/Unit/File/ASN1Test.php
index 1d5b6161..7e080a99 100644
--- a/tests/Unit/File/ASN1Test.php
+++ b/tests/Unit/File/ASN1Test.php
@@ -1,4 +1,5 @@
* @copyright 2014 Jim Wigginton
diff --git a/tests/Unit/File/X509/CRLTest.php b/tests/Unit/File/X509/CRLTest.php
index 12ff839f..0a7d9e81 100644
--- a/tests/Unit/File/X509/CRLTest.php
+++ b/tests/Unit/File/X509/CRLTest.php
@@ -1,4 +1,5 @@
* @copyright 2017 Jim Wigginton
diff --git a/tests/Unit/File/X509/CSRTest.php b/tests/Unit/File/X509/CSRTest.php
index d3a14ab3..8c9a1c99 100644
--- a/tests/Unit/File/X509/CSRTest.php
+++ b/tests/Unit/File/X509/CSRTest.php
@@ -1,4 +1,5 @@
* @copyright 2014 Jim Wigginton
@@ -130,7 +131,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
*/
public function testPKCS1CSR()
{
- $x509 = new X509;
+ $x509 = new X509();
$x509->loadCSR('-----BEGIN CERTIFICATE REQUEST-----
MIICijCCAXICAQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx
ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDCCASIwDQYJKoZIhvcN
@@ -156,7 +157,7 @@ fUQvcGEA9FSQ8Y0nfF9vzzcCjLtOI6xJluYL9XCk8WVEBEawA2zmHWTzzuHFHHEM
*/
public function testPSSCSR()
{
- $x509 = new X509;
+ $x509 = new X509();
$x509->loadCSR('-----BEGIN CERTIFICATE REQUEST-----
MIICuTCCAXACAQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx
ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDCCASAwCwYJKoZIhvcN
diff --git a/tests/Unit/File/X509/SPKACTest.php b/tests/Unit/File/X509/SPKACTest.php
index bf49fd37..46c09010 100644
--- a/tests/Unit/File/X509/SPKACTest.php
+++ b/tests/Unit/File/X509/SPKACTest.php
@@ -1,4 +1,5 @@
* @copyright 2014 Jim Wigginton
diff --git a/tests/Unit/File/X509/X509ExtensionTest.php b/tests/Unit/File/X509/X509ExtensionTest.php
index 74a062db..0c2a00d0 100644
--- a/tests/Unit/File/X509/X509ExtensionTest.php
+++ b/tests/Unit/File/X509/X509ExtensionTest.php
@@ -1,4 +1,5 @@
* @copyright 2014 Jim Wigginton
diff --git a/tests/Unit/File/X509/X509Test.php b/tests/Unit/File/X509/X509Test.php
index eb1318b2..95934095 100644
--- a/tests/Unit/File/X509/X509Test.php
+++ b/tests/Unit/File/X509/X509Test.php
@@ -1,4 +1,5 @@
* @copyright 2014 Jim Wigginton
@@ -137,7 +138,7 @@ IOkKcGQRCMha8X2e7GmlpdWC1ycenlbN0nbVeSv3JUMcafC4+Q==
$value = ASN1::encodeOID('1.2.3.4');
$ext = chr(ASN1::TYPE_OBJECT_IDENTIFIER) . ASN1::encodeLength(strlen($value)) . $value;
$value = 'zzzzzzzzz';
- $ext.= chr(ASN1::TYPE_OCTET_STRING) . ASN1::encodeLength(strlen($value)) . $value;
+ $ext .= chr(ASN1::TYPE_OCTET_STRING) . ASN1::encodeLength(strlen($value)) . $value;
$ext = chr(ASN1::TYPE_SEQUENCE | 0x20) . ASN1::encodeLength(strlen($ext)) . $ext;
$cert['tbsCertificate']['extensions'][4] = new Element($ext);
@@ -1189,7 +1190,7 @@ qzFkAKWjJj4KjfrbZX4C0Spfxw==
$key = ASN1::encodeDER($key, ['type' => ASN1::TYPE_BIT_STRING]);
$key = new Element($key);
- $x509 = new X509;
+ $x509 = new X509();
$this->assertIsString($x509->computeKeyIdentifier($key));
}
@@ -1241,15 +1242,15 @@ QwinX0cR9Hx84rSMrFndxZi52o9EOLJ7cithncoW1KOAf7lIJIUzP0oIKkskAndQ
o2UiZsxgoMYuq02T07DOknc=
-----END ENCRYPTED PRIVATE KEY-----', 'demo');
- $subject = new X509;
+ $subject = new X509();
$subject->setDNProp('id-at-organizationName', 'phpseclib demo cert');
$subject->setPublicKey($private->getPublicKey());
- $issuer = new X509;
+ $issuer = new X509();
$issuer->setPrivateKey($private);
$issuer->setDNProp('id-at-organizationName', 'phpseclib CA cert');
- $x509 = new X509;
+ $x509 = new X509();
$x509->sign($issuer, $subject);
}
diff --git a/tests/Unit/Math/BigInteger/BCMathTest.php b/tests/Unit/Math/BigInteger/BCMathTest.php
index 5870a3f3..15d2312a 100644
--- a/tests/Unit/Math/BigInteger/BCMathTest.php
+++ b/tests/Unit/Math/BigInteger/BCMathTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
diff --git a/tests/Unit/Math/BigInteger/DefaultTest.php b/tests/Unit/Math/BigInteger/DefaultTest.php
index 868e6b2a..627577ad 100644
--- a/tests/Unit/Math/BigInteger/DefaultTest.php
+++ b/tests/Unit/Math/BigInteger/DefaultTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
diff --git a/tests/Unit/Math/BigInteger/GMPTest.php b/tests/Unit/Math/BigInteger/GMPTest.php
index a10c6a9f..8668adb0 100644
--- a/tests/Unit/Math/BigInteger/GMPTest.php
+++ b/tests/Unit/Math/BigInteger/GMPTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
diff --git a/tests/Unit/Math/BigInteger/PHP32Test.php b/tests/Unit/Math/BigInteger/PHP32Test.php
index 584ef584..d85814cb 100644
--- a/tests/Unit/Math/BigInteger/PHP32Test.php
+++ b/tests/Unit/Math/BigInteger/PHP32Test.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
diff --git a/tests/Unit/Math/BigInteger/PHP64OpenSSLTest.php b/tests/Unit/Math/BigInteger/PHP64OpenSSLTest.php
index f9828f60..1171d0e7 100644
--- a/tests/Unit/Math/BigInteger/PHP64OpenSSLTest.php
+++ b/tests/Unit/Math/BigInteger/PHP64OpenSSLTest.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
diff --git a/tests/Unit/Math/BigInteger/PHP64Test.php b/tests/Unit/Math/BigInteger/PHP64Test.php
index 5caa1588..b0999866 100644
--- a/tests/Unit/Math/BigInteger/PHP64Test.php
+++ b/tests/Unit/Math/BigInteger/PHP64Test.php
@@ -1,4 +1,5 @@
* @copyright 2013 Andreas Fischer
diff --git a/tests/Unit/Math/BigInteger/TestCase.php b/tests/Unit/Math/BigInteger/TestCase.php
index bf2db6f4..3de0ce4a 100644
--- a/tests/Unit/Math/BigInteger/TestCase.php
+++ b/tests/Unit/Math/BigInteger/TestCase.php
@@ -1,4 +1,5 @@
* @copyright 2012 Andreas Fischer
@@ -20,15 +21,15 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
public function testConstructorBase16()
{
- $this->assertSame('50', (string) $this->getInstance('0x32', 16));
- $this->assertSame('12345678910', (string) $this->getInstance('0x2DFDC1C3E', 16));
- $this->assertSame('18446744073709551615', (string) $this->getInstance('0xFFFFFFFFFFFFFFFF', 16));
- $this->assertSame('18446744073709551616', (string) $this->getInstance('0x10000000000000000', 16));
+ $this->assertSame('50', (string) $this->getInstance('0x32', 16));
+ $this->assertSame('12345678910', (string) $this->getInstance('0x2DFDC1C3E', 16));
+ $this->assertSame('18446744073709551615', (string) $this->getInstance('0xFFFFFFFFFFFFFFFF', 16));
+ $this->assertSame('18446744073709551616', (string) $this->getInstance('0x10000000000000000', 16));
}
public function testConstructorBase256()
{
- $this->assertSame('-128', (string) $this->getInstance("\x80", -256));
+ $this->assertSame('-128', (string) $this->getInstance("\x80", -256));
}
public function testToBytes()
diff --git a/tests/Unit/Math/BigIntegerTest.php b/tests/Unit/Math/BigIntegerTest.php
index ee84d3a0..a79acaa3 100644
--- a/tests/Unit/Math/BigIntegerTest.php
+++ b/tests/Unit/Math/BigIntegerTest.php
@@ -8,13 +8,13 @@ use phpseclib3\Math\BigInteger\Engines\PHP64;
class Unit_Math_BigIntegerTest extends PhpseclibTestCase
{
-
- /**
- * @param string $className
- * @param bool $isValid
- */
- private static function mockEngine($className, $isValid) {
- eval(<<toString());
- }
+ static::assertSame($expectedEngineClass, $bigint->toString());
+ }
}
diff --git a/tests/Unit/Net/SFTPStreamUnitTest.php b/tests/Unit/Net/SFTPStreamUnitTest.php
index 2aa7ab21..eea7a3d3 100644
--- a/tests/Unit/Net/SFTPStreamUnitTest.php
+++ b/tests/Unit/Net/SFTPStreamUnitTest.php
@@ -1,4 +1,5 @@
* @copyright 2014 Andreas Fischer
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index bb137e4d..843a7310 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -1,4 +1,5 @@