Modifying private visibility to protected in order to provide better extensibility

This commit is contained in:
Mark Baker 2013-06-21 23:31:29 +01:00
parent 11e33b2307
commit 5b921af905
13 changed files with 105 additions and 109 deletions

View File

@ -155,18 +155,17 @@ class Autoloader
*/
public function loadClass($className)
{
if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) {
$fileName = '';
$namespace = '';
if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension;
require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName;
}
if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) {
$fileName = '';
$namespace = '';
if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName = str_replace(array('\\','_'), DIRECTORY_SEPARATOR, $className) . $this->_fileExtension;
require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName;
}
}
}

View File

@ -29,15 +29,15 @@ namespace PHPExcel;
/** PHPOffice root directory */
if (!defined('PHPEXCEL_ROOT')) {
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/');
define('PHPEXCEL_ROOT', dirname(__FILE__));
}
include PHPEXCEL_ROOT . 'Autoloader.php';
include PHPEXCEL_ROOT . '/Autoloader.php';
$autoloader = new Autoloader('PHPExcel', PHPEXCEL_ROOT);
$autoloader->register();
// As we always try to run the autoloader before anything else, we can use it to do a few
// As we always run the bootstrap before anything else, we can use it to do a few
// simple checks and initialisations
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
@ -45,4 +45,3 @@ if (ini_get('mbstring.func_overload') & 2) {
}
Shared_String::buildCharacterSets();

View File

@ -50,14 +50,14 @@ class Cell
*
* @var PHPExcel\Cell_IValueBinder
*/
private static $_valueBinder = NULL;
protected static $_valueBinder = NULL;
/**
* Value of the cell
*
* @var mixed
*/
private $_value;
protected $_value;
/**
* Calculated value of the cell (used for caching)
@ -69,34 +69,34 @@ class Cell
*
* @var mixed
*/
private $_calculatedValue = NULL;
protected $_calculatedValue = NULL;
/**
* Type of the cell data
*
* @var string
*/
private $_dataType;
protected $_dataType;
/**
* Parent worksheet
*
* @var PHPExcel\CachedObjectStorage_CacheBase
*/
private $_parent;
protected $_parent;
/**
* Index to cellXf
*
* @var int
*/
private $_xfIndex;
protected $_xfIndex;
/**
* Attributes of the formula
*
*/
private $_formulaAttributes;
protected $_formulaAttributes;
/**

View File

@ -42,63 +42,63 @@ class Comment implements IComparable
*
* @var string
*/
private $_author;
protected $_author;
/**
* Rich text comment
*
* @var PHPExcel\RichText
*/
private $_text;
protected $_text;
/**
* Comment width (CSS style, i.e. XXpx or YYpt)
*
* @var string
*/
private $_width = '96pt';
protected $_width = '96pt';
/**
* Left margin (CSS style, i.e. XXpx or YYpt)
*
* @var string
*/
private $_marginLeft = '59.25pt';
protected $_marginLeft = '59.25pt';
/**
* Top margin (CSS style, i.e. XXpx or YYpt)
*
* @var string
*/
private $_marginTop = '1.5pt';
protected $_marginTop = '1.5pt';
/**
* Visible
*
* @var boolean
*/
private $_visible = false;
protected $_visible = false;
/**
* Comment height (CSS style, i.e. XXpx or YYpt)
*
* @var string
*/
private $_height = '55.5pt';
protected $_height = '55.5pt';
/**
* Comment fill color
*
* @var PHPExcel\Style_Color
*/
private $_fillColor;
protected $_fillColor;
/**
* Alignment
*
* @var string
*/
private $_alignment;
protected $_alignment;
/**
* Create a new PHPExcel\Comment

View File

@ -50,84 +50,84 @@ class DocumentProperties
*
* @var string
*/
private $_creator = 'Unknown Creator';
protected $_creator = 'Unknown Creator';
/**
* LastModifiedBy
*
* @var string
*/
private $_lastModifiedBy;
protected $_lastModifiedBy;
/**
* Created
*
* @var datetime
*/
private $_created;
protected $_created;
/**
* Modified
*
* @var datetime
*/
private $_modified;
protected $_modified;
/**
* Title
*
* @var string
*/
private $_title = 'Untitled Spreadsheet';
protected $_title = 'Untitled Spreadsheet';
/**
* Description
*
* @var string
*/
private $_description = '';
protected $_description = '';
/**
* Subject
*
* @var string
*/
private $_subject = '';
protected $_subject = '';
/**
* Keywords
*
* @var string
*/
private $_keywords = '';
protected $_keywords = '';
/**
* Category
*
* @var string
*/
private $_category = '';
protected $_category = '';
/**
* Manager
*
* @var string
*/
private $_manager = '';
protected $_manager = '';
/**
* Company
*
* @var string
*/
private $_company = 'Microsoft Corporation';
protected $_company = 'Microsoft Corporation';
/**
* Custom Properties
*
* @var string
*/
private $_customProperties = array();
protected $_customProperties = array();
/**

View File

@ -42,35 +42,35 @@ class DocumentSecurity
*
* @var boolean
*/
private $_lockRevision;
protected $_lockRevision;
/**
* LockStructure
*
* @var boolean
*/
private $_lockStructure;
protected $_lockStructure;
/**
* LockWindows
*
* @var boolean
*/
private $_lockWindows;
protected $_lockWindows;
/**
* RevisionsPassword
*
* @var string
*/
private $_revisionsPassword;
protected $_revisionsPassword;
/**
* WorkbookPassword
*
* @var string
*/
private $_workbookPassword;
protected $_workbookPassword;
/**
* Create a new PHPExcel\DocumentSecurity

View File

@ -41,10 +41,9 @@ class IOFactory
* Search locations
*
* @var array
* @access private
* @static
*/
private static $_searchLocations = array(
protected static $_searchLocations = array(
array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'Writer_{0}' ),
array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'Reader_{0}' )
);
@ -53,10 +52,9 @@ class IOFactory
* Autoresolve classes
*
* @var array
* @access private
* @static
*/
private static $_autoResolveClasses = array(
protected static $_autoResolveClasses = array(
'Excel2007',
'Excel5',
'Excel2003XML',

View File

@ -42,35 +42,35 @@ class NamedRange
*
* @var string
*/
private $_name;
protected $_name;
/**
* Worksheet on which the named range can be resolved
*
* @var PHPExcel\Worksheet
*/
private $_worksheet;
protected $_worksheet;
/**
* Range of the referenced cells
*
* @var string
*/
private $_range;
protected $_range;
/**
* Is the named range local? (i.e. can only be used on $this->_worksheet)
*
* @var bool
*/
private $_localOnly;
protected $_localOnly;
/**
* Scope
*
* @var PHPExcel\Worksheet
*/
private $_scope;
protected $_scope;
/**
* Create a new NamedRange

View File

@ -110,7 +110,7 @@ class Reader_HTML extends Reader_Abstract implements Reader_IReader
{
// Reading 2048 bytes should be enough to validate that the format is HTML
$data = fread($this->_fileHandle, 2048);
if ((strpos('<',$data) !== FALSE) &&
if ((strpos($data, '<') !== FALSE) &&
(strlen($data) !== strlen(strip_tags($data)))) {
return TRUE;
}

View File

@ -42,7 +42,7 @@ class RichText implements IComparable
*
* @var PHPExcel\RichText_ITextElement[]
*/
private $_richTextElements;
protected $_richTextElements;
/**
* Create a new PHPExcel\RichText instance

View File

@ -44,11 +44,11 @@ class Settings
const PDF_RENDERER_MPDF = 'mPDF';
private static $_chartRenderers = array(
protected static $_chartRenderers = array(
self::CHART_RENDERER_JPGRAPH,
);
private static $_pdfRenderers = array(
protected static $_pdfRenderers = array(
self::PDF_RENDERER_TCPDF,
self::PDF_RENDERER_DOMPDF,
self::PDF_RENDERER_MPDF,
@ -62,7 +62,7 @@ class Settings
*
* @var string
*/
private static $_zipClass = self::ZIPARCHIVE;
protected static $_zipClass = self::ZIPARCHIVE;
/**
@ -72,14 +72,14 @@ class Settings
*
* @var string
*/
private static $_chartRendererName = NULL;
protected static $_chartRendererName = NULL;
/**
* Directory Path to the external Library used for rendering charts
*
* @var string
*/
private static $_chartRendererPath = NULL;
protected static $_chartRendererPath = NULL;
/**
@ -89,14 +89,14 @@ class Settings
*
* @var string
*/
private static $_pdfRendererName = NULL;
protected static $_pdfRendererName = NULL;
/**
* Directory Path to the external Library used for rendering PDF files
*
* @var string
*/
private static $_pdfRendererPath = NULL;
protected static $_pdfRendererPath = NULL;
/**

View File

@ -52,280 +52,280 @@ class Worksheet implements IComparable
*
* @var array
*/
private static $_invalidCharacters = array('*', ':', '/', '\\', '?', '[', ']');
protected static $_invalidCharacters = array('*', ':', '/', '\\', '?', '[', ']');
/**
* Parent spreadsheet
*
* @var PHPExcel
*/
private $_parent;
protected $_parent;
/**
* Cacheable collection of cells
*
* @var PHPExcel\CachedObjectStorage_xxx
*/
private $_cellCollection = null;
protected $_cellCollection = null;
/**
* Collection of row dimensions
*
* @var PHPExcel\Worksheet_RowDimension[]
*/
private $_rowDimensions = array();
protected $_rowDimensions = array();
/**
* Default row dimension
*
* @var PHPExcel\Worksheet_RowDimension
*/
private $_defaultRowDimension = null;
protected $_defaultRowDimension = null;
/**
* Collection of column dimensions
*
* @var PHPExcel\Worksheet_ColumnDimension[]
*/
private $_columnDimensions = array();
protected $_columnDimensions = array();
/**
* Default column dimension
*
* @var PHPExcel\Worksheet_ColumnDimension
*/
private $_defaultColumnDimension = null;
protected $_defaultColumnDimension = null;
/**
* Collection of drawings
*
* @var PHPExcel\Worksheet_BaseDrawing[]
*/
private $_drawingCollection = null;
protected $_drawingCollection = null;
/**
* Collection of Chart objects
*
* @var PHPExcel\Chart[]
*/
private $_chartCollection = array();
protected $_chartCollection = array();
/**
* Worksheet title
*
* @var string
*/
private $_title;
protected $_title;
/**
* Sheet state
*
* @var string
*/
private $_sheetState;
protected $_sheetState;
/**
* Page setup
*
* @var PHPExcel\Worksheet_PageSetup
*/
private $_pageSetup;
protected $_pageSetup;
/**
* Page margins
*
* @var PHPExcel\Worksheet_PageMargins
*/
private $_pageMargins;
protected $_pageMargins;
/**
* Page header/footer
*
* @var PHPExcel\Worksheet_HeaderFooter
*/
private $_headerFooter;
protected $_headerFooter;
/**
* Sheet view
*
* @var PHPExcel\Worksheet_SheetView
*/
private $_sheetView;
protected $_sheetView;
/**
* Protection
*
* @var PHPExcel\Worksheet_Protection
*/
private $_protection;
protected $_protection;
/**
* Collection of styles
*
* @var PHPExcel\Style[]
*/
private $_styles = array();
protected $_styles = array();
/**
* Conditional styles. Indexed by cell coordinate, e.g. 'A1'
*
* @var array
*/
private $_conditionalStylesCollection = array();
protected $_conditionalStylesCollection = array();
/**
* Is the current cell collection sorted already?
*
* @var boolean
*/
private $_cellCollectionIsSorted = false;
protected $_cellCollectionIsSorted = false;
/**
* Collection of breaks
*
* @var array
*/
private $_breaks = array();
protected $_breaks = array();
/**
* Collection of merged cell ranges
*
* @var array
*/
private $_mergeCells = array();
protected $_mergeCells = array();
/**
* Collection of protected cell ranges
*
* @var array
*/
private $_protectedCells = array();
protected $_protectedCells = array();
/**
* Autofilter Range and selection
*
* @var PHPExcel\Worksheet_AutoFilter
*/
private $_autoFilter = NULL;
protected $_autoFilter = NULL;
/**
* Freeze pane
*
* @var string
*/
private $_freezePane = '';
protected $_freezePane = '';
/**
* Show gridlines?
*
* @var boolean
*/
private $_showGridlines = true;
protected $_showGridlines = true;
/**
* Print gridlines?
*
* @var boolean
*/
private $_printGridlines = false;
protected $_printGridlines = false;
/**
* Show row and column headers?
*
* @var boolean
*/
private $_showRowColHeaders = true;
protected $_showRowColHeaders = true;
/**
* Show summary below? (Row/Column outline)
*
* @var boolean
*/
private $_showSummaryBelow = true;
protected $_showSummaryBelow = true;
/**
* Show summary right? (Row/Column outline)
*
* @var boolean
*/
private $_showSummaryRight = true;
protected $_showSummaryRight = true;
/**
* Collection of comments
*
* @var PHPExcel\Comment[]
*/
private $_comments = array();
protected $_comments = array();
/**
* Active cell. (Only one!)
*
* @var string
*/
private $_activeCell = 'A1';
protected $_activeCell = 'A1';
/**
* Selected cells
*
* @var string
*/
private $_selectedCells = 'A1';
protected $_selectedCells = 'A1';
/**
* Cached highest column
*
* @var string
*/
private $_cachedHighestColumn = 'A';
protected $_cachedHighestColumn = 'A';
/**
* Cached highest row
*
* @var int
*/
private $_cachedHighestRow = 1;
protected $_cachedHighestRow = 1;
/**
* Right-to-left?
*
* @var boolean
*/
private $_rightToLeft = false;
protected $_rightToLeft = false;
/**
* Hyperlinks. Indexed by cell coordinate, e.g. 'A1'
*
* @var array
*/
private $_hyperlinkCollection = array();
protected $_hyperlinkCollection = array();
/**
* Data validation objects. Indexed by cell coordinate, e.g. 'A1'
*
* @var array
*/
private $_dataValidationCollection = array();
protected $_dataValidationCollection = array();
/**
* Tab color
*
* @var PHPExcel\Style_Color
*/
private $_tabColor;
protected $_tabColor;
/**
* Dirty flag
*
* @var boolean
*/
private $_dirty = true;
protected $_dirty = true;
/**
* Hash
*
* @var string
*/
private $_hash = null;
protected $_hash = null;
/**
* Create a new worksheet

View File

@ -44,14 +44,14 @@ class WorksheetIterator implements \Iterator
*
* @var PHPExcel
*/
private $_subject;
protected $_subject;
/**
* Current iterator position
*
* @var int
*/
private $_position = 0;
protected $_position = 0;
/**
* Create a new worksheet iterator