#401 : Support for namespaces

This commit is contained in:
Progi1984 2016-03-22 16:11:05 +01:00
parent 95e6c5e264
commit 54ae9901f5
19 changed files with 58 additions and 58 deletions

View File

@ -2,8 +2,6 @@
namespace PHPExcel\Calculation;
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/trendClass.php';
/** LOG_GAMMA_X_MAX_VALUE */
define('LOG_GAMMA_X_MAX_VALUE', 2.55e305);
@ -1168,7 +1166,7 @@ class Statistical
return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
$bestFitLinear = \PHPExcel\Shared\trend\trend::calculate(\PHPExcel\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues);
return $bestFitLinear->getCorrelation();
}
@ -1326,7 +1324,7 @@ class Statistical
return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
$bestFitLinear = \PHPExcel\Shared\trend\trend::calculate(\PHPExcel\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues);
return $bestFitLinear->getCovariance();
}
@ -1612,7 +1610,7 @@ class Statistical
return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
$bestFitLinear = \PHPExcel\Shared\trend\trend::calculate(\PHPExcel\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues);
return $bestFitLinear->getValueOfYForX($xValue);
}
@ -1783,7 +1781,7 @@ class Statistical
$newValues = Functions::flattenArray($newValues);
$const = (is_null($const)) ? true : (boolean) Functions::flattenSingleValue($const);
$bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL, $yValues, $xValues, $const);
$bestFitExponential = \PHPExcel\Shared\trend\trend::calculate(\PHPExcel\Shared\trend\trend::TREND_EXPONENTIAL, $yValues, $xValues, $const);
if (empty($newValues)) {
$newValues = $bestFitExponential->getXValues();
}
@ -1907,7 +1905,7 @@ class Statistical
return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
$bestFitLinear = \PHPExcel\Shared\trend\trend::calculate(\PHPExcel\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues);
return $bestFitLinear->getIntersect();
}
@ -2029,7 +2027,7 @@ class Statistical
return 0;
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues, $const);
$bestFitLinear = \PHPExcel\Shared\trend\trend::calculate(\PHPExcel\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues, $const);
if ($stats) {
return array(
array(
@ -2095,7 +2093,7 @@ class Statistical
return 1;
}
$bestFitExponential = trendClass::calculate(trendClass::TREND_EXPONENTIAL, $yValues, $xValues, $const);
$bestFitExponential = \PHPExcel\Shared\trend\trend::calculate(\PHPExcel\Shared\trend\trend::TREND_EXPONENTIAL, $yValues, $xValues, $const);
if ($stats) {
return array(
array(
@ -2920,7 +2918,7 @@ class Statistical
return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
$bestFitLinear = \PHPExcel\Shared\trend\trend::calculate(\PHPExcel\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues);
return $bestFitLinear->getGoodnessOfFit();
}
@ -2986,7 +2984,7 @@ class Statistical
return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
$bestFitLinear = \PHPExcel\Shared\trend\trend::calculate(\PHPExcel\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues);
return $bestFitLinear->getSlope();
}
@ -3279,7 +3277,7 @@ class Statistical
return Functions::DIV0();
}
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues);
$bestFitLinear = \PHPExcel\Shared\trend\trend::calculate(\PHPExcel\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues);
return $bestFitLinear->getStdevOfResiduals();
}
@ -3422,7 +3420,7 @@ class Statistical
$newValues = Functions::flattenArray($newValues);
$const = (is_null($const)) ? true : (boolean) Functions::flattenSingleValue($const);
$bestFitLinear = trendClass::calculate(trendClass::TREND_LINEAR, $yValues, $xValues, $const);
$bestFitLinear = \PHPExcel\Shared\trend\trend::calculate(\PHPExcel\Shared\trend\trend::TREND_LINEAR, $yValues, $xValues, $const);
if (empty($newValues)) {
$newValues = $bestFitLinear->getXValues();
}

View File

@ -502,7 +502,7 @@ class TextData
* @param string $newText String to replace in defined position
* @return string
*/
public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText)
public static function REPLACE($oldText, $start, $chars, $newText)
{
$oldText = Functions::flattenSingleValue($oldText);
$start = Functions::flattenSingleValue($start);

View File

@ -1,7 +1,6 @@
<?php
namespace PHPExcel\Reader;
use PHPExcel\Shared\TimeZone;
/**
* PHPExcel_Reader_Excel2003XML

View File

@ -473,10 +473,11 @@ class OOCalc extends BaseReader implements IReader
// echo '<b>'.$key.'</b><br />';
switch ($key) {
case 'table-header-rows':
foreach ($rowData as $key => $cellData) {
foreach ($rowData as $keyRowData => $cellData) {
$rowData = $cellData;
break;
}
break;
case 'table-row':
$rowDataTableAttributes = $rowData->attributes($namespacesContent['table']);
$rowRepeats = (isset($rowDataTableAttributes['number-rows-repeated'])) ? $rowDataTableAttributes['number-rows-repeated'] : 1;

View File

@ -64,7 +64,7 @@ class Drawing
* @param \PHPExcel\Style\Font $pDefaultFont Default font of the workbook
* @return int Value in cell dimension
*/
public static function pixelsToCellDimension($pValue = 0, \PHPExcel\Style\Font $pDefaultFont)
public static function pixelsToCellDimension($pValue, \PHPExcel\Style\Font $pDefaultFont)
{
// Font name and size
$name = $pDefaultFont->getName();
@ -89,7 +89,7 @@ class Drawing
* @param \PHPExcel\Style\Font $pDefaultFont Default font of the workbook
* @return int Value in pixels
*/
public static function cellDimensionToPixels($pValue = 0, \PHPExcel\Style\Font $pDefaultFont)
public static function cellDimensionToPixels($pValue, \PHPExcel\Style\Font $pDefaultFont)
{
// Font name and size
$name = $pDefaultFont->getName();

View File

@ -1088,6 +1088,7 @@ class Matrix
} else {
throw new \PHPExcel\Calculation\Exception(self::ARGUMENT_TYPE_EXCEPTION);
}
break;
case 'array':
$M = new Matrix($args[0]);
break;

View File

@ -1,7 +1,9 @@
<?php
namespace PHPExcel\Shared\trend;
/**
* PHPExcel_Best_Fit
* bestFit
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -25,7 +27,7 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class PHPExcel_Best_Fit
class bestFit
{
/**
* Indicator flag for a calculation error

View File

@ -1,6 +1,6 @@
<?php
require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
namespace PHPExcel\Shared\trend;
/**
* PHPExcel_Exponential_Best_Fit
@ -27,7 +27,7 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
class exponentialBestFit extends bestFit
{
/**
* Algorithm type to use for best-fit

View File

@ -1,6 +1,6 @@
<?php
require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
namespace PHPExcel\Shared\trend;
/**
* PHPExcel_Linear_Best_Fit
@ -27,7 +27,7 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
class linearBestFit extends bestFit
{
/**
* Algorithm type to use for best-fit

View File

@ -1,6 +1,6 @@
<?php
require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
namespace PHPExcel\Shared\trend;
/**
* PHPExcel_Logarithmic_Best_Fit
@ -27,7 +27,7 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
class logarithmicBestFit extends bestFit
{
/**
* Algorithm type to use for best-fit

View File

@ -1,7 +1,6 @@
<?php
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/Matrix.php';
namespace PHPExcel\Shared\trend;
/**
* PHPExcel_Polynomial_Best_Fit
@ -28,7 +27,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/Matrix.php';
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
class polynomialBestFit extends bestFit
{
/**
* Algorithm type to use for best-fit

View File

@ -1,9 +1,9 @@
<?php
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php';
namespace PHPExcel\Shared\trend;
/**
* PHPExcel_Power_Best_Fit
* \PHPExcel\Shared\trend\powerBestFit
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -27,7 +27,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php';
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
class powerBestFit extends bestFit
{
/**
* Algorithm type to use for best-fit

View File

@ -1,13 +1,9 @@
<?php
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/linearBestFitClass.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/logarithmicBestFitClass.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/exponentialBestFitClass.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/powerBestFitClass.php';
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/polynomialBestFitClass.php';
namespace PHPExcel\Shared\trend;
/**
* PHPExcel_trendClass
* PHPExcel_\PHPExcel\Shared\trend\trend
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -31,7 +27,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/polynomialBestFitClass.php';
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class trendClass
class trend
{
const TREND_LINEAR = 'Linear';
const TREND_LOGARITHMIC = 'Logarithmic';
@ -73,7 +69,7 @@ class trendClass
/**
* Cached results for each method when trying to identify which provides the best fit
*
* @var PHPExcel_Best_Fit[]
* @var bestFit[]
**/
private static $trendCache = array();
@ -102,7 +98,7 @@ class trendClass
case self::TREND_EXPONENTIAL:
case self::TREND_POWER:
if (!isset(self::$trendCache[$key])) {
$className = 'PHPExcel_'.$trendType.'_Best_Fit';
$className = '\PHPExcel\Shared\trend\\'.strtolower($trendType).'BestFit';
self::$trendCache[$key] = new $className($yValues, $xValues, $const);
}
return self::$trendCache[$key];
@ -113,7 +109,7 @@ class trendClass
case self::TREND_POLYNOMIAL_6:
if (!isset(self::$trendCache[$key])) {
$order = substr($trendType, -1);
self::$trendCache[$key] = new PHPExcel_Polynomial_Best_Fit($order, $yValues, $xValues, $const);
self::$trendCache[$key] = new polynomialBestFit($order, $yValues, $xValues, $const);
}
return self::$trendCache[$key];
case self::TREND_BEST_FIT:
@ -121,14 +117,14 @@ class trendClass
// If the request is to determine the best fit regression, then we test each trend line in turn
// Start by generating an instance of each available trend method
foreach (self::$trendTypes as $trendMethod) {
$className = 'PHPExcel_'.$trendMethod.'BestFit';
$className = '\PHPExcel\Shared\trend\\'.strtolower($trendType).'BestFit';
$bestFit[$trendMethod] = new $className($yValues, $xValues, $const);
$bestFitValue[$trendMethod] = $bestFit[$trendMethod]->getGoodnessOfFit();
}
if ($trendType != self::TREND_BEST_FIT_NO_POLY) {
foreach (self::$trendTypePolynomialOrders as $trendMethod) {
$order = substr($trendMethod, -1);
$bestFit[$trendMethod] = new PHPExcel_Polynomial_Best_Fit($order, $yValues, $xValues, $const);
$bestFit[$trendMethod] = new polynomialBestFit($order, $yValues, $xValues, $const);
if ($bestFit[$trendMethod]->getError()) {
unset($bestFit[$trendMethod]);
} else {

View File

@ -126,7 +126,7 @@ class Chart extends WriterPart
*
* @throws \PHPExcel\Writer\Exception
*/
private function writeTitle(Title $title = null, $objWriter)
private function writeTitle(Title $title, $objWriter)
{
if (is_null($title)) {
return;
@ -171,7 +171,7 @@ class Chart extends WriterPart
*
* @throws \PHPExcel\Writer\Exception
*/
private function writeLegend(Legend $legend = null, $objWriter)
private function writeLegend(Legend $legend, $objWriter)
{
if (is_null($legend)) {
return;
@ -226,7 +226,7 @@ class Chart extends WriterPart
*
* @throws \PHPExcel\Writer\Exception
*/
private function writePlotArea(PlotArea $plotArea, Title $xAxisLabel = null, Title $yAxisLabel = null, $objWriter, \PHPExcel\Worksheet $pSheet, Axis $xAxis, Axis $yAxis, GridLines $majorGridlines, GridLines $minorGridlines)
private function writePlotArea(PlotArea $plotArea, Title $xAxisLabel, Title $yAxisLabel, $objWriter, \PHPExcel\Worksheet $pSheet, Axis $xAxis, Axis $yAxis, GridLines $majorGridlines, GridLines $minorGridlines)
{
if (is_null($plotArea)) {
return;
@ -270,7 +270,6 @@ class Chart extends WriterPart
if ($chartType === DataSeries::TYPE_LINECHART) {
// Line only, Line3D can't be smoothed
$objWriter->startElement('c:smooth');
$objWriter->writeAttribute('val', (integer) $plotGroup->getSmoothLine());
$objWriter->endElement();
@ -1404,7 +1403,7 @@ class Chart extends WriterPart
*
* @throws \PHPExcel\Writer\Exception
*/
private function writeLayout(Layout $layout = null, $objWriter)
private function writeLayout(Layout $layout, $objWriter)
{
$objWriter->startElement('c:layout');

View File

@ -1,5 +1,6 @@
<?php
namespace PHPExcel\Writer\Excel2007;
use PHPExcel\Chart;
/**
@ -38,7 +39,7 @@ class Drawing extends WriterPart
* @return string XML Output
* @throws \PHPExcel\Writer\Exception
*/
public function writeDrawings(\PHPExcel\Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false)
public function writeDrawings(\PHPExcel\Worksheet $pWorksheet, &$chartRef, $includeCharts = false)
{
// Create XML writer
$objWriter = null;

View File

@ -298,7 +298,7 @@ class Rels extends WriterPart
* @return string XML Output
* @throws \PHPExcel\Writer\Exception
*/
public function writeDrawingRelationships(\PHPExcel\Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false)
public function writeDrawingRelationships(\PHPExcel\Worksheet $pWorksheet, &$chartRef, $includeCharts = false)
{
// Create XML writer
$objWriter = null;

View File

@ -187,14 +187,14 @@ class Workbook extends BIFFwriter
/**
* Class constructor
*
* @param PHPExcel $phpExcel The Workbook
* @param \PHPExcel\Spreadsheet $phpExcel The Workbook
* @param int &$str_total Total number of strings
* @param int &$str_unique Total number of unique strings
* @param array &$str_table String Table
* @param array &$colors Colour Table
* @param mixed $parser The formula parser created for the Workbook
*/
public function __construct(\PHPExcel\Spreadsheet $phpExcel = null, &$str_total, &$str_unique, &$str_table, &$colors, $parser)
public function __construct(\PHPExcel\Spreadsheet $phpExcel, &$str_total, &$str_unique, &$str_table, &$colors, $parser)
{
// It needs to call its parent's constructor explicitly
parent::__construct();
@ -832,7 +832,7 @@ class Workbook extends BIFFwriter
* @param boolean $isHidden
* @return string Complete binary record data
* */
private function writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false)
private function writeShortNameBiff8($name, $sheetIndex, $rangeBounds, $isHidden = false)
{
$record = 0x0018;

View File

@ -7,8 +7,10 @@
convertWarningsToExceptions="true"
processIsolation="false"
syntaxCheck="true"
verbose="true"
strict="true"
verbose="true"
reportUselessTests="true"
strictCoverage="true"
disallowTestOutput="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"

View File

@ -7,8 +7,10 @@
convertWarningsToExceptions="true"
processIsolation="false"
syntaxCheck="true"
verbose="true"
strict="true"
verbose="true"
reportUselessTests="true"
strictCoverage="true"
disallowTestOutput="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"