update PHP Excel
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2014 PHPExcel
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,9 +20,9 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 1.8.0, 2014-03-02
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,128 +31,128 @@
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Worksheet
|
||||
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Worksheet_Protection
|
||||
{
|
||||
/**
|
||||
* Sheet
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_sheet = false;
|
||||
/**
|
||||
* Sheet
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $sheet = false;
|
||||
|
||||
/**
|
||||
* Objects
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_objects = false;
|
||||
/**
|
||||
* Objects
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $objects = false;
|
||||
|
||||
/**
|
||||
* Scenarios
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_scenarios = false;
|
||||
/**
|
||||
* Scenarios
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $scenarios = false;
|
||||
|
||||
/**
|
||||
* Format cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_formatCells = false;
|
||||
/**
|
||||
* Format cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $formatCells = false;
|
||||
|
||||
/**
|
||||
* Format columns
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_formatColumns = false;
|
||||
/**
|
||||
* Format columns
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $formatColumns = false;
|
||||
|
||||
/**
|
||||
* Format rows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_formatRows = false;
|
||||
/**
|
||||
* Format rows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $formatRows = false;
|
||||
|
||||
/**
|
||||
* Insert columns
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_insertColumns = false;
|
||||
/**
|
||||
* Insert columns
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $insertColumns = false;
|
||||
|
||||
/**
|
||||
* Insert rows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_insertRows = false;
|
||||
/**
|
||||
* Insert rows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $insertRows = false;
|
||||
|
||||
/**
|
||||
* Insert hyperlinks
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_insertHyperlinks = false;
|
||||
/**
|
||||
* Insert hyperlinks
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $insertHyperlinks = false;
|
||||
|
||||
/**
|
||||
* Delete columns
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_deleteColumns = false;
|
||||
/**
|
||||
* Delete columns
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $deleteColumns = false;
|
||||
|
||||
/**
|
||||
* Delete rows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_deleteRows = false;
|
||||
/**
|
||||
* Delete rows
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $deleteRows = false;
|
||||
|
||||
/**
|
||||
* Select locked cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_selectLockedCells = false;
|
||||
/**
|
||||
* Select locked cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $selectLockedCells = false;
|
||||
|
||||
/**
|
||||
* Sort
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_sort = false;
|
||||
/**
|
||||
* Sort
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $sort = false;
|
||||
|
||||
/**
|
||||
* AutoFilter
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_autoFilter = false;
|
||||
/**
|
||||
* AutoFilter
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $autoFilter = false;
|
||||
|
||||
/**
|
||||
* Pivot tables
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_pivotTables = false;
|
||||
/**
|
||||
* Pivot tables
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $pivotTables = false;
|
||||
|
||||
/**
|
||||
* Select unlocked cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_selectUnlockedCells = false;
|
||||
/**
|
||||
* Select unlocked cells
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $selectUnlockedCells = false;
|
||||
|
||||
/**
|
||||
* Password
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_password = '';
|
||||
/**
|
||||
* Password
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $password = '';
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Worksheet_Protection
|
||||
@@ -166,23 +166,24 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function isProtectionEnabled() {
|
||||
return $this->_sheet ||
|
||||
$this->_objects ||
|
||||
$this->_scenarios ||
|
||||
$this->_formatCells ||
|
||||
$this->_formatColumns ||
|
||||
$this->_formatRows ||
|
||||
$this->_insertColumns ||
|
||||
$this->_insertRows ||
|
||||
$this->_insertHyperlinks ||
|
||||
$this->_deleteColumns ||
|
||||
$this->_deleteRows ||
|
||||
$this->_selectLockedCells ||
|
||||
$this->_sort ||
|
||||
$this->_autoFilter ||
|
||||
$this->_pivotTables ||
|
||||
$this->_selectUnlockedCells;
|
||||
public function isProtectionEnabled()
|
||||
{
|
||||
return $this->sheet ||
|
||||
$this->objects ||
|
||||
$this->scenarios ||
|
||||
$this->formatCells ||
|
||||
$this->formatColumns ||
|
||||
$this->formatRows ||
|
||||
$this->insertColumns ||
|
||||
$this->insertRows ||
|
||||
$this->insertHyperlinks ||
|
||||
$this->deleteColumns ||
|
||||
$this->deleteRows ||
|
||||
$this->selectLockedCells ||
|
||||
$this->sort ||
|
||||
$this->autoFilter ||
|
||||
$this->pivotTables ||
|
||||
$this->selectUnlockedCells;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,8 +191,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getSheet() {
|
||||
return $this->_sheet;
|
||||
public function getSheet()
|
||||
{
|
||||
return $this->sheet;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,9 +202,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setSheet($pValue = false) {
|
||||
$this->_sheet = $pValue;
|
||||
return $this;
|
||||
public function setSheet($pValue = false)
|
||||
{
|
||||
$this->sheet = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,8 +213,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getObjects() {
|
||||
return $this->_objects;
|
||||
public function getObjects()
|
||||
{
|
||||
return $this->objects;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,9 +224,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setObjects($pValue = false) {
|
||||
$this->_objects = $pValue;
|
||||
return $this;
|
||||
public function setObjects($pValue = false)
|
||||
{
|
||||
$this->objects = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,8 +235,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getScenarios() {
|
||||
return $this->_scenarios;
|
||||
public function getScenarios()
|
||||
{
|
||||
return $this->scenarios;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,9 +246,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setScenarios($pValue = false) {
|
||||
$this->_scenarios = $pValue;
|
||||
return $this;
|
||||
public function setScenarios($pValue = false)
|
||||
{
|
||||
$this->scenarios = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -250,8 +257,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getFormatCells() {
|
||||
return $this->_formatCells;
|
||||
public function getFormatCells()
|
||||
{
|
||||
return $this->formatCells;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,9 +268,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setFormatCells($pValue = false) {
|
||||
$this->_formatCells = $pValue;
|
||||
return $this;
|
||||
public function setFormatCells($pValue = false)
|
||||
{
|
||||
$this->formatCells = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -270,8 +279,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getFormatColumns() {
|
||||
return $this->_formatColumns;
|
||||
public function getFormatColumns()
|
||||
{
|
||||
return $this->formatColumns;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,9 +290,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setFormatColumns($pValue = false) {
|
||||
$this->_formatColumns = $pValue;
|
||||
return $this;
|
||||
public function setFormatColumns($pValue = false)
|
||||
{
|
||||
$this->formatColumns = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,8 +301,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getFormatRows() {
|
||||
return $this->_formatRows;
|
||||
public function getFormatRows()
|
||||
{
|
||||
return $this->formatRows;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,9 +312,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setFormatRows($pValue = false) {
|
||||
$this->_formatRows = $pValue;
|
||||
return $this;
|
||||
public function setFormatRows($pValue = false)
|
||||
{
|
||||
$this->formatRows = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -310,8 +323,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getInsertColumns() {
|
||||
return $this->_insertColumns;
|
||||
public function getInsertColumns()
|
||||
{
|
||||
return $this->insertColumns;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,9 +334,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setInsertColumns($pValue = false) {
|
||||
$this->_insertColumns = $pValue;
|
||||
return $this;
|
||||
public function setInsertColumns($pValue = false)
|
||||
{
|
||||
$this->insertColumns = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,8 +345,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getInsertRows() {
|
||||
return $this->_insertRows;
|
||||
public function getInsertRows()
|
||||
{
|
||||
return $this->insertRows;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,9 +356,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setInsertRows($pValue = false) {
|
||||
$this->_insertRows = $pValue;
|
||||
return $this;
|
||||
public function setInsertRows($pValue = false)
|
||||
{
|
||||
$this->insertRows = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -350,8 +367,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getInsertHyperlinks() {
|
||||
return $this->_insertHyperlinks;
|
||||
public function getInsertHyperlinks()
|
||||
{
|
||||
return $this->insertHyperlinks;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -360,9 +378,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setInsertHyperlinks($pValue = false) {
|
||||
$this->_insertHyperlinks = $pValue;
|
||||
return $this;
|
||||
public function setInsertHyperlinks($pValue = false)
|
||||
{
|
||||
$this->insertHyperlinks = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -370,8 +389,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getDeleteColumns() {
|
||||
return $this->_deleteColumns;
|
||||
public function getDeleteColumns()
|
||||
{
|
||||
return $this->deleteColumns;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -380,9 +400,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setDeleteColumns($pValue = false) {
|
||||
$this->_deleteColumns = $pValue;
|
||||
return $this;
|
||||
public function setDeleteColumns($pValue = false)
|
||||
{
|
||||
$this->deleteColumns = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -390,8 +411,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getDeleteRows() {
|
||||
return $this->_deleteRows;
|
||||
public function getDeleteRows()
|
||||
{
|
||||
return $this->deleteRows;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -400,9 +422,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setDeleteRows($pValue = false) {
|
||||
$this->_deleteRows = $pValue;
|
||||
return $this;
|
||||
public function setDeleteRows($pValue = false)
|
||||
{
|
||||
$this->deleteRows = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -410,8 +433,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getSelectLockedCells() {
|
||||
return $this->_selectLockedCells;
|
||||
public function getSelectLockedCells()
|
||||
{
|
||||
return $this->selectLockedCells;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -420,9 +444,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setSelectLockedCells($pValue = false) {
|
||||
$this->_selectLockedCells = $pValue;
|
||||
return $this;
|
||||
public function setSelectLockedCells($pValue = false)
|
||||
{
|
||||
$this->selectLockedCells = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -430,8 +455,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getSort() {
|
||||
return $this->_sort;
|
||||
public function getSort()
|
||||
{
|
||||
return $this->sort;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -440,9 +466,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setSort($pValue = false) {
|
||||
$this->_sort = $pValue;
|
||||
return $this;
|
||||
public function setSort($pValue = false)
|
||||
{
|
||||
$this->sort = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -450,8 +477,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getAutoFilter() {
|
||||
return $this->_autoFilter;
|
||||
public function getAutoFilter()
|
||||
{
|
||||
return $this->autoFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -460,9 +488,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setAutoFilter($pValue = false) {
|
||||
$this->_autoFilter = $pValue;
|
||||
return $this;
|
||||
public function setAutoFilter($pValue = false)
|
||||
{
|
||||
$this->autoFilter = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -470,8 +499,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getPivotTables() {
|
||||
return $this->_pivotTables;
|
||||
public function getPivotTables()
|
||||
{
|
||||
return $this->pivotTables;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -480,9 +510,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setPivotTables($pValue = false) {
|
||||
$this->_pivotTables = $pValue;
|
||||
return $this;
|
||||
public function setPivotTables($pValue = false)
|
||||
{
|
||||
$this->pivotTables = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -490,8 +521,9 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function getSelectUnlockedCells() {
|
||||
return $this->_selectUnlockedCells;
|
||||
public function getSelectUnlockedCells()
|
||||
{
|
||||
return $this->selectUnlockedCells;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -500,9 +532,10 @@ class PHPExcel_Worksheet_Protection
|
||||
* @param boolean $pValue
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setSelectUnlockedCells($pValue = false) {
|
||||
$this->_selectUnlockedCells = $pValue;
|
||||
return $this;
|
||||
public function setSelectUnlockedCells($pValue = false)
|
||||
{
|
||||
$this->selectUnlockedCells = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -510,36 +543,39 @@ class PHPExcel_Worksheet_Protection
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getPassword() {
|
||||
return $this->_password;
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Password
|
||||
*
|
||||
* @param string $pValue
|
||||
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
|
||||
* @param string $pValue
|
||||
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
|
||||
* @return PHPExcel_Worksheet_Protection
|
||||
*/
|
||||
function setPassword($pValue = '', $pAlreadyHashed = false) {
|
||||
if (!$pAlreadyHashed) {
|
||||
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
||||
}
|
||||
$this->_password = $pValue;
|
||||
return $this;
|
||||
public function setPassword($pValue = '', $pAlreadyHashed = false)
|
||||
{
|
||||
if (!$pAlreadyHashed) {
|
||||
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
|
||||
}
|
||||
$this->password = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user