@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | /** PHPExcel root directory */ |
30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
31 | 31 | /** |
32 | 32 | * @ignore |
33 | 33 | */ |
34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | class PHPExcel_Calculation_Functions { |
60 | 60 | |
61 | 61 | /** constants */ |
62 | - const COMPATIBILITY_EXCEL = 'Excel'; |
|
62 | + const COMPATIBILITY_EXCEL = 'Excel'; |
|
63 | 63 | const COMPATIBILITY_GNUMERIC = 'Gnumeric'; |
64 | - const COMPATIBILITY_OPENOFFICE = 'OpenOfficeCalc'; |
|
64 | + const COMPATIBILITY_OPENOFFICE = 'OpenOfficeCalc'; |
|
65 | 65 | |
66 | 66 | const RETURNDATE_PHP_NUMERIC = 'P'; |
67 | 67 | const RETURNDATE_PHP_OBJECT = 'O'; |
68 | - const RETURNDATE_EXCEL = 'E'; |
|
68 | + const RETURNDATE_EXCEL = 'E'; |
|
69 | 69 | |
70 | 70 | |
71 | 71 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @access private |
75 | 75 | * @var string |
76 | 76 | */ |
77 | - protected static $compatibilityMode = self::COMPATIBILITY_EXCEL; |
|
77 | + protected static $compatibilityMode = self::COMPATIBILITY_EXCEL; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Data Type to use when returning date values |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @access private |
83 | 83 | * @var string |
84 | 84 | */ |
85 | - protected static $ReturnDateType = self::RETURNDATE_EXCEL; |
|
85 | + protected static $ReturnDateType = self::RETURNDATE_EXCEL; |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * List of error codes |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @access private |
91 | 91 | * @var array |
92 | 92 | */ |
93 | - protected static $_errorCodes = array( 'null' => '#NULL!', |
|
93 | + protected static $_errorCodes = array('null' => '#NULL!', |
|
94 | 94 | 'divisionbyzero' => '#DIV/0!', |
95 | 95 | 'value' => '#VALUE!', |
96 | 96 | 'reference' => '#REF!', |
@@ -292,29 +292,29 @@ discard block |
||
292 | 292 | |
293 | 293 | |
294 | 294 | public static function isMatrixValue($idx) { |
295 | - return ((substr_count($idx,'.') <= 1) || (preg_match('/\.[A-Z]/',$idx) > 0)); |
|
295 | + return ((substr_count($idx, '.') <= 1) || (preg_match('/\.[A-Z]/', $idx) > 0)); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
299 | 299 | public static function isValue($idx) { |
300 | - return (substr_count($idx,'.') == 0); |
|
300 | + return (substr_count($idx, '.') == 0); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
304 | 304 | public static function isCellValue($idx) { |
305 | - return (substr_count($idx,'.') > 1); |
|
305 | + return (substr_count($idx, '.') > 1); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
309 | 309 | public static function _ifCondition($condition) { |
310 | - $condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition); |
|
311 | - if (!in_array($condition{0},array('>', '<', '='))) { |
|
312 | - if (!is_numeric($condition)) { $condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); } |
|
310 | + $condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition); |
|
311 | + if ( ! in_array($condition{0},array('>', '<', '='))) { |
|
312 | + if ( ! is_numeric($condition)) { $condition = PHPExcel_Calculation::_wrapResult(strtoupper($condition)); } |
|
313 | 313 | return '='.$condition; |
314 | 314 | } else { |
315 | - preg_match('/([<>=]+)(.*)/',$condition,$matches); |
|
316 | - list(,$operator,$operand) = $matches; |
|
317 | - if (!is_numeric($operand)) { $operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand)); } |
|
315 | + preg_match('/([<>=]+)(.*)/', $condition, $matches); |
|
316 | + list(,$operator, $operand) = $matches; |
|
317 | + if ( ! is_numeric($operand)) { $operand = PHPExcel_Calculation::_wrapResult(strtoupper($operand)); } |
|
318 | 318 | return $operator.$operand; |
319 | 319 | } |
320 | 320 | } // function _ifCondition() |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | * @return boolean |
328 | 328 | */ |
329 | 329 | public static function ERROR_TYPE($value = '') { |
330 | - $value = self::flattenSingleValue($value); |
|
330 | + $value = self::flattenSingleValue($value); |
|
331 | 331 | |
332 | 332 | $i = 1; |
333 | - foreach(self::$_errorCodes as $errorCode) { |
|
333 | + foreach (self::$_errorCodes as $errorCode) { |
|
334 | 334 | if ($value === $errorCode) { |
335 | 335 | return $i; |
336 | 336 | } |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | * @return boolean |
348 | 348 | */ |
349 | 349 | public static function IS_BLANK($value = NULL) { |
350 | - if (!is_null($value)) { |
|
351 | - $value = self::flattenSingleValue($value); |
|
350 | + if ( ! is_null($value)) { |
|
351 | + $value = self::flattenSingleValue($value); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | return is_null($value); |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | * @return boolean |
363 | 363 | */ |
364 | 364 | public static function IS_ERR($value = '') { |
365 | - $value = self::flattenSingleValue($value); |
|
365 | + $value = self::flattenSingleValue($value); |
|
366 | 366 | |
367 | - return self::IS_ERROR($value) && (!self::IS_NA($value)); |
|
367 | + return self::IS_ERROR($value) && ( ! self::IS_NA($value)); |
|
368 | 368 | } // function IS_ERR() |
369 | 369 | |
370 | 370 | |
@@ -375,9 +375,9 @@ discard block |
||
375 | 375 | * @return boolean |
376 | 376 | */ |
377 | 377 | public static function IS_ERROR($value = '') { |
378 | - $value = self::flattenSingleValue($value); |
|
378 | + $value = self::flattenSingleValue($value); |
|
379 | 379 | |
380 | - if (!is_string($value)) |
|
380 | + if ( ! is_string($value)) |
|
381 | 381 | return false; |
382 | 382 | return in_array($value, array_values(self::$_errorCodes)); |
383 | 383 | } // function IS_ERROR() |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * @return boolean |
391 | 391 | */ |
392 | 392 | public static function IS_NA($value = '') { |
393 | - $value = self::flattenSingleValue($value); |
|
393 | + $value = self::flattenSingleValue($value); |
|
394 | 394 | |
395 | 395 | return ($value === self::NA()); |
396 | 396 | } // function IS_NA() |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | |
408 | 408 | if ($value === NULL) |
409 | 409 | return self::NAME(); |
410 | - if ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) |
|
410 | + if ((is_bool($value)) || ((is_string($value)) && ( ! is_numeric($value)))) |
|
411 | 411 | return self::VALUE(); |
412 | 412 | return ($value % 2 == 0); |
413 | 413 | } // function IS_EVEN() |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | |
425 | 425 | if ($value === NULL) |
426 | 426 | return self::NAME(); |
427 | - if ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) |
|
427 | + if ((is_bool($value)) || ((is_string($value)) && ( ! is_numeric($value)))) |
|
428 | 428 | return self::VALUE(); |
429 | 429 | return (abs($value) % 2 == 1); |
430 | 430 | } // function IS_ODD() |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * @return boolean |
438 | 438 | */ |
439 | 439 | public static function IS_NUMBER($value = NULL) { |
440 | - $value = self::flattenSingleValue($value); |
|
440 | + $value = self::flattenSingleValue($value); |
|
441 | 441 | |
442 | 442 | if (is_string($value)) { |
443 | 443 | return False; |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @return boolean |
454 | 454 | */ |
455 | 455 | public static function IS_LOGICAL($value = NULL) { |
456 | - $value = self::flattenSingleValue($value); |
|
456 | + $value = self::flattenSingleValue($value); |
|
457 | 457 | |
458 | 458 | return is_bool($value); |
459 | 459 | } // function IS_LOGICAL() |
@@ -466,9 +466,9 @@ discard block |
||
466 | 466 | * @return boolean |
467 | 467 | */ |
468 | 468 | public static function IS_TEXT($value = NULL) { |
469 | - $value = self::flattenSingleValue($value); |
|
469 | + $value = self::flattenSingleValue($value); |
|
470 | 470 | |
471 | - return (is_string($value) && !self::IS_ERROR($value)); |
|
471 | + return (is_string($value) && ! self::IS_ERROR($value)); |
|
472 | 472 | } // function IS_TEXT() |
473 | 473 | |
474 | 474 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * @return boolean |
480 | 480 | */ |
481 | 481 | public static function IS_NONTEXT($value = NULL) { |
482 | - return !self::IS_TEXT($value); |
|
482 | + return ! self::IS_TEXT($value); |
|
483 | 483 | } // function IS_NONTEXT() |
484 | 484 | |
485 | 485 | |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * Array or Matrix 64 |
549 | 549 | */ |
550 | 550 | public static function TYPE($value = NULL) { |
551 | - $value = self::flattenArrayIndexed($value); |
|
551 | + $value = self::flattenArrayIndexed($value); |
|
552 | 552 | if (is_array($value) && (count($value) > 1)) { |
553 | 553 | $a = array_keys($value); |
554 | 554 | $a = array_pop($a); |
@@ -559,20 +559,20 @@ discard block |
||
559 | 559 | } elseif (self::isMatrixValue($a)) { |
560 | 560 | return 64; |
561 | 561 | } |
562 | - } elseif(empty($value)) { |
|
562 | + } elseif (empty($value)) { |
|
563 | 563 | // Empty Cell |
564 | 564 | return 1; |
565 | 565 | } |
566 | - $value = self::flattenSingleValue($value); |
|
566 | + $value = self::flattenSingleValue($value); |
|
567 | 567 | |
568 | 568 | if (($value === NULL) || (is_float($value)) || (is_int($value))) { |
569 | 569 | return 1; |
570 | - } elseif(is_bool($value)) { |
|
570 | + } elseif (is_bool($value)) { |
|
571 | 571 | return 4; |
572 | - } elseif(is_array($value)) { |
|
572 | + } elseif (is_array($value)) { |
|
573 | 573 | return 64; |
574 | 574 | break; |
575 | - } elseif(is_string($value)) { |
|
575 | + } elseif (is_string($value)) { |
|
576 | 576 | // Errors |
577 | 577 | if ((strlen($value) > 0) && ($value{0} == '#')) { |
578 | 578 | return 16; |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | * @return array Flattened array |
591 | 591 | */ |
592 | 592 | public static function flattenArray($array) { |
593 | - if (!is_array($array)) { |
|
593 | + if ( ! is_array($array)) { |
|
594 | 594 | return (array) $array; |
595 | 595 | } |
596 | 596 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * @return array Flattened array |
623 | 623 | */ |
624 | 624 | public static function flattenArrayIndexed($array) { |
625 | - if (!is_array($array)) { |
|
625 | + if ( ! is_array($array)) { |
|
626 | 626 | return (array) $array; |
627 | 627 | } |
628 | 628 | |
@@ -669,27 +669,27 @@ discard block |
||
669 | 669 | // These functions aren't available in Windows implementations of PHP prior to version 5.3.0 |
670 | 670 | // So we test if they do exist for this version of PHP/operating platform; and if not we create them |
671 | 671 | // |
672 | -if (!function_exists('acosh')) { |
|
672 | +if ( ! function_exists('acosh')) { |
|
673 | 673 | function acosh($x) { |
674 | 674 | return 2 * log(sqrt(($x + 1) / 2) + sqrt(($x - 1) / 2)); |
675 | 675 | } // function acosh() |
676 | 676 | } |
677 | 677 | |
678 | -if (!function_exists('asinh')) { |
|
678 | +if ( ! function_exists('asinh')) { |
|
679 | 679 | function asinh($x) { |
680 | 680 | return log($x + sqrt(1 + $x * $x)); |
681 | 681 | } // function asinh() |
682 | 682 | } |
683 | 683 | |
684 | -if (!function_exists('atanh')) { |
|
684 | +if ( ! function_exists('atanh')) { |
|
685 | 685 | function atanh($x) { |
686 | 686 | return (log(1 + $x) - log(1 - $x)) / 2; |
687 | 687 | } // function atanh() |
688 | 688 | } |
689 | 689 | |
690 | -if (!function_exists('money_format')) { |
|
690 | +if ( ! function_exists('money_format')) { |
|
691 | 691 | function money_format($format, $number) { |
692 | - $regex = array( '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?(?:#([0-9]+))?', |
|
692 | + $regex = array('/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?(?:#([0-9]+))?', |
|
693 | 693 | '(?:\.([0-9]+))?([in%])/' |
694 | 694 | ); |
695 | 695 | $regex = implode('', $regex); |
@@ -698,19 +698,19 @@ discard block |
||
698 | 698 | } |
699 | 699 | $locale = localeconv(); |
700 | 700 | $number = floatval($number); |
701 | - if (!preg_match($regex, $format, $fmatch)) { |
|
701 | + if ( ! preg_match($regex, $format, $fmatch)) { |
|
702 | 702 | trigger_error("No format specified or invalid format", E_USER_WARNING); |
703 | 703 | return $number; |
704 | 704 | } |
705 | - $flags = array( 'fillchar' => preg_match('/\=(.)/', $fmatch[1], $match) ? $match[1] : ' ', |
|
705 | + $flags = array('fillchar' => preg_match('/\=(.)/', $fmatch[1], $match) ? $match[1] : ' ', |
|
706 | 706 | 'nogroup' => preg_match('/\^/', $fmatch[1]) > 0, |
707 | 707 | 'usesignal' => preg_match('/\+|\(/', $fmatch[1], $match) ? $match[0] : '+', |
708 | 708 | 'nosimbol' => preg_match('/\!/', $fmatch[1]) > 0, |
709 | 709 | 'isleft' => preg_match('/\-/', $fmatch[1]) > 0 |
710 | 710 | ); |
711 | - $width = trim($fmatch[2]) ? (int)$fmatch[2] : 0; |
|
712 | - $left = trim($fmatch[3]) ? (int)$fmatch[3] : 0; |
|
713 | - $right = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits']; |
|
711 | + $width = trim($fmatch[2]) ? (int) $fmatch[2] : 0; |
|
712 | + $left = trim($fmatch[3]) ? (int) $fmatch[3] : 0; |
|
713 | + $right = trim($fmatch[4]) ? (int) $fmatch[4] : $locale['int_frac_digits']; |
|
714 | 714 | $conversion = $fmatch[5]; |
715 | 715 | $positive = true; |
716 | 716 | if ($number < 0) { |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | } |
720 | 720 | $letter = $positive ? 'p' : 'n'; |
721 | 721 | $prefix = $suffix = $cprefix = $csuffix = $signal = ''; |
722 | - if (!$positive) { |
|
722 | + if ( ! $positive) { |
|
723 | 723 | $signal = $locale['negative_sign']; |
724 | 724 | switch (true) { |
725 | 725 | case $locale['n_sign_posn'] == 0 || $flags['usesignal'] == '(': |
@@ -740,23 +740,22 @@ discard block |
||
740 | 740 | break; |
741 | 741 | } |
742 | 742 | } |
743 | - if (!$flags['nosimbol']) { |
|
743 | + if ( ! $flags['nosimbol']) { |
|
744 | 744 | $currency = $cprefix; |
745 | 745 | $currency .= ($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']); |
746 | 746 | $currency .= $csuffix; |
747 | - $currency = iconv('ISO-8859-1','UTF-8',$currency); |
|
747 | + $currency = iconv('ISO-8859-1', 'UTF-8', $currency); |
|
748 | 748 | } else { |
749 | 749 | $currency = ''; |
750 | 750 | } |
751 | 751 | $space = $locale["{$letter}_sep_by_space"] ? ' ' : ''; |
752 | 752 | |
753 | - if (!isset($locale['mon_decimal_point']) || empty($locale['mon_decimal_point'])) { |
|
754 | - $locale['mon_decimal_point'] = (!isset($locale['decimal_point']) || empty($locale['decimal_point'])) ? |
|
755 | - $locale['decimal_point'] : |
|
756 | - '.'; |
|
753 | + if ( ! isset($locale['mon_decimal_point']) || empty($locale['mon_decimal_point'])) { |
|
754 | + $locale['mon_decimal_point'] = ( ! isset($locale['decimal_point']) || empty($locale['decimal_point'])) ? |
|
755 | + $locale['decimal_point'] : '.'; |
|
757 | 756 | } |
758 | 757 | |
759 | - $number = number_format($number, $right, $locale['mon_decimal_point'], $flags['nogroup'] ? '' : $locale['mon_thousands_sep'] ); |
|
758 | + $number = number_format($number, $right, $locale['mon_decimal_point'], $flags['nogroup'] ? '' : $locale['mon_thousands_sep']); |
|
760 | 759 | $number = explode($locale['mon_decimal_point'], $number); |
761 | 760 | |
762 | 761 | $n = strlen($prefix) + strlen($currency); |
@@ -764,14 +763,14 @@ discard block |
||
764 | 763 | if ($flags['isleft']) { |
765 | 764 | $number[0] .= str_repeat($flags['fillchar'], $left - $n); |
766 | 765 | } else { |
767 | - $number[0] = str_repeat($flags['fillchar'], $left - $n) . $number[0]; |
|
766 | + $number[0] = str_repeat($flags['fillchar'], $left - $n).$number[0]; |
|
768 | 767 | } |
769 | 768 | } |
770 | 769 | $number = implode($locale['mon_decimal_point'], $number); |
771 | 770 | if ($locale["{$letter}_cs_precedes"]) { |
772 | - $number = $prefix . $currency . $space . $number . $suffix; |
|
771 | + $number = $prefix.$currency.$space.$number.$suffix; |
|
773 | 772 | } else { |
774 | - $number = $prefix . $number . $space . $currency . $suffix; |
|
773 | + $number = $prefix.$number.$space.$currency.$suffix; |
|
775 | 774 | } |
776 | 775 | if ($width > 0) { |
777 | 776 | $number = str_pad($number, $width, $flags['fillchar'], $flags['isleft'] ? STR_PAD_RIGHT : STR_PAD_LEFT); |
@@ -786,25 +785,25 @@ discard block |
||
786 | 785 | // Strangely, PHP doesn't have a mb_str_replace multibyte function |
787 | 786 | // As we'll only ever use this function with UTF-8 characters, we can simply "hard-code" the character set |
788 | 787 | // |
789 | -if ((!function_exists('mb_str_replace')) && |
|
788 | +if (( ! function_exists('mb_str_replace')) && |
|
790 | 789 | (function_exists('mb_substr')) && (function_exists('mb_strlen')) && (function_exists('mb_strpos'))) { |
791 | 790 | function mb_str_replace($search, $replace, $subject) { |
792 | - if(is_array($subject)) { |
|
791 | + if (is_array($subject)) { |
|
793 | 792 | $ret = array(); |
794 | - foreach($subject as $key => $val) { |
|
793 | + foreach ($subject as $key => $val) { |
|
795 | 794 | $ret[$key] = mb_str_replace($search, $replace, $val); |
796 | 795 | } |
797 | 796 | return $ret; |
798 | 797 | } |
799 | 798 | |
800 | - foreach((array) $search as $key => $s) { |
|
801 | - if($s == '') { |
|
799 | + foreach ((array) $search as $key => $s) { |
|
800 | + if ($s == '') { |
|
802 | 801 | continue; |
803 | 802 | } |
804 | - $r = !is_array($replace) ? $replace : (array_key_exists($key, $replace) ? $replace[$key] : ''); |
|
803 | + $r = ! is_array($replace) ? $replace : (array_key_exists($key, $replace) ? $replace[$key] : ''); |
|
805 | 804 | $pos = mb_strpos($subject, $s, 0, 'UTF-8'); |
806 | - while($pos !== false) { |
|
807 | - $subject = mb_substr($subject, 0, $pos, 'UTF-8') . $r . mb_substr($subject, $pos + mb_strlen($s, 'UTF-8'), 65535, 'UTF-8'); |
|
805 | + while ($pos !== false) { |
|
806 | + $subject = mb_substr($subject, 0, $pos, 'UTF-8').$r.mb_substr($subject, $pos + mb_strlen($s, 'UTF-8'), 65535, 'UTF-8'); |
|
808 | 807 | $pos = mb_strpos($subject, $s, $pos + mb_strlen($r, 'UTF-8'), 'UTF-8'); |
809 | 808 | } |
810 | 809 | } |
@@ -377,8 +377,9 @@ discard block |
||
377 | 377 | public static function IS_ERROR($value = '') { |
378 | 378 | $value = self::flattenSingleValue($value); |
379 | 379 | |
380 | - if (!is_string($value)) |
|
381 | - return false; |
|
380 | + if (!is_string($value)) { |
|
381 | + return false; |
|
382 | + } |
|
382 | 383 | return in_array($value, array_values(self::$_errorCodes)); |
383 | 384 | } // function IS_ERROR() |
384 | 385 | |
@@ -405,10 +406,12 @@ discard block |
||
405 | 406 | public static function IS_EVEN($value = NULL) { |
406 | 407 | $value = self::flattenSingleValue($value); |
407 | 408 | |
408 | - if ($value === NULL) |
|
409 | - return self::NAME(); |
|
410 | - if ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) |
|
411 | - return self::VALUE(); |
|
409 | + if ($value === NULL) { |
|
410 | + return self::NAME(); |
|
411 | + } |
|
412 | + if ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) { |
|
413 | + return self::VALUE(); |
|
414 | + } |
|
412 | 415 | return ($value % 2 == 0); |
413 | 416 | } // function IS_EVEN() |
414 | 417 | |
@@ -422,10 +425,12 @@ discard block |
||
422 | 425 | public static function IS_ODD($value = NULL) { |
423 | 426 | $value = self::flattenSingleValue($value); |
424 | 427 | |
425 | - if ($value === NULL) |
|
426 | - return self::NAME(); |
|
427 | - if ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) |
|
428 | - return self::VALUE(); |
|
428 | + if ($value === NULL) { |
|
429 | + return self::NAME(); |
|
430 | + } |
|
431 | + if ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) { |
|
432 | + return self::VALUE(); |
|
433 | + } |
|
429 | 434 | return (abs($value) % 2 == 1); |
430 | 435 | } // function IS_ODD() |
431 | 436 |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | * IS_EVEN |
401 | 401 | * |
402 | 402 | * @param mixed $value Value to check |
403 | - * @return boolean |
|
403 | + * @return string|boolean |
|
404 | 404 | */ |
405 | 405 | public static function IS_EVEN($value = NULL) { |
406 | 406 | $value = self::flattenSingleValue($value); |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * IS_ODD |
418 | 418 | * |
419 | 419 | * @param mixed $value Value to check |
420 | - * @return boolean |
|
420 | + * @return string|boolean |
|
421 | 421 | */ |
422 | 422 | public static function IS_ODD($value = NULL) { |
423 | 423 | $value = self::flattenSingleValue($value); |
@@ -688,6 +688,12 @@ discard block |
||
688 | 688 | } |
689 | 689 | |
690 | 690 | if (!function_exists('money_format')) { |
691 | + |
|
692 | + /** |
|
693 | + * @param string $format |
|
694 | + * |
|
695 | + * @return string |
|
696 | + */ |
|
691 | 697 | function money_format($format, $number) { |
692 | 698 | $regex = array( '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?(?:#([0-9]+))?', |
693 | 699 | '(?:\.([0-9]+))?([in%])/' |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | /** PHPExcel root directory */ |
30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
31 | 31 | /** |
32 | 32 | * @ignore |
33 | 33 | */ |
34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -63,28 +63,28 @@ discard block |
||
63 | 63 | $dataType = parent::dataTypeForValue($value); |
64 | 64 | |
65 | 65 | // Style logic - strings |
66 | - if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) { |
|
66 | + if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && ! $value instanceof PHPExcel_RichText) { |
|
67 | 67 | // Test for booleans using locale-setting |
68 | 68 | if ($value == PHPExcel_Calculation::getTRUE()) { |
69 | - $cell->setValueExplicit( True, PHPExcel_Cell_DataType::TYPE_BOOL); |
|
69 | + $cell->setValueExplicit(True, PHPExcel_Cell_DataType::TYPE_BOOL); |
|
70 | 70 | return true; |
71 | - } elseif($value == PHPExcel_Calculation::getFALSE()) { |
|
72 | - $cell->setValueExplicit( False, PHPExcel_Cell_DataType::TYPE_BOOL); |
|
71 | + } elseif ($value == PHPExcel_Calculation::getFALSE()) { |
|
72 | + $cell->setValueExplicit(False, PHPExcel_Cell_DataType::TYPE_BOOL); |
|
73 | 73 | return true; |
74 | 74 | } |
75 | 75 | |
76 | 76 | // Check for number in scientific format |
77 | 77 | if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) { |
78 | - $cell->setValueExplicit( (float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); |
|
78 | + $cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC); |
|
79 | 79 | return true; |
80 | 80 | } |
81 | 81 | |
82 | 82 | // Check for percentage |
83 | 83 | if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) { |
84 | 84 | // Convert value to number |
85 | - $cell->setValueExplicit( (float)str_replace('%', '', $value) / 100, PHPExcel_Cell_DataType::TYPE_NUMERIC); |
|
85 | + $cell->setValueExplicit((float) str_replace('%', '', $value) / 100, PHPExcel_Cell_DataType::TYPE_NUMERIC); |
|
86 | 86 | // Set style |
87 | - $cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE ); |
|
87 | + $cell->getParent()->getStyle($cell->getCoordinate())->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE); |
|
88 | 88 | return true; |
89 | 89 | } |
90 | 90 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | // Convert value to number |
96 | 96 | $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC); |
97 | 97 | // Set style |
98 | - $cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3 ); |
|
98 | + $cell->getParent()->getStyle($cell->getCoordinate())->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3); |
|
99 | 99 | return true; |
100 | 100 | } |
101 | 101 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | // Convert value to number |
107 | 107 | $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC); |
108 | 108 | // Set style |
109 | - $cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4 ); |
|
109 | + $cell->getParent()->getStyle($cell->getCoordinate())->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4); |
|
110 | 110 | return true; |
111 | 111 | } |
112 | 112 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } else { |
121 | 121 | $formatCode = 'yyyy-mm-dd'; |
122 | 122 | } |
123 | - $cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode($formatCode); |
|
123 | + $cell->getParent()->getStyle($cell->getCoordinate())->getNumberFormat()->setFormatCode($formatCode); |
|
124 | 124 | return true; |
125 | 125 | } |
126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $value = PHPExcel_Shared_String::SanitizeUTF8($value); |
130 | 130 | $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING); |
131 | 131 | // Set style |
132 | - $cell->getParent()->getStyle( $cell->getCoordinate() )->getAlignment()->setWrapText(true); |
|
132 | + $cell->getParent()->getStyle($cell->getCoordinate())->getAlignment()->setWrapText(true); |
|
133 | 133 | return true; |
134 | 134 | } |
135 | 135 | } |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | { |
38 | 38 | /* Data types */ |
39 | 39 | const TYPE_STRING2 = 'str'; |
40 | - const TYPE_STRING = 's'; |
|
40 | + const TYPE_STRING = 's'; |
|
41 | 41 | const TYPE_FORMULA = 'f'; |
42 | 42 | const TYPE_NUMERIC = 'n'; |
43 | 43 | const TYPE_BOOL = 'b'; |
44 | - const TYPE_NULL = 'null'; |
|
45 | - const TYPE_INLINE = 'inlineStr'; |
|
44 | + const TYPE_NULL = 'null'; |
|
45 | + const TYPE_INLINE = 'inlineStr'; |
|
46 | 46 | const TYPE_ERROR = 'e'; |
47 | 47 | |
48 | 48 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @var array |
52 | 52 | */ |
53 | - private static $_errorCodes = array('#NULL!' => 0, '#DIV/0!' => 1, '#VALUE!' => 2, '#REF!' => 3, '#NAME?' => 4, '#NUM!' => 5, '#N/A' => 6); |
|
53 | + private static $_errorCodes = array('#NULL!' => 0, '#DIV/0!' => 1, '#VALUE!' => 2, '#REF!' => 3, '#NAME?' => 4, '#NUM!' => 5, '#N/A' => 6); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Get list of error codes |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public static function checkErrorCode($pValue = null) |
104 | 104 | { |
105 | - $pValue = (string)$pValue; |
|
105 | + $pValue = (string) $pValue; |
|
106 | 106 | |
107 | - if ( !array_key_exists($pValue, self::$_errorCodes) ) { |
|
107 | + if ( ! array_key_exists($pValue, self::$_errorCodes)) { |
|
108 | 108 | $pValue = '#NULL!'; |
109 | 109 | } |
110 | 110 |
@@ -41,8 +41,8 @@ |
||
41 | 41 | const TYPE_FORMULA = 'f'; |
42 | 42 | const TYPE_NUMERIC = 'n'; |
43 | 43 | const TYPE_BOOL = 'b'; |
44 | - const TYPE_NULL = 'null'; |
|
45 | - const TYPE_INLINE = 'inlineStr'; |
|
44 | + const TYPE_NULL = 'null'; |
|
45 | + const TYPE_INLINE = 'inlineStr'; |
|
46 | 46 | const TYPE_ERROR = 'e'; |
47 | 47 | |
48 | 48 | /** |
@@ -60,105 +60,105 @@ discard block |
||
60 | 60 | const OPERATOR_NOTBETWEEN = 'notBetween'; |
61 | 61 | const OPERATOR_NOTEQUAL = 'notEqual'; |
62 | 62 | |
63 | - /** |
|
64 | - * Formula 1 |
|
65 | - * |
|
66 | - * @var string |
|
67 | - */ |
|
68 | - private $_formula1; |
|
69 | - |
|
70 | - /** |
|
71 | - * Formula 2 |
|
72 | - * |
|
73 | - * @var string |
|
74 | - */ |
|
75 | - private $_formula2; |
|
76 | - |
|
77 | - /** |
|
78 | - * Type |
|
79 | - * |
|
80 | - * @var string |
|
81 | - */ |
|
82 | - private $_type = PHPExcel_Cell_DataValidation::TYPE_NONE; |
|
83 | - |
|
84 | - /** |
|
85 | - * Error style |
|
86 | - * |
|
87 | - * @var string |
|
88 | - */ |
|
89 | - private $_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; |
|
90 | - |
|
91 | - /** |
|
92 | - * Operator |
|
93 | - * |
|
94 | - * @var string |
|
95 | - */ |
|
96 | - private $_operator; |
|
97 | - |
|
98 | - /** |
|
99 | - * Allow Blank |
|
100 | - * |
|
101 | - * @var boolean |
|
102 | - */ |
|
103 | - private $_allowBlank; |
|
104 | - |
|
105 | - /** |
|
106 | - * Show DropDown |
|
107 | - * |
|
108 | - * @var boolean |
|
109 | - */ |
|
110 | - private $_showDropDown; |
|
111 | - |
|
112 | - /** |
|
113 | - * Show InputMessage |
|
114 | - * |
|
115 | - * @var boolean |
|
116 | - */ |
|
117 | - private $_showInputMessage; |
|
118 | - |
|
119 | - /** |
|
120 | - * Show ErrorMessage |
|
121 | - * |
|
122 | - * @var boolean |
|
123 | - */ |
|
124 | - private $_showErrorMessage; |
|
125 | - |
|
126 | - /** |
|
127 | - * Error title |
|
128 | - * |
|
129 | - * @var string |
|
130 | - */ |
|
131 | - private $_errorTitle; |
|
132 | - |
|
133 | - /** |
|
134 | - * Error |
|
135 | - * |
|
136 | - * @var string |
|
137 | - */ |
|
138 | - private $_error; |
|
139 | - |
|
140 | - /** |
|
141 | - * Prompt title |
|
142 | - * |
|
143 | - * @var string |
|
144 | - */ |
|
145 | - private $_promptTitle; |
|
146 | - |
|
147 | - /** |
|
148 | - * Prompt |
|
149 | - * |
|
150 | - * @var string |
|
151 | - */ |
|
152 | - private $_prompt; |
|
153 | - |
|
154 | - /** |
|
155 | - * Create a new PHPExcel_Cell_DataValidation |
|
156 | - * |
|
157 | - * @throws Exception |
|
158 | - */ |
|
159 | - public function __construct() |
|
160 | - { |
|
161 | - // Initialise member variables |
|
63 | + /** |
|
64 | + * Formula 1 |
|
65 | + * |
|
66 | + * @var string |
|
67 | + */ |
|
68 | + private $_formula1; |
|
69 | + |
|
70 | + /** |
|
71 | + * Formula 2 |
|
72 | + * |
|
73 | + * @var string |
|
74 | + */ |
|
75 | + private $_formula2; |
|
76 | + |
|
77 | + /** |
|
78 | + * Type |
|
79 | + * |
|
80 | + * @var string |
|
81 | + */ |
|
82 | + private $_type = PHPExcel_Cell_DataValidation::TYPE_NONE; |
|
83 | + |
|
84 | + /** |
|
85 | + * Error style |
|
86 | + * |
|
87 | + * @var string |
|
88 | + */ |
|
89 | + private $_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; |
|
90 | + |
|
91 | + /** |
|
92 | + * Operator |
|
93 | + * |
|
94 | + * @var string |
|
95 | + */ |
|
96 | + private $_operator; |
|
97 | + |
|
98 | + /** |
|
99 | + * Allow Blank |
|
100 | + * |
|
101 | + * @var boolean |
|
102 | + */ |
|
103 | + private $_allowBlank; |
|
104 | + |
|
105 | + /** |
|
106 | + * Show DropDown |
|
107 | + * |
|
108 | + * @var boolean |
|
109 | + */ |
|
110 | + private $_showDropDown; |
|
111 | + |
|
112 | + /** |
|
113 | + * Show InputMessage |
|
114 | + * |
|
115 | + * @var boolean |
|
116 | + */ |
|
117 | + private $_showInputMessage; |
|
118 | + |
|
119 | + /** |
|
120 | + * Show ErrorMessage |
|
121 | + * |
|
122 | + * @var boolean |
|
123 | + */ |
|
124 | + private $_showErrorMessage; |
|
125 | + |
|
126 | + /** |
|
127 | + * Error title |
|
128 | + * |
|
129 | + * @var string |
|
130 | + */ |
|
131 | + private $_errorTitle; |
|
132 | + |
|
133 | + /** |
|
134 | + * Error |
|
135 | + * |
|
136 | + * @var string |
|
137 | + */ |
|
138 | + private $_error; |
|
139 | + |
|
140 | + /** |
|
141 | + * Prompt title |
|
142 | + * |
|
143 | + * @var string |
|
144 | + */ |
|
145 | + private $_promptTitle; |
|
146 | + |
|
147 | + /** |
|
148 | + * Prompt |
|
149 | + * |
|
150 | + * @var string |
|
151 | + */ |
|
152 | + private $_prompt; |
|
153 | + |
|
154 | + /** |
|
155 | + * Create a new PHPExcel_Cell_DataValidation |
|
156 | + * |
|
157 | + * @throws Exception |
|
158 | + */ |
|
159 | + public function __construct() |
|
160 | + { |
|
161 | + // Initialise member variables |
|
162 | 162 | $this->_formula1 = ''; |
163 | 163 | $this->_formula2 = ''; |
164 | 164 | $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $this->_error = ''; |
173 | 173 | $this->_promptTitle = ''; |
174 | 174 | $this->_prompt = ''; |
175 | - } |
|
175 | + } |
|
176 | 176 | |
177 | 177 | /** |
178 | 178 | * Get Formula 1 |
@@ -440,23 +440,23 @@ discard block |
||
440 | 440 | * @return string Hash code |
441 | 441 | */ |
442 | 442 | public function getHashCode() { |
443 | - return md5( |
|
444 | - $this->_formula1 |
|
445 | - . $this->_formula2 |
|
446 | - . $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE |
|
447 | - . $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP |
|
448 | - . $this->_operator |
|
449 | - . ($this->_allowBlank ? 't' : 'f') |
|
450 | - . ($this->_showDropDown ? 't' : 'f') |
|
451 | - . ($this->_showInputMessage ? 't' : 'f') |
|
452 | - . ($this->_showErrorMessage ? 't' : 'f') |
|
453 | - . $this->_errorTitle |
|
454 | - . $this->_error |
|
455 | - . $this->_promptTitle |
|
456 | - . $this->_prompt |
|
457 | - . __CLASS__ |
|
458 | - ); |
|
459 | - } |
|
443 | + return md5( |
|
444 | + $this->_formula1 |
|
445 | + . $this->_formula2 |
|
446 | + . $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE |
|
447 | + . $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP |
|
448 | + . $this->_operator |
|
449 | + . ($this->_allowBlank ? 't' : 'f') |
|
450 | + . ($this->_showDropDown ? 't' : 'f') |
|
451 | + . ($this->_showInputMessage ? 't' : 'f') |
|
452 | + . ($this->_showErrorMessage ? 't' : 'f') |
|
453 | + . $this->_errorTitle |
|
454 | + . $this->_error |
|
455 | + . $this->_promptTitle |
|
456 | + . $this->_prompt |
|
457 | + . __CLASS__ |
|
458 | + ); |
|
459 | + } |
|
460 | 460 | |
461 | 461 | /** |
462 | 462 | * Implement PHP __clone to create a deep clone, not just a shallow copy. |
@@ -37,27 +37,27 @@ discard block |
||
37 | 37 | { |
38 | 38 | /* Data validation types */ |
39 | 39 | const TYPE_NONE = 'none'; |
40 | - const TYPE_CUSTOM = 'custom'; |
|
40 | + const TYPE_CUSTOM = 'custom'; |
|
41 | 41 | const TYPE_DATE = 'date'; |
42 | - const TYPE_DECIMAL = 'decimal'; |
|
42 | + const TYPE_DECIMAL = 'decimal'; |
|
43 | 43 | const TYPE_LIST = 'list'; |
44 | - const TYPE_TEXTLENGTH = 'textLength'; |
|
44 | + const TYPE_TEXTLENGTH = 'textLength'; |
|
45 | 45 | const TYPE_TIME = 'time'; |
46 | 46 | const TYPE_WHOLE = 'whole'; |
47 | 47 | |
48 | 48 | /* Data validation error styles */ |
49 | 49 | const STYLE_STOP = 'stop'; |
50 | - const STYLE_WARNING = 'warning'; |
|
51 | - const STYLE_INFORMATION = 'information'; |
|
50 | + const STYLE_WARNING = 'warning'; |
|
51 | + const STYLE_INFORMATION = 'information'; |
|
52 | 52 | |
53 | 53 | /* Data validation operators */ |
54 | - const OPERATOR_BETWEEN = 'between'; |
|
55 | - const OPERATOR_EQUAL = 'equal'; |
|
56 | - const OPERATOR_GREATERTHAN = 'greaterThan'; |
|
57 | - const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual'; |
|
54 | + const OPERATOR_BETWEEN = 'between'; |
|
55 | + const OPERATOR_EQUAL = 'equal'; |
|
56 | + const OPERATOR_GREATERTHAN = 'greaterThan'; |
|
57 | + const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual'; |
|
58 | 58 | const OPERATOR_LESSTHAN = 'lessThan'; |
59 | - const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual'; |
|
60 | - const OPERATOR_NOTBETWEEN = 'notBetween'; |
|
59 | + const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual'; |
|
60 | + const OPERATOR_NOTBETWEEN = 'notBetween'; |
|
61 | 61 | const OPERATOR_NOTEQUAL = 'notEqual'; |
62 | 62 | |
63 | 63 | /** |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | // Initialise member variables |
162 | 162 | $this->_formula1 = ''; |
163 | 163 | $this->_formula2 = ''; |
164 | - $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE; |
|
164 | + $this->_type = PHPExcel_Cell_DataValidation::TYPE_NONE; |
|
165 | 165 | $this->_errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP; |
166 | 166 | $this->_operator = ''; |
167 | 167 | $this->_allowBlank = false; |
168 | - $this->_showDropDown = false; |
|
168 | + $this->_showDropDown = false; |
|
169 | 169 | $this->_showInputMessage = false; |
170 | 170 | $this->_showErrorMessage = false; |
171 | 171 | $this->_errorTitle = ''; |
172 | - $this->_error = ''; |
|
172 | + $this->_error = ''; |
|
173 | 173 | $this->_promptTitle = ''; |
174 | - $this->_prompt = ''; |
|
174 | + $this->_prompt = ''; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | /** PHPExcel root directory */ |
30 | -if (!defined('PHPEXCEL_ROOT')) { |
|
30 | +if ( ! defined('PHPEXCEL_ROOT')) { |
|
31 | 31 | /** |
32 | 32 | * @ignore |
33 | 33 | */ |
34 | - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../'); |
|
35 | - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php'); |
|
34 | + define('PHPEXCEL_ROOT', dirname(__FILE__).'/../../'); |
|
35 | + require(PHPEXCEL_ROOT.'PHPExcel/Autoloader.php'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | // Set value explicit |
63 | - $cell->setValueExplicit( $value, self::dataTypeForValue($value) ); |
|
63 | + $cell->setValueExplicit($value, self::dataTypeForValue($value)); |
|
64 | 64 | |
65 | 65 | // Done! |
66 | 66 | return true; |
@@ -59,8 +59,8 @@ |
||
59 | 59 | public function __construct($pUrl = '', $pTooltip = '') |
60 | 60 | { |
61 | 61 | // Initialise member variables |
62 | - $this->_url = $pUrl; |
|
63 | - $this->_tooltip = $pTooltip; |
|
62 | + $this->_url = $pUrl; |
|
63 | + $this->_tooltip = $pTooltip; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | */ |
50 | 50 | private $_tooltip; |
51 | 51 | |
52 | - /** |
|
53 | - * Create a new PHPExcel_Cell_Hyperlink |
|
54 | - * |
|
55 | - * @param string $pUrl Url to link the cell to |
|
56 | - * @param string $pTooltip Tooltip to display on the hyperlink |
|
57 | - * @throws Exception |
|
58 | - */ |
|
59 | - public function __construct($pUrl = '', $pTooltip = '') |
|
60 | - { |
|
61 | - // Initialise member variables |
|
52 | + /** |
|
53 | + * Create a new PHPExcel_Cell_Hyperlink |
|
54 | + * |
|
55 | + * @param string $pUrl Url to link the cell to |
|
56 | + * @param string $pTooltip Tooltip to display on the hyperlink |
|
57 | + * @throws Exception |
|
58 | + */ |
|
59 | + public function __construct($pUrl = '', $pTooltip = '') |
|
60 | + { |
|
61 | + // Initialise member variables |
|
62 | 62 | $this->_url = $pUrl; |
63 | 63 | $this->_tooltip = $pTooltip; |
64 | - } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Get URL |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | * @return string Hash code |
119 | 119 | */ |
120 | 120 | public function getHashCode() { |
121 | - return md5( |
|
122 | - $this->_url |
|
123 | - . $this->_tooltip |
|
124 | - . __CLASS__ |
|
125 | - ); |
|
126 | - } |
|
121 | + return md5( |
|
122 | + $this->_url |
|
123 | + . $this->_tooltip |
|
124 | + . __CLASS__ |
|
125 | + ); |
|
126 | + } |
|
127 | 127 | } |
@@ -287,11 +287,11 @@ discard block |
||
287 | 287 | * @param integer $yOffset |
288 | 288 | * @return PHPExcel_Chart |
289 | 289 | */ |
290 | - public function setTopLeftPosition($cell, $xOffset=null, $yOffset=null) { |
|
290 | + public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null) { |
|
291 | 291 | $this->_topLeftCellRef = $cell; |
292 | - if (!is_null($xOffset)) |
|
292 | + if ( ! is_null($xOffset)) |
|
293 | 293 | $this->setTopLeftXOffset($xOffset); |
294 | - if (!is_null($yOffset)) |
|
294 | + if ( ! is_null($yOffset)) |
|
295 | 295 | $this->setTopLeftYOffset($yOffset); |
296 | 296 | |
297 | 297 | return $this; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell |
304 | 304 | */ |
305 | 305 | public function getTopLeftPosition() { |
306 | - return array( 'cell' => $this->_topLeftCellRef, |
|
306 | + return array('cell' => $this->_topLeftCellRef, |
|
307 | 307 | 'xOffset' => $this->_topLeftXOffset, |
308 | 308 | 'yOffset' => $this->_topLeftYOffset |
309 | 309 | ); |
@@ -330,17 +330,17 @@ discard block |
||
330 | 330 | return $this; |
331 | 331 | } |
332 | 332 | |
333 | - public function setTopLeftOffset($xOffset=null,$yOffset=null) { |
|
334 | - if (!is_null($xOffset)) |
|
333 | + public function setTopLeftOffset($xOffset = null, $yOffset = null) { |
|
334 | + if ( ! is_null($xOffset)) |
|
335 | 335 | $this->setTopLeftXOffset($xOffset); |
336 | - if (!is_null($yOffset)) |
|
336 | + if ( ! is_null($yOffset)) |
|
337 | 337 | $this->setTopLeftYOffset($yOffset); |
338 | 338 | |
339 | 339 | return $this; |
340 | 340 | } |
341 | 341 | |
342 | 342 | public function getTopLeftOffset() { |
343 | - return array( 'X' => $this->_topLeftXOffset, |
|
343 | + return array('X' => $this->_topLeftXOffset, |
|
344 | 344 | 'Y' => $this->_topLeftYOffset |
345 | 345 | ); |
346 | 346 | } |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | * @param integer $yOffset |
374 | 374 | * @return PHPExcel_Chart |
375 | 375 | */ |
376 | - public function setBottomRightPosition($cell, $xOffset=null, $yOffset=null) { |
|
376 | + public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null) { |
|
377 | 377 | $this->_bottomRightCellRef = $cell; |
378 | - if (!is_null($xOffset)) |
|
378 | + if ( ! is_null($xOffset)) |
|
379 | 379 | $this->setBottomRightXOffset($xOffset); |
380 | - if (!is_null($yOffset)) |
|
380 | + if ( ! is_null($yOffset)) |
|
381 | 381 | $this->setBottomRightYOffset($yOffset); |
382 | 382 | |
383 | 383 | return $this; |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell |
390 | 390 | */ |
391 | 391 | public function getBottomRightPosition() { |
392 | - return array( 'cell' => $this->_bottomRightCellRef, |
|
392 | + return array('cell' => $this->_bottomRightCellRef, |
|
393 | 393 | 'xOffset' => $this->_bottomRightXOffset, |
394 | 394 | 'yOffset' => $this->_bottomRightYOffset |
395 | 395 | ); |
@@ -410,17 +410,17 @@ discard block |
||
410 | 410 | return $this->_bottomRightCellRef; |
411 | 411 | } |
412 | 412 | |
413 | - public function setBottomRightOffset($xOffset=null,$yOffset=null) { |
|
414 | - if (!is_null($xOffset)) |
|
413 | + public function setBottomRightOffset($xOffset = null, $yOffset = null) { |
|
414 | + if ( ! is_null($xOffset)) |
|
415 | 415 | $this->setBottomRightXOffset($xOffset); |
416 | - if (!is_null($yOffset)) |
|
416 | + if ( ! is_null($yOffset)) |
|
417 | 417 | $this->setBottomRightYOffset($yOffset); |
418 | 418 | |
419 | 419 | return $this; |
420 | 420 | } |
421 | 421 | |
422 | 422 | public function getBottomRightOffset() { |
423 | - return array( 'X' => $this->_bottomRightXOffset, |
|
423 | + return array('X' => $this->_bottomRightXOffset, |
|
424 | 424 | 'Y' => $this->_bottomRightYOffset |
425 | 425 | ); |
426 | 426 | } |
@@ -461,10 +461,10 @@ discard block |
||
461 | 461 | $this->refresh(); |
462 | 462 | |
463 | 463 | $libraryPath = PHPExcel_Settings::getChartRendererPath(); |
464 | - $includePath = str_replace('\\','/',get_include_path()); |
|
465 | - $rendererPath = str_replace('\\','/',$libraryPath); |
|
466 | - if (strpos($rendererPath,$includePath) === false) { |
|
467 | - set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath); |
|
464 | + $includePath = str_replace('\\', '/', get_include_path()); |
|
465 | + $rendererPath = str_replace('\\', '/', $libraryPath); |
|
466 | + if (strpos($rendererPath, $includePath) === false) { |
|
467 | + set_include_path(get_include_path().PATH_SEPARATOR.$libraryPath); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | $rendererName = 'PHPExcel_Chart_Renderer_'.$libraryName; |
@@ -289,10 +289,12 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function setTopLeftPosition($cell, $xOffset=null, $yOffset=null) { |
291 | 291 | $this->_topLeftCellRef = $cell; |
292 | - if (!is_null($xOffset)) |
|
293 | - $this->setTopLeftXOffset($xOffset); |
|
294 | - if (!is_null($yOffset)) |
|
295 | - $this->setTopLeftYOffset($yOffset); |
|
292 | + if (!is_null($xOffset)) { |
|
293 | + $this->setTopLeftXOffset($xOffset); |
|
294 | + } |
|
295 | + if (!is_null($yOffset)) { |
|
296 | + $this->setTopLeftYOffset($yOffset); |
|
297 | + } |
|
296 | 298 | |
297 | 299 | return $this; |
298 | 300 | } |
@@ -331,10 +333,12 @@ discard block |
||
331 | 333 | } |
332 | 334 | |
333 | 335 | public function setTopLeftOffset($xOffset=null,$yOffset=null) { |
334 | - if (!is_null($xOffset)) |
|
335 | - $this->setTopLeftXOffset($xOffset); |
|
336 | - if (!is_null($yOffset)) |
|
337 | - $this->setTopLeftYOffset($yOffset); |
|
336 | + if (!is_null($xOffset)) { |
|
337 | + $this->setTopLeftXOffset($xOffset); |
|
338 | + } |
|
339 | + if (!is_null($yOffset)) { |
|
340 | + $this->setTopLeftYOffset($yOffset); |
|
341 | + } |
|
338 | 342 | |
339 | 343 | return $this; |
340 | 344 | } |
@@ -375,10 +379,12 @@ discard block |
||
375 | 379 | */ |
376 | 380 | public function setBottomRightPosition($cell, $xOffset=null, $yOffset=null) { |
377 | 381 | $this->_bottomRightCellRef = $cell; |
378 | - if (!is_null($xOffset)) |
|
379 | - $this->setBottomRightXOffset($xOffset); |
|
380 | - if (!is_null($yOffset)) |
|
381 | - $this->setBottomRightYOffset($yOffset); |
|
382 | + if (!is_null($xOffset)) { |
|
383 | + $this->setBottomRightXOffset($xOffset); |
|
384 | + } |
|
385 | + if (!is_null($yOffset)) { |
|
386 | + $this->setBottomRightYOffset($yOffset); |
|
387 | + } |
|
382 | 388 | |
383 | 389 | return $this; |
384 | 390 | } |
@@ -411,10 +417,12 @@ discard block |
||
411 | 417 | } |
412 | 418 | |
413 | 419 | public function setBottomRightOffset($xOffset=null,$yOffset=null) { |
414 | - if (!is_null($xOffset)) |
|
415 | - $this->setBottomRightXOffset($xOffset); |
|
416 | - if (!is_null($yOffset)) |
|
417 | - $this->setBottomRightYOffset($yOffset); |
|
420 | + if (!is_null($xOffset)) { |
|
421 | + $this->setBottomRightXOffset($xOffset); |
|
422 | + } |
|
423 | + if (!is_null($yOffset)) { |
|
424 | + $this->setBottomRightYOffset($yOffset); |
|
425 | + } |
|
418 | 426 | |
419 | 427 | return $this; |
420 | 428 | } |
@@ -47,56 +47,56 @@ |
||
47 | 47 | * |
48 | 48 | * @var string |
49 | 49 | */ |
50 | - private $_xMode = null; |
|
50 | + private $_xMode = null; |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Y Mode |
54 | 54 | * |
55 | 55 | * @var string |
56 | 56 | */ |
57 | - private $_yMode = null; |
|
57 | + private $_yMode = null; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * X-Position |
61 | 61 | * |
62 | 62 | * @var float |
63 | 63 | */ |
64 | - private $_xPos = null; |
|
64 | + private $_xPos = null; |
|
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Y-Position |
68 | 68 | * |
69 | 69 | * @var float |
70 | 70 | */ |
71 | - private $_yPos = null; |
|
71 | + private $_yPos = null; |
|
72 | 72 | |
73 | 73 | /** |
74 | 74 | * width |
75 | 75 | * |
76 | 76 | * @var float |
77 | 77 | */ |
78 | - private $_width = null; |
|
78 | + private $_width = null; |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * height |
82 | 82 | * |
83 | 83 | * @var float |
84 | 84 | */ |
85 | - private $_height = null; |
|
85 | + private $_height = null; |
|
86 | 86 | |
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Create a new PHPExcel_Chart_Layout |
90 | 90 | */ |
91 | - public function __construct($layout=array()) |
|
91 | + public function __construct($layout = array()) |
|
92 | 92 | { |
93 | - if (isset($layout['layoutTarget'])) { $this->_layoutTarget = $layout['layoutTarget']; } |
|
94 | - if (isset($layout['xMode'])) { $this->_xMode = $layout['xMode']; } |
|
95 | - if (isset($layout['yMode'])) { $this->_yMode = $layout['yMode']; } |
|
96 | - if (isset($layout['x'])) { $this->_xPos = (float) $layout['x']; } |
|
97 | - if (isset($layout['y'])) { $this->_yPos = (float) $layout['y']; } |
|
98 | - if (isset($layout['w'])) { $this->_width = (float) $layout['w']; } |
|
99 | - if (isset($layout['h'])) { $this->_height = (float) $layout['h']; } |
|
93 | + if (isset($layout['layoutTarget'])) { $this->_layoutTarget = $layout['layoutTarget']; } |
|
94 | + if (isset($layout['xMode'])) { $this->_xMode = $layout['xMode']; } |
|
95 | + if (isset($layout['yMode'])) { $this->_yMode = $layout['yMode']; } |
|
96 | + if (isset($layout['x'])) { $this->_xPos = (float) $layout['x']; } |
|
97 | + if (isset($layout['y'])) { $this->_yPos = (float) $layout['y']; } |
|
98 | + if (isset($layout['w'])) { $this->_width = (float) $layout['w']; } |
|
99 | + if (isset($layout['h'])) { $this->_height = (float) $layout['h']; } |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -55,7 +55,7 @@ |
||
55 | 55 | self::xlLegendPositionLeft => self::POSITION_LEFT, |
56 | 56 | self::xlLegendPositionRight => self::POSITION_RIGHT, |
57 | 57 | self::xlLegendPositionTop => self::POSITION_TOP |
58 | - ); |
|
58 | + ); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Legend position |
@@ -36,20 +36,20 @@ discard block |
||
36 | 36 | class PHPExcel_Chart_Legend |
37 | 37 | { |
38 | 38 | /** Legend positions */ |
39 | - const xlLegendPositionBottom = -4107; // Below the chart. |
|
40 | - const xlLegendPositionCorner = 2; // In the upper right-hand corner of the chart border. |
|
41 | - const xlLegendPositionCustom = -4161; // A custom position. |
|
42 | - const xlLegendPositionLeft = -4131; // Left of the chart. |
|
43 | - const xlLegendPositionRight = -4152; // Right of the chart. |
|
44 | - const xlLegendPositionTop = -4160; // Above the chart. |
|
39 | + const xlLegendPositionBottom = -4107; // Below the chart. |
|
40 | + const xlLegendPositionCorner = 2; // In the upper right-hand corner of the chart border. |
|
41 | + const xlLegendPositionCustom = -4161; // A custom position. |
|
42 | + const xlLegendPositionLeft = -4131; // Left of the chart. |
|
43 | + const xlLegendPositionRight = -4152; // Right of the chart. |
|
44 | + const xlLegendPositionTop = -4160; // Above the chart. |
|
45 | 45 | |
46 | 46 | const POSITION_RIGHT = 'r'; |
47 | 47 | const POSITION_LEFT = 'l'; |
48 | - const POSITION_BOTTOM = 'b'; |
|
49 | - const POSITION_TOP = 't'; |
|
50 | - const POSITION_TOPRIGHT = 'tr'; |
|
48 | + const POSITION_BOTTOM = 'b'; |
|
49 | + const POSITION_TOP = 't'; |
|
50 | + const POSITION_TOPRIGHT = 'tr'; |
|
51 | 51 | |
52 | - private static $_positionXref = array( self::xlLegendPositionBottom => self::POSITION_BOTTOM, |
|
52 | + private static $_positionXref = array(self::xlLegendPositionBottom => self::POSITION_BOTTOM, |
|
53 | 53 | self::xlLegendPositionCorner => self::POSITION_TOPRIGHT, |
54 | 54 | self::xlLegendPositionCustom => '??', |
55 | 55 | self::xlLegendPositionLeft => self::POSITION_LEFT, |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | /** |
83 | 83 | * Create a new PHPExcel_Chart_Legend |
84 | 84 | */ |
85 | - public function __construct($position = null, PHPExcel_Chart_Layout $layout = null, $overlay= false) |
|
85 | + public function __construct($position = null, PHPExcel_Chart_Layout $layout = null, $overlay = false) |
|
86 | 86 | { |
87 | 87 | $this->_position = $position; |
88 | 88 | $this->_layout = $layout; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param string $position |
105 | 105 | */ |
106 | 106 | public function setPosition($position = self::POSITION_RIGHT) { |
107 | - if (!in_array($position,self::$positionXref)) { |
|
107 | + if ( ! in_array($position, self::$positionXref)) { |
|
108 | 108 | return false; |
109 | 109 | } |
110 | 110 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return number |
120 | 120 | */ |
121 | 121 | public function getPositionXL() { |
122 | - return array_search($this->_position,self::$positionXref); |
|
122 | + return array_search($this->_position, self::$positionXref); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param number $positionXL |
129 | 129 | */ |
130 | 130 | public function setPositionXL($positionXL = self::xlLegendPositionRight) { |
131 | - if (!array_key_exists($positionXL,self::$positionXref)) { |
|
131 | + if ( ! array_key_exists($positionXL, self::$positionXref)) { |
|
132 | 132 | return false; |
133 | 133 | } |
134 | 134 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @param boolean $value |
152 | 152 | */ |
153 | - public function setOverlay($value=false) { |
|
153 | + public function setOverlay($value = false) { |
|
154 | 154 | $this->_overlay = $value; |
155 | 155 | } |
156 | 156 |