diff --git a/src/PhpSpreadsheet/Calculation.php b/src/PhpSpreadsheet/Calculation.php index 684070ab..17556270 100644 --- a/src/PhpSpreadsheet/Calculation.php +++ b/src/PhpSpreadsheet/Calculation.php @@ -14,21 +14,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\MathTrig; use PhpOffice\PhpSpreadsheet\Calculation\Statistical; use PhpOffice\PhpSpreadsheet\Calculation\TextData; -if (!defined('CALCULATION_REGEXP_CELLREF')) { - // Test for support of \P (multibyte options) in PCRE - if (defined('PREG_BAD_UTF8_ERROR')) { - // Cell reference (cell or range of cells, with or without a sheet reference) - define('CALCULATION_REGEXP_CELLREF', '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d{1,7})'); - // Named Range of cells - define('CALCULATION_REGEXP_NAMEDRANGE', '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?([_A-Z][_A-Z0-9\.]*)'); - } else { - // Cell reference (cell or range of cells, with or without a sheet reference) - define('CALCULATION_REGEXP_CELLREF', '(((\w*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d+)'); - // Named Range of cells - define('CALCULATION_REGEXP_NAMEDRANGE', '(((\w*)|(\'.*\')|(\".*\"))!)?([_A-Z][_A-Z0-9\.]*)'); - } -} - /** * Copyright (c) 2006 - 2016 PhpSpreadsheet. * @@ -64,9 +49,9 @@ class Calculation // Function (allow for the old @ symbol that could be used to prefix a function, but we'll ignore it) const CALCULATION_REGEXP_FUNCTION = '@?([A-Z][A-Z0-9\.]*)[\s]*\('; // Cell reference (cell or range of cells, with or without a sheet reference) - const CALCULATION_REGEXP_CELLREF = CALCULATION_REGEXP_CELLREF; + const CALCULATION_REGEXP_CELLREF = '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?\$?([a-z]{1,3})\$?(\d{1,7})'; // Named Range of cells - const CALCULATION_REGEXP_NAMEDRANGE = CALCULATION_REGEXP_NAMEDRANGE; + const CALCULATION_REGEXP_NAMEDRANGE = '((([^\s,!&%^\/\*\+<>=-]*)|(\'[^\']*\')|(\"[^\"]*\"))!)?([_A-Z][_A-Z0-9\.]*)'; // Error const CALCULATION_REGEXP_ERROR = '\#[A-Z][A-Z0_\/]*[!\?]?'; diff --git a/src/PhpSpreadsheet/Calculation/Engineering.php b/src/PhpSpreadsheet/Calculation/Engineering.php index 6fe07b39..582c6cbd 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering.php +++ b/src/PhpSpreadsheet/Calculation/Engineering.php @@ -2,9 +2,6 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; -/* EULER */ -define('EULER', 2.71828182845904523536); - /** * Copyright (c) 2006 - 2016 PhpSpreadsheet. * @@ -29,6 +26,11 @@ define('EULER', 2.71828182845904523536); */ class Engineering { + /** + * EULER. + */ + const EULER = 2.71828182845904523536; + /** * Details of the Units of measure that can be used in CONVERTUOM(). * @@ -944,7 +946,7 @@ class Engineering $f_PI_DIV_4 = M_PI / 4; $fXAbs = abs($x); - $fResult = sqrt(M_2DIVPI / $fXAbs) * cos($fXAbs - $ord * $f_PI_DIV_2 - $f_PI_DIV_4); + $fResult = sqrt(Functions::M_2DIVPI / $fXAbs) * cos($fXAbs - $ord * $f_PI_DIV_2 - $f_PI_DIV_4); if (($ord & 1) && ($x < 0)) { $fResult = -$fResult; } @@ -2103,7 +2105,7 @@ class Engineering return log10($parsedComplex['real']); } - return self::IMPRODUCT(log10(EULER), self::IMLN($complexNumber)); + return self::IMPRODUCT(log10(self::EULER), self::IMLN($complexNumber)); } /** @@ -2130,7 +2132,7 @@ class Engineering return log($parsedComplex['real'], 2); } - return self::IMPRODUCT(log(EULER, 2), self::IMLN($complexNumber)); + return self::IMPRODUCT(log(self::EULER, 2), self::IMLN($complexNumber)); } /** @@ -2434,7 +2436,7 @@ class Engineering if ($sum == 0.0) { break; } - } while (abs($term / $sum) > PRECISION); + } while (abs($term / $sum) > Functions::PRECISION); return self::$twoSqrtPi * $sum; } @@ -2503,7 +2505,7 @@ class Engineering $n += 0.5; $q1 = $q2; $q2 = $b / $d; - } while ((abs($q1 - $q2) / $q2) > PRECISION); + } while ((abs($q1 - $q2) / $q2) > Functions::PRECISION); return self::$oneSqrtPi * exp(-$x * $x) * $q2; } diff --git a/src/PhpSpreadsheet/Calculation/Financial.php b/src/PhpSpreadsheet/Calculation/Financial.php index 305494be..ea6dbce8 100644 --- a/src/PhpSpreadsheet/Calculation/Financial.php +++ b/src/PhpSpreadsheet/Calculation/Financial.php @@ -2,14 +2,8 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; -/* FINANCIAL_MAX_ITERATIONS */ use PhpOffice\PhpSpreadsheet\Shared\Date; -define('FINANCIAL_MAX_ITERATIONS', 128); - -/* FINANCIAL_PRECISION */ -define('FINANCIAL_PRECISION', 1.0e-08); - /** * Copyright (c) 2006 - 2016 PhpSpreadsheet. * @@ -34,6 +28,10 @@ define('FINANCIAL_PRECISION', 1.0e-08); */ class Financial { + const FINANCIAL_MAX_ITERATIONS = 128; + + const FINANCIAL_PRECISION = 1.0e-08; + /** * isLastDayOfMonth. * @@ -1428,7 +1426,7 @@ class Financial $x2 = $guess; $f1 = self::NPV($x1, $values); $f2 = self::NPV($x2, $values); - for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) { + for ($i = 0; $i < self::FINANCIAL_MAX_ITERATIONS; ++$i) { if (($f1 * $f2) < 0.0) { break; } @@ -1451,14 +1449,14 @@ class Financial $dx = $x1 - $x2; } - for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) { + for ($i = 0; $i < self::FINANCIAL_MAX_ITERATIONS; ++$i) { $dx *= 0.5; $x_mid = $rtb + $dx; $f_mid = self::NPV($x_mid, $values); if ($f_mid <= 0.0) { $rtb = $x_mid; } - if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) { + if ((abs($f_mid) < self::FINANCIAL_PRECISION) || (abs($dx) < self::FINANCIAL_PRECISION)) { return $x_mid; } } @@ -1965,7 +1963,7 @@ class Financial $guess = (is_null($guess)) ? 0.1 : Functions::flattenSingleValue($guess); $rate = $guess; - if (abs($rate) < FINANCIAL_PRECISION) { + if (abs($rate) < self::FINANCIAL_PRECISION) { $y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * $type) * $nper + $fv; } else { $f = exp($nper * log(1 + $rate)); @@ -1977,14 +1975,14 @@ class Financial // find root by secant method $i = $x0 = 0.0; $x1 = $rate; - while ((abs($y0 - $y1) > FINANCIAL_PRECISION) && ($i < FINANCIAL_MAX_ITERATIONS)) { + while ((abs($y0 - $y1) > self::FINANCIAL_PRECISION) && ($i < self::FINANCIAL_MAX_ITERATIONS)) { $rate = ($y1 * $x0 - $y0 * $x1) / ($y1 - $y0); $x0 = $x1; $x1 = $rate; if (($nper * abs($pmt)) > ($pv - $fv)) { $x1 = abs($x1); } - if (abs($rate) < FINANCIAL_PRECISION) { + if (abs($rate) < self::FINANCIAL_PRECISION) { $y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * $type) * $nper + $fv; } else { $f = exp($nper * log(1 + $rate)); @@ -2282,7 +2280,7 @@ class Financial $x2 = $guess; $f1 = self::XNPV($x1, $values, $dates); $f2 = self::XNPV($x2, $values, $dates); - for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) { + for ($i = 0; $i < self::FINANCIAL_MAX_ITERATIONS; ++$i) { if (($f1 * $f2) < 0.0) { break; } elseif (abs($f1) < abs($f2)) { @@ -2304,14 +2302,14 @@ class Financial $dx = $x1 - $x2; } - for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) { + for ($i = 0; $i < self::FINANCIAL_MAX_ITERATIONS; ++$i) { $dx *= 0.5; $x_mid = $rtb + $dx; $f_mid = self::XNPV($x_mid, $values, $dates); if ($f_mid <= 0.0) { $rtb = $x_mid; } - if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) { + if ((abs($f_mid) < self::FINANCIAL_PRECISION) || (abs($dx) < self::FINANCIAL_PRECISION)) { return $x_mid; } } diff --git a/src/PhpSpreadsheet/Calculation/Functions.php b/src/PhpSpreadsheet/Calculation/Functions.php index b13e987d..49ff4182 100644 --- a/src/PhpSpreadsheet/Calculation/Functions.php +++ b/src/PhpSpreadsheet/Calculation/Functions.php @@ -2,20 +2,8 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; -/* MAX_VALUE */ use PhpOffice\PhpSpreadsheet\Calculation; -define('MAX_VALUE', 1.2e308); - -/* 2 / PI */ -define('M_2DIVPI', 0.63661977236758134307553505349006); - -/* MAX_ITERATIONS */ -define('MAX_ITERATIONS', 256); - -/* PRECISION */ -define('PRECISION', 8.88E-016); - /** * Copyright (c) 2006 - 2016 PhpSpreadsheet. * @@ -40,11 +28,17 @@ define('PRECISION', 8.88E-016); */ class Functions { + const PRECISION = 8.88E-016; + + /** + * 2 / PI. + */ + const M_2DIVPI = 0.63661977236758134307553505349006; + /** constants */ const COMPATIBILITY_EXCEL = 'Excel'; const COMPATIBILITY_GNUMERIC = 'Gnumeric'; const COMPATIBILITY_OPENOFFICE = 'OpenOfficeCalc'; - const RETURNDATE_PHP_NUMERIC = 'P'; const RETURNDATE_PHP_OBJECT = 'O'; const RETURNDATE_EXCEL = 'E'; diff --git a/src/PhpSpreadsheet/Calculation/Statistical.php b/src/PhpSpreadsheet/Calculation/Statistical.php index b379b1ba..fc5cdbb3 100644 --- a/src/PhpSpreadsheet/Calculation/Statistical.php +++ b/src/PhpSpreadsheet/Calculation/Statistical.php @@ -2,21 +2,9 @@ namespace PhpOffice\PhpSpreadsheet\Calculation; -/* LOG_GAMMA_X_MAX_VALUE */ use PhpOffice\PhpSpreadsheet\Calculation; use PhpOffice\PhpSpreadsheet\Shared\Trend\Trend; -define('LOG_GAMMA_X_MAX_VALUE', 2.55e305); - -/* XMININ */ -define('XMININ', 2.23e-308); - -/* EPS */ -define('EPS', 2.22e-16); - -/* SQRT2PI */ -define('SQRT2PI', 2.5066282746310005024157652848110452530069867406099); - /** * Copyright (c) 2006 - 2016 PhpSpreadsheet. * @@ -41,6 +29,13 @@ define('SQRT2PI', 2.5066282746310005024157652848110452530069867406099); */ class Statistical { + const LOG_GAMMA_X_MAX_VALUE = 2.55e305; + const XMININ = 2.23e-308; + const EPS = 2.22e-16; + const MAX_VALUE = 1.2e308; + const MAX_ITERATIONS = 256; + const SQRT2PI = 2.5066282746310005024157652848110452530069867406099; + private static function checkTrendArrays(&$array1, &$array2) { if (!is_array($array1)) { @@ -82,7 +77,7 @@ class Statistical */ private static function beta($p, $q) { - if ($p <= 0.0 || $q <= 0.0 || ($p + $q) > LOG_GAMMA_X_MAX_VALUE) { + if ($p <= 0.0 || $q <= 0.0 || ($p + $q) > self::LOG_GAMMA_X_MAX_VALUE) { return 0.0; } @@ -112,7 +107,7 @@ class Statistical return 0.0; } elseif ($x >= 1.0) { return 1.0; - } elseif (($p <= 0.0) || ($q <= 0.0) || (($p + $q) > LOG_GAMMA_X_MAX_VALUE)) { + } elseif (($p <= 0.0) || ($q <= 0.0) || (($p + $q) > self::LOG_GAMMA_X_MAX_VALUE)) { return 0.0; } $beta_gam = exp((0 - self::logBeta($p, $q)) + $p * log($x) + $q * log(1.0 - $x)); @@ -145,7 +140,7 @@ class Statistical if ($p != self::$logBetaCacheP || $q != self::$logBetaCacheQ) { self::$logBetaCacheP = $p; self::$logBetaCacheQ = $q; - if (($p <= 0.0) || ($q <= 0.0) || (($p + $q) > LOG_GAMMA_X_MAX_VALUE)) { + if (($p <= 0.0) || ($q <= 0.0) || (($p + $q) > self::LOG_GAMMA_X_MAX_VALUE)) { self::$logBetaCacheResult = 0.0; } else { self::$logBetaCacheResult = self::logGamma($p) + self::logGamma($q) - self::logGamma($p + $q); @@ -172,37 +167,37 @@ class Statistical $p_plus = $p + 1.0; $p_minus = $p - 1.0; $h = 1.0 - $sum_pq * $x / $p_plus; - if (abs($h) < XMININ) { - $h = XMININ; + if (abs($h) < self::XMININ) { + $h = self::XMININ; } $h = 1.0 / $h; $frac = $h; $m = 1; $delta = 0.0; - while ($m <= MAX_ITERATIONS && abs($delta - 1.0) > PRECISION) { + while ($m <= self::MAX_ITERATIONS && abs($delta - 1.0) > Functions::PRECISION) { $m2 = 2 * $m; // even index for d $d = $m * ($q - $m) * $x / (($p_minus + $m2) * ($p + $m2)); $h = 1.0 + $d * $h; - if (abs($h) < XMININ) { - $h = XMININ; + if (abs($h) < self::XMININ) { + $h = self::XMININ; } $h = 1.0 / $h; $c = 1.0 + $d / $c; - if (abs($c) < XMININ) { - $c = XMININ; + if (abs($c) < self::XMININ) { + $c = self::XMININ; } $frac *= $h * $c; // odd index for d $d = -($p + $m) * ($sum_pq + $m) * $x / (($p + $m2) * ($p_plus + $m2)); $h = 1.0 + $d * $h; - if (abs($h) < XMININ) { - $h = XMININ; + if (abs($h) < self::XMININ) { + $h = self::XMININ; } $h = 1.0 / $h; $c = 1.0 + $d / $c; - if (abs($c) < XMININ) { - $c = XMININ; + if (abs($c) < self::XMININ) { + $c = self::XMININ; } $delta = $h * $c; $frac *= $delta; @@ -346,8 +341,8 @@ class Statistical return self::$logGammaCacheResult; } $y = $x; - if ($y > 0.0 && $y <= LOG_GAMMA_X_MAX_VALUE) { - if ($y <= EPS) { + if ($y > 0.0 && $y <= self::LOG_GAMMA_X_MAX_VALUE) { + if ($y <= self::EPS) { $res = -log(y); } elseif ($y <= 1.5) { // --------------------- @@ -415,7 +410,7 @@ class Statistical } $res /= $y; $corr = log($y); - $res = $res + log(SQRT2PI) - 0.5 * $corr; + $res = $res + log(self::SQRT2PI) - 0.5 * $corr; $res += $y * ($corr - 1.0); } } @@ -423,7 +418,7 @@ class Statistical // -------------------------- // Return for bad arguments // -------------------------- - $res = MAX_VALUE; + $res = self::MAX_VALUE; } // ------------------------------ // Final adjustments and return @@ -480,7 +475,7 @@ class Statistical $summer += ($p[$j] / ++$y); } - return exp(0 - $tmp + log(SQRT2PI * $summer / $x)); + return exp(0 - $tmp + log(self::SQRT2PI * $summer / $x)); } /*************************************************************************** @@ -977,7 +972,7 @@ class Statistical $b = 2; $i = 0; - while ((($b - $a) > PRECISION) && ($i++ < MAX_ITERATIONS)) { + while ((($b - $a) > Functions::PRECISION) && ($i++ < self::MAX_ITERATIONS)) { $guess = ($a + $b) / 2; $result = self::BETADIST($guess, $alpha, $beta); if (($result == $probability) || ($result == 0)) { @@ -988,7 +983,7 @@ class Statistical $a = $guess; } } - if ($i == MAX_ITERATIONS) { + if ($i == self::MAX_ITERATIONS) { return Functions::NA(); } @@ -1102,7 +1097,7 @@ class Statistical $dx = 1; $i = 0; - while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) { + while ((abs($dx) > Functions::PRECISION) && ($i++ < self::MAX_ITERATIONS)) { // Apply Newton-Raphson step $result = self::CHIDIST($x, $degrees); $error = $result - $probability; @@ -1127,7 +1122,7 @@ class Statistical } $x = $xNew; } - if ($i == MAX_ITERATIONS) { + if ($i == self::MAX_ITERATIONS) { return Functions::NA(); } @@ -1721,7 +1716,7 @@ class Statistical $dx = 1024; $i = 0; - while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) { + while ((abs($dx) > Functions::PRECISION) && ($i++ < self::MAX_ITERATIONS)) { // Apply Newton-Raphson step $error = self::GAMMADIST($x, $alpha, $beta, true) - $probability; if ($error < 0.0) { @@ -1744,7 +1739,7 @@ class Statistical } $x = $xNew; } - if ($i == MAX_ITERATIONS) { + if ($i == self::MAX_ITERATIONS) { return Functions::NA(); } @@ -2667,7 +2662,7 @@ class Statistical return 0.5 * (1 + Engineering::erfVal(($value - $mean) / ($stdDev * sqrt(2)))); } - return (1 / (SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean, 2) / (2 * ($stdDev * $stdDev)))); + return (1 / (self::SQRT2PI * $stdDev)) * exp(0 - (pow($value - $mean, 2) / (2 * ($stdDev * $stdDev)))); } } @@ -3439,7 +3434,7 @@ class Statistical } $tsum *= $ts; if (($degrees % 2) == 1) { - $tsum = M_2DIVPI * ($tsum + $ttheta); + $tsum = Functions::M_2DIVPI * ($tsum + $ttheta); } $tValue = 0.5 * (1 + $tsum); if ($tails == 1) { @@ -3475,7 +3470,7 @@ class Statistical $dx = 1; $i = 0; - while ((abs($dx) > PRECISION) && ($i++ < MAX_ITERATIONS)) { + while ((abs($dx) > Functions::PRECISION) && ($i++ < self::MAX_ITERATIONS)) { // Apply Newton-Raphson step $result = self::TDIST($x, $degrees, 2); $error = $result - $probability; @@ -3500,7 +3495,7 @@ class Statistical } $x = $xNew; } - if ($i == MAX_ITERATIONS) { + if ($i == self::MAX_ITERATIONS) { return Functions::NA(); } diff --git a/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php b/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php index 99c27711..6cf68ced 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php +++ b/src/PhpSpreadsheet/Shared/JAMA/CholeskyDecomposition.php @@ -139,8 +139,8 @@ class CholeskyDecomposition return new Matrix($X, $this->m, $nx); } - throw new CalculationException(JAMAError(MatrixSPDException)); + throw new CalculationException(Matrix::MATRIX_SPD_EXCEPTION); } - throw new CalculationException(JAMAError(MATRIX_DIMENSION_EXCEPTION)); + throw new CalculationException(Matrix::MATRIX_DIMENSION_EXCEPTION); } } diff --git a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php index e9ec3d06..e2f4ffb0 100644 --- a/src/PhpSpreadsheet/Shared/JAMA/Matrix.php +++ b/src/PhpSpreadsheet/Shared/JAMA/Matrix.php @@ -24,6 +24,7 @@ class Matrix const ARGUMENT_BOUNDS_EXCEPTION = 'Invalid argument range.'; const MATRIX_DIMENSION_EXCEPTION = 'Matrix dimensions are not equal.'; const ARRAY_LENGTH_EXCEPTION = 'Array length must be a multiple of m.'; + const MATRIX_SPD_EXCEPTION = 'Can only perform operation on symmetric positive definite matrix.'; /** * Matrix storage. @@ -971,7 +972,7 @@ class Matrix return $C; } - throw new CalculationException(JAMAError(MatrixDimensionMismatch)); + throw new CalculationException(self::MATRIX_DIMENSION_EXCEPTION); case 'array': $B = new self($args[0]); if ($this->n == $B->m) { @@ -988,7 +989,7 @@ class Matrix return $C; } - throw new CalculationException(JAMAError(MatrixDimensionMismatch)); + throw new CalculationException(self::MATRIX_DIMENSION_EXCEPTION); case 'integer': $C = new self($this->A); for ($i = 0; $i < $C->m; ++$i) { diff --git a/src/PhpSpreadsheet/Shared/JAMA/utils/Error.php b/src/PhpSpreadsheet/Shared/JAMA/utils/Error.php deleted file mode 100644 index 8aa78c55..00000000 --- a/src/PhpSpreadsheet/Shared/JAMA/utils/Error.php +++ /dev/null @@ -1,79 +0,0 @@ -data = file_get_contents($pFilename, false, null, 0, 8); // Check OLE identifier - if ($this->data != self::IDENTIFIER_OLE) { + $identifierOle = pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1); + if ($this->data != $identifierOle) { throw new ReaderException('The filename ' . $pFilename . ' is not recognised as an OLE file'); } diff --git a/src/PhpSpreadsheet/Shared/XMLWriter.php b/src/PhpSpreadsheet/Shared/XMLWriter.php index 8390c765..02ebd99d 100644 --- a/src/PhpSpreadsheet/Shared/XMLWriter.php +++ b/src/PhpSpreadsheet/Shared/XMLWriter.php @@ -2,14 +2,6 @@ namespace PhpOffice\PhpSpreadsheet\Shared; -if (!defined('DATE_W3C')) { - define('DATE_W3C', 'Y-m-d\TH:i:sP'); -} - -if (!defined('DEBUGMODE_ENABLED')) { - define('DEBUGMODE_ENABLED', false); -} - /** * Copyright (c) 2006 - 2016 PhpSpreadsheet. * @@ -34,6 +26,8 @@ if (!defined('DEBUGMODE_ENABLED')) { */ class XMLWriter extends \XMLWriter { + public static $debugEnabled = false; + /** Temporary storage method */ const STORAGE_MEMORY = 1; const STORAGE_DISK = 2; @@ -71,7 +65,7 @@ class XMLWriter extends \XMLWriter } // Set default values - if (DEBUGMODE_ENABLED) { + if (self::$debugEnabled) { $this->setIndent(true); } }