Files: add public / protected / private

This commit is contained in:
terrafrost 2016-12-11 08:23:59 -06:00
parent 1dfd315725
commit 242e0dcb7f
4 changed files with 279 additions and 279 deletions

View File

@ -35,7 +35,7 @@ class ANSI
* @var int
* @access private
*/
var $max_x;
private $max_x;
/**
* Max Height
@ -43,7 +43,7 @@ class ANSI
* @var int
* @access private
*/
var $max_y;
private $max_y;
/**
* Max History
@ -51,7 +51,7 @@ class ANSI
* @var int
* @access private
*/
var $max_history;
private $max_history;
/**
* History
@ -59,7 +59,7 @@ class ANSI
* @var array
* @access private
*/
var $history;
private $history;
/**
* History Attributes
@ -67,7 +67,7 @@ class ANSI
* @var array
* @access private
*/
var $history_attrs;
private $history_attrs;
/**
* Current Column
@ -75,7 +75,7 @@ class ANSI
* @var int
* @access private
*/
var $x;
private $x;
/**
* Current Row
@ -83,7 +83,7 @@ class ANSI
* @var int
* @access private
*/
var $y;
private $y;
/**
* Old Column
@ -91,7 +91,7 @@ class ANSI
* @var int
* @access private
*/
var $old_x;
private $old_x;
/**
* Old Row
@ -99,7 +99,7 @@ class ANSI
* @var int
* @access private
*/
var $old_y;
private $old_y;
/**
* An empty attribute cell
@ -107,7 +107,7 @@ class ANSI
* @var object
* @access private
*/
var $base_attr_cell;
private $base_attr_cell;
/**
* The current attribute cell
@ -115,7 +115,7 @@ class ANSI
* @var object
* @access private
*/
var $attr_cell;
private $attr_cell;
/**
* An empty attribute row
@ -123,7 +123,7 @@ class ANSI
* @var array
* @access private
*/
var $attr_row;
private $attr_row;
/**
* The current screen text
@ -131,7 +131,7 @@ class ANSI
* @var array
* @access private
*/
var $screen;
private $screen;
/**
* The current screen attributes
@ -139,7 +139,7 @@ class ANSI
* @var array
* @access private
*/
var $attrs;
private $attrs;
/**
* Current ANSI code
@ -147,7 +147,7 @@ class ANSI
* @var string
* @access private
*/
var $ansi;
private $ansi;
/**
* Tokenization
@ -155,7 +155,7 @@ class ANSI
* @var array
* @access private
*/
var $tokenization;
private $tokenization;
/**
* Default Constructor.
@ -163,7 +163,7 @@ class ANSI
* @return \phpseclib\File\ANSI
* @access public
*/
function __construct()
public function __construct()
{
$attr_cell = new \stdClass();
$attr_cell->bold = false;
@ -188,7 +188,7 @@ class ANSI
* @param int $y
* @access public
*/
function setDimensions($x, $y)
public function setDimensions($x, $y)
{
$this->max_x = $x - 1;
$this->max_y = $y - 1;
@ -207,7 +207,7 @@ class ANSI
* @param int $y
* @access public
*/
function setHistory($history)
public function setHistory($history)
{
$this->max_history = $history;
}
@ -218,7 +218,7 @@ class ANSI
* @param string $source
* @access public
*/
function loadString($source)
public function loadString($source)
{
$this->setDimensions($this->max_x + 1, $this->max_y + 1);
$this->appendString($source);
@ -230,7 +230,7 @@ class ANSI
* @param string $source
* @access public
*/
function appendString($source)
public function appendString($source)
{
$this->tokenization = [''];
for ($i = 0; $i < strlen($source); $i++) {
@ -283,7 +283,7 @@ class ANSI
case "\x1B(B": // set united states g0 character set
break;
case "\x1BE": // Move to next line
$this->_newLine();
$this->newLine();
$this->x = 0;
break;
default:
@ -379,7 +379,7 @@ class ANSI
$this->x = 0;
break;
case "\n":
$this->_newLine();
$this->newLine();
break;
case "\x08": // backspace
if ($this->x) {
@ -431,7 +431,7 @@ class ANSI
*
* @access private
*/
function _newLine()
private function newLine()
{
//if ($this->y < $this->max_y) {
// $this->y++;
@ -460,7 +460,7 @@ class ANSI
* @access private
* @return string
*/
function _processCoordinate($last_attr, $cur_attr, $char)
private function processCoordinate($last_attr, $cur_attr, $char)
{
$output = '';
@ -517,21 +517,21 @@ class ANSI
* @access private
* @return string
*/
function _getScreen()
private function getScreenHelper()
{
$output = '';
$last_attr = $this->base_attr_cell;
for ($i = 0; $i <= $this->max_y; $i++) {
for ($j = 0; $j <= $this->max_x; $j++) {
$cur_attr = $this->attrs[$i][$j];
$output.= $this->_processCoordinate($last_attr, $cur_attr, isset($this->screen[$i][$j]) ? $this->screen[$i][$j] : '');
$output.= $this->processCoordinate($last_attr, $cur_attr, isset($this->screen[$i][$j]) ? $this->screen[$i][$j] : '');
$last_attr = $this->attrs[$i][$j];
}
$output.= "\r\n";
}
$output = substr($output, 0, -2);
// close any remaining open tags
$output.= $this->_processCoordinate($last_attr, $this->base_attr_cell, '');
$output.= $this->processCoordinate($last_attr, $this->base_attr_cell, '');
return rtrim($output);
}
@ -541,9 +541,9 @@ class ANSI
* @access public
* @return string
*/
function getScreen()
public function getScreen()
{
return '<pre width="' . ($this->max_x + 1) . '" style="color: white; background: black">' . $this->_getScreen() . '</pre>';
return '<pre width="' . ($this->max_x + 1) . '" style="color: white; background: black">' . $this->getScreenHelper() . '</pre>';
}
/**
@ -552,21 +552,21 @@ class ANSI
* @access public
* @return string
*/
function getHistory()
public function getHistory()
{
$scrollback = '';
$last_attr = $this->base_attr_cell;
for ($i = 0; $i < count($this->history); $i++) {
for ($j = 0; $j <= $this->max_x + 1; $j++) {
$cur_attr = $this->history_attrs[$i][$j];
$scrollback.= $this->_processCoordinate($last_attr, $cur_attr, isset($this->history[$i][$j]) ? $this->history[$i][$j] : '');
$scrollback.= $this->processCoordinate($last_attr, $cur_attr, isset($this->history[$i][$j]) ? $this->history[$i][$j] : '');
$last_attr = $this->history_attrs[$i][$j];
}
$scrollback.= "\r\n";
}
$base_attr_cell = $this->base_attr_cell;
$this->base_attr_cell = $last_attr;
$scrollback.= $this->_getScreen();
$scrollback.= $this->getScreen();
$this->base_attr_cell = $base_attr_cell;
return '<pre width="' . ($this->max_x + 1) . '" style="color: white; background: black">' . $scrollback . '</span></pre>';

View File

@ -109,7 +109,7 @@ abstract class ASN1
* @access private
* @link http://en.wikipedia.org/wiki/Object_identifier
*/
static $oids = [];
private static $oids = [];
/**
* ASN.1 object identifier reverse mapping
@ -117,7 +117,7 @@ abstract class ASN1
* @var array
* @access private
*/
static $reverseOIDs = [];
private static $reverseOIDs = [];
/**
* Default date format
@ -126,7 +126,7 @@ abstract class ASN1
* @access private
* @link http://php.net/class.datetime
*/
static $format = 'D, d M Y H:i:s O';
private static $format = 'D, d M Y H:i:s O';
/**
* Filters
@ -135,9 +135,9 @@ abstract class ASN1
*
* @var array
* @access private
* @see self::_encode_der()
* @see self::encode_der()
*/
static $filters;
private static $filters;
/**
* Current Location of most recent ASN.1 encode process
@ -146,9 +146,9 @@ abstract class ASN1
*
* @var array
* @access private
* @see self::_encode_der()
* @see self::encode_der()
*/
static $location;
private static $location;
/**
* DER Encoded String
@ -159,7 +159,7 @@ abstract class ASN1
* @access private
* @see self::decodeDER()
*/
static $encoded;
private static $encoded;
/**
* Type mapping table for the ANY type.
@ -224,7 +224,7 @@ abstract class ASN1
* @return array
* @access public
*/
static function decodeBER($encoded)
public static function decodeBER($encoded)
{
if ($encoded instanceof Element) {
$encoded = $encoded->element;
@ -232,7 +232,7 @@ abstract class ASN1
self::$encoded = $encoded;
$decoded = [self::_decode_ber($encoded)];
$decoded = [self::decode_ber($encoded)];
// encapsulate in an array for BC with the old decodeBER
return $decoded;
@ -251,7 +251,7 @@ abstract class ASN1
* @return array
* @access private
*/
static function _decode_ber($encoded, $start = 0, $encoded_pos = 0)
private static function decode_ber($encoded, $start = 0, $encoded_pos = 0)
{
$current = ['start' => $start];
@ -328,7 +328,7 @@ abstract class ASN1
$newcontent = [];
$remainingLength = $length;
while ($remainingLength > 0) {
$temp = self::_decode_ber($content, $start, $content_pos);
$temp = self::decode_ber($content, $start, $content_pos);
$length = $temp['length'];
// end-of-content octets - see paragraph 8.1.5
if (substr($content, $content_pos + $length, 2) == "\0\0") {
@ -379,7 +379,7 @@ abstract class ASN1
if (!$constructed) {
$current['content'] = substr($content, $content_pos);
} else {
$temp = self::_decode_ber($content, $start, $content_pos);
$temp = self::decode_ber($content, $start, $content_pos);
$length-= (strlen($content) - $content_pos);
$last = count($temp) - 1;
for ($i = 0; $i < $last; $i++) {
@ -403,7 +403,7 @@ abstract class ASN1
$current['content'] = '';
$length = 0;
while (substr($content, $content_pos, 2) != "\0\0") {
$temp = self::_decode_ber($content, $length + $start, $content_pos);
$temp = self::decode_ber($content, $length + $start, $content_pos);
$content_pos += $temp['length'];
// all subtags should be octet strings
//if ($temp['type'] != self::TYPE_OCTET_STRING) {
@ -435,7 +435,7 @@ abstract class ASN1
$length = $offset + 2; // +2 for the EOC
break 2;
}
$temp = self::_decode_ber($content, $start + $offset, $content_pos);
$temp = self::decode_ber($content, $start + $offset, $content_pos);
$content_pos += $temp['length'];
$current['content'][] = $temp;
$offset+= $temp['length'];
@ -493,7 +493,7 @@ abstract class ASN1
break;
case self::TYPE_UTC_TIME:
case self::TYPE_GENERALIZED_TIME:
$current['content'] = self::_decodeTime(substr($content, $content_pos), $tag);
$current['content'] = self::decodeTime(substr($content, $content_pos), $tag);
default:
}
@ -516,7 +516,7 @@ abstract class ASN1
* @return array
* @access public
*/
static function asn1map($decoded, $mapping, $special = [])
public static function asn1map($decoded, $mapping, $special = [])
{
if (isset($mapping['explicit']) && is_array($decoded['content'])) {
$decoded = $decoded['content'][0];
@ -736,7 +736,7 @@ abstract class ASN1
case self::TYPE_UTC_TIME:
case self::TYPE_GENERALIZED_TIME:
if (isset($mapping['implicit'])) {
$decoded['content'] = self::_decodeTime($decoded['content'], $decoded['type']);
$decoded['content'] = self::decodeTime($decoded['content'], $decoded['type']);
}
return @date(self::$format, $decoded['content']);
case self::TYPE_BIT_STRING:
@ -816,10 +816,10 @@ abstract class ASN1
* @return string
* @access public
*/
static function encodeDER($source, $mapping, $special = [])
public static function encodeDER($source, $mapping, $special = [])
{
self::$location = [];
return self::_encode_der($source, $mapping, null, $special);
return self::encode_der($source, $mapping, null, $special);
}
/**
@ -832,7 +832,7 @@ abstract class ASN1
* @throws \RuntimeException if the input has an error in it
* @access private
*/
static function _encode_der($source, $mapping, $idx = null, $special = [])
private static function encode_der($source, $mapping, $idx = null, $special = [])
{
if ($source instanceof Element) {
return $source->element;
@ -863,7 +863,7 @@ abstract class ASN1
$child = $mapping['children'];
foreach ($source as $content) {
$temp = self::_encode_der($content, $child, null, $special);
$temp = self::encode_der($content, $child, null, $special);
if ($temp === false) {
return false;
}
@ -890,7 +890,7 @@ abstract class ASN1
continue;
}
$temp = self::_encode_der($source[$key], $child, $key, $special);
$temp = self::encode_der($source[$key], $child, $key, $special);
if ($temp === false) {
return false;
}
@ -931,7 +931,7 @@ abstract class ASN1
continue;
}
$temp = self::_encode_der($source[$key], $child, $key, $special);
$temp = self::encode_der($source[$key], $child, $key, $special);
if ($temp === false) {
return false;
}
@ -1063,19 +1063,19 @@ abstract class ASN1
switch (true) {
case !isset($source):
return self::_encode_der(null, ['type' => self::TYPE_NULL] + $mapping, null, $special);
return self::encode_der(null, ['type' => self::TYPE_NULL] + $mapping, null, $special);
case is_int($source):
case $source instanceof BigInteger:
return self::_encode_der($source, ['type' => self::TYPE_INTEGER] + $mapping, null, $special);
return self::encode_der($source, ['type' => self::TYPE_INTEGER] + $mapping, null, $special);
case is_float($source):
return self::_encode_der($source, ['type' => self::TYPE_REAL] + $mapping, null, $special);
return self::encode_der($source, ['type' => self::TYPE_REAL] + $mapping, null, $special);
case is_bool($source):
return self::_encode_der($source, ['type' => self::TYPE_BOOLEAN] + $mapping, null, $special);
return self::encode_der($source, ['type' => self::TYPE_BOOLEAN] + $mapping, null, $special);
case is_array($source) && count($source) == 1:
$typename = implode('', array_keys($source));
$outtype = array_search($typename, self::ANY_MAP, true);
if ($outtype !== false) {
return self::_encode_der($source[$typename], ['type' => $outtype] + $mapping, null, $special);
return self::encode_der($source[$typename], ['type' => $outtype] + $mapping, null, $special);
}
}
@ -1090,7 +1090,7 @@ abstract class ASN1
if ($filters === false) {
throw new \RuntimeException('No filters defined for ' . implode('/', $loc));
}
return self::_encode_der($source, $filters + $mapping, null, $special);
return self::encode_der($source, $filters + $mapping, null, $special);
case self::TYPE_NULL:
$value = '';
break;
@ -1140,7 +1140,7 @@ abstract class ASN1
* @param int $tag
* @return string
*/
static function _decodeTime($content, $tag)
private static function decodeTime($content, $tag)
{
/* UTCTime:
http://tools.ietf.org/html/rfc5280#section-4.1.2.5.1
@ -1187,7 +1187,7 @@ abstract class ASN1
* @access public
* @param string $format
*/
static function setTimeFormat($format)
public static function setTimeFormat($format)
{
self::$format = $format;
}
@ -1201,7 +1201,7 @@ abstract class ASN1
* @access public
* @param array $oids
*/
static function loadOIDs($oids)
public static function loadOIDs($oids)
{
self::$oids+= $oids;
self::$reverseOIDs = array_flip(self::$oids);
@ -1216,7 +1216,7 @@ abstract class ASN1
* @access public
* @param array $filters
*/
static function setFilters($filters)
public static function setFilters($filters)
{
self::$filters = $filters;
}
@ -1233,7 +1233,7 @@ abstract class ASN1
* @return string
* @access public
*/
static function convert($in, $from = self::TYPE_UTF8_STRING, $to = self::TYPE_UTF8_STRING)
public static function convert($in, $from = self::TYPE_UTF8_STRING, $to = self::TYPE_UTF8_STRING)
{
// isset(self::STRING_TYPE_SIZE[$from] returns a fatal error on PHP 5.6
if (!array_key_exists($from, self::STRING_TYPE_SIZE) || !array_key_exists($to, self::STRING_TYPE_SIZE)) {
@ -1328,7 +1328,7 @@ abstract class ASN1
* @param string $str
* @return string
*/
static function extractBER($str)
public static function extractBER($str)
{
/* X.509 certs are assumed to be base64 encoded but sometimes they'll have additional things in them
* above and beyond the ceritificate.
@ -1358,7 +1358,7 @@ abstract class ASN1
* @param string $string
* @return int
*/
static function decodeLength(&$string)
public static function decodeLength(&$string)
{
$length = ord(Strings::shift($string));
if ($length & 0x80) { // definite length, long form
@ -1379,7 +1379,7 @@ abstract class ASN1
* @param int $length
* @return string
*/
static function encodeLength($length)
public static function encodeLength($length)
{
if ($length <= 0x7F) {
return chr($length);

View File

@ -33,7 +33,7 @@ class Element
* @var string
* @access private
*/
var $element;
public $element;
/**
* Constructor
@ -42,7 +42,7 @@ class Element
* @return \phpseclib\File\ASN1\Element
* @access public
*/
function __construct($encoded)
public function __construct($encoded)
{
$this->element = $encoded;
}

File diff suppressed because it is too large Load Diff