Remove references except where they're actually used

This commit is contained in:
Alexey Kopytko 2016-06-16 11:45:57 +09:00
parent 0da21c8611
commit 779a081aa0
3 changed files with 30 additions and 25 deletions

View File

@ -67,7 +67,7 @@ class Spreadsheet_Excel_Writer_Validator
*/ */
public $_parser; public $_parser;
public function __construct(&$parser) public function __construct($parser)
{ {
$this->_parser = $parser; $this->_parser = $parser;
$this->_type = 0x01; // FIXME: add method for setting datatype $this->_type = 0x01; // FIXME: add method for setting datatype

View File

@ -207,7 +207,7 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri
$this->_string_sizeinfo = 3; $this->_string_sizeinfo = 3;
// Add the default format for hyperlinks // Add the default format for hyperlinks
$this->_url_format =& $this->addFormat(array('color' => 'blue', 'underline' => 1)); $this->_url_format = $this->addFormat(array('color' => 'blue', 'underline' => 1));
$this->_str_total = 0; $this->_str_total = 0;
$this->_str_unique = 0; $this->_str_unique = 0;
$this->_str_table = array(); $this->_str_table = array();
@ -320,7 +320,7 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri
* @return mixed reference to a worksheet object on success, PEAR_Error * @return mixed reference to a worksheet object on success, PEAR_Error
* on failure * on failure
*/ */
public function &addWorksheet($name = '') public function addWorksheet($name = '')
{ {
$index = count($this->_worksheets); $index = count($this->_worksheets);
$sheetname = $this->_sheetname; $sheetname = $this->_sheetname;
@ -356,7 +356,7 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri
$this->_str_table, $this->_url_format, $this->_str_table, $this->_url_format,
$this->_parser, $this->_tmp_dir); $this->_parser, $this->_tmp_dir);
$this->_worksheets[$index] = &$worksheet; // Store ref for iterator $this->_worksheets[$index] = $worksheet; // Store ref for iterator
$this->_sheetnames[$index] = $name; // Store EXTERNSHEET names $this->_sheetnames[$index] = $name; // Store EXTERNSHEET names
$this->_parser->setExtSheet($name, $index); // Register worksheet name with parser $this->_parser->setExtSheet($name, $index); // Register worksheet name with parser
return $worksheet; return $worksheet;
@ -368,13 +368,13 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri
* *
* @access public * @access public
* @param array $properties array with properties for initializing the format. * @param array $properties array with properties for initializing the format.
* @return &Spreadsheet_Excel_Writer_Format reference to an Excel Format * @return Spreadsheet_Excel_Writer_Format
*/ */
public function &addFormat($properties = array()) public function addFormat($properties = array())
{ {
$format = new Spreadsheet_Excel_Writer_Format($this->_BIFF_version, $this->_xf_index, $properties); $format = new Spreadsheet_Excel_Writer_Format($this->_BIFF_version, $this->_xf_index, $properties);
$this->_xf_index += 1; $this->_xf_index += 1;
$this->_formats[] = &$format; $this->_formats[] = $format;
return $format; return $format;
} }
@ -382,9 +382,9 @@ class Spreadsheet_Excel_Writer_Workbook extends Spreadsheet_Excel_Writer_BIFFwri
* Create new validator. * Create new validator.
* *
* @access public * @access public
* @return &Spreadsheet_Excel_Writer_Validator reference to a Validator * @return Spreadsheet_Excel_Writer_Validator
*/ */
public function &addValidator() public function addValidator()
{ {
if (!class_exists('Spreadsheet_Excel_Writer_Validator')) { if (!class_exists('Spreadsheet_Excel_Writer_Validator')) {
include_once 'Spreadsheet/Excel/Writer/Validator.php'; include_once 'Spreadsheet/Excel/Writer/Validator.php';

View File

@ -380,18 +380,21 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
* *
* @param string $name The name of the new worksheet * @param string $name The name of the new worksheet
* @param integer $index The index of the new worksheet * @param integer $index The index of the new worksheet
* @param mixed &$activesheet The current activesheet of the workbook we belong to * @param mixed $activesheet The current activesheet of the workbook we belong to
* @param mixed &$firstsheet The first worksheet in the workbook we belong to * @param mixed $firstsheet The first worksheet in the workbook we belong to
* @param mixed &$url_format The default format for hyperlinks * @param int &$str_total Reference to the total number of strings in the workbook
* @param mixed &$parser The formula parser created for the Workbook * @param int &$str_unique Reference to the number of unique strings in the workbook
* @param array &$str_table Reference to the array containing all the unique strings in the workbook
* @param mixed $url_format The default format for hyperlinks
* @param mixed $parser The formula parser created for the Workbook
* @param string $tmp_dir The path to the directory for temporary files * @param string $tmp_dir The path to the directory for temporary files
* @access private * @access private
*/ */
public function __construct($BIFF_version, $name, public function __construct($BIFF_version, $name,
$index, &$activesheet, $index, $activesheet,
&$firstsheet, &$str_total, $firstsheet, &$str_total,
&$str_unique, &$str_table, &$str_unique, &$str_table,
&$url_format, &$parser, $url_format, $parser,
$tmp_dir) $tmp_dir)
{ {
// It needs to call its parent's constructor explicitly // It needs to call its parent's constructor explicitly
@ -402,13 +405,15 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
$this->name = $name; $this->name = $name;
$this->index = $index; $this->index = $index;
$this->activesheet = &$activesheet; $this->activesheet = $activesheet;
$this->firstsheet = &$firstsheet; $this->firstsheet = $firstsheet;
// _str_total _str_unique _str_table - are actual references
// everything breaks if they're not
$this->_str_total = &$str_total; $this->_str_total = &$str_total;
$this->_str_unique = &$str_unique; $this->_str_unique = &$str_unique;
$this->_str_table = &$str_table; $this->_str_table = &$str_table;
$this->_url_format = &$url_format; $this->_url_format = $url_format;
$this->_parser = &$parser; $this->_parser = $parser;
//$this->ext_sheets = array(); //$this->ext_sheets = array();
$this->_filehandle = ''; $this->_filehandle = '';
@ -804,7 +809,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
// if the new range lies WITHIN the existing range // if the new range lies WITHIN the existing range
if ($lastcol < $existing_end) if ($lastcol < $existing_end)
{ // split the existing range by adding a range after our new range { // split the existing range by adding a range after our new range
$this->_colinfo[] = array($lastcol+1, $existing_end, $colinfo[2], &$colinfo[3], $colinfo[4], $colinfo[5]); $this->_colinfo[] = array($lastcol+1, $existing_end, $colinfo[2], /* format */ $colinfo[3], $colinfo[4], $colinfo[5]);
} }
} // if the new range ends inside an existing range } // if the new range ends inside an existing range
elseif ($lastcol > $existing_start && $lastcol < $existing_end) elseif ($lastcol > $existing_start && $lastcol < $existing_end)
@ -818,7 +823,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
} // added by Dan Lynn <dan@spiderweblabs.com) on 2006-12-06 } // added by Dan Lynn <dan@spiderweblabs.com) on 2006-12-06
// regenerate keys // regenerate keys
$this->_colinfo = array_values($this->_colinfo); $this->_colinfo = array_values($this->_colinfo);
$this->_colinfo[] = array($firstcol, $lastcol, $width, &$format, $hidden, $level); $this->_colinfo[] = array($firstcol, $lastcol, $width, $format, $hidden, $level);
// Set width to zero if column is hidden // Set width to zero if column is hidden
$width = ($hidden) ? 0 : $width; $width = ($hidden) ? 0 : $width;
for ($col = $firstcol; $col <= $lastcol; $col++) for ($col = $firstcol; $col <= $lastcol; $col++)
@ -1309,10 +1314,10 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
* Returns an index to the XF record in the workbook * Returns an index to the XF record in the workbook
* *
* @access private * @access private
* @param mixed &$format The optional XF format * @param mixed $format The optional XF format
* @return integer The XF record index * @return integer The XF record index
*/ */
protected function _XF(&$format) protected function _XF($format)
{ {
if ($format) { if ($format) {
return($format->getXfIndex()); return($format->getXfIndex());
@ -3566,7 +3571,7 @@ class Spreadsheet_Excel_Writer_Worksheet extends Spreadsheet_Excel_Writer_BIFFwr
/** /**
* FIXME: add comments * FIXME: add comments
*/ */
public function setValidation($row1, $col1, $row2, $col2, &$validator) public function setValidation($row1, $col1, $row2, $col2, $validator)
{ {
$this->_dv[] = $validator->_getData() . $this->_dv[] = $validator->_getData() .
pack("vvvvv", 1, $row1, $row2, $col1, $col2); pack("vvvvv", 1, $row1, $row2, $col1, $col2);