Merge branch 'develop' into feature/gh-17

This commit is contained in:
MarkBaker 2016-08-13 16:59:03 +01:00
commit fd2df82faf
13 changed files with 53 additions and 29 deletions

View File

@ -1,29 +1,31 @@
language: php language: php
php: php:
- 5.4
- 5.5 - 5.5
- 5.6 - 5.6
- 7.0 - 7.0
- 7.1
- hhvm - hhvm
matrix: matrix:
allow_failures: allow_failures:
- php: 7.1
- php: hhvm - php: hhvm
cache:
directories:
- vendor
- $HOME/.composer/cache
before_script: before_script:
## Packages ## Packages
- sudo apt-get -qq update > /dev/null - sudo apt-get -qq update > /dev/null
## Composer ## Composer
- composer self-update - composer self-update
- composer install --prefer-source --dev - composer install
- phpenv global "$TRAVIS_PHP_VERSION"
script: script:
## PHP_CodeSniffer ## PHP_CodeSniffer
- ./vendor/bin/phpcs --report-width=200 --report-summary --report-full src/ unitTests/ --standard=PSR2 -n - ./vendor/bin/phpcs --report-width=200 --report-summary --report-full src/ unitTests/ --standard=PSR2 -n
## PHPUnit ## PHPUnit
- ./vendor/bin/phpunit -c ./unitTests/ - ./vendor/bin/phpunit -c ./unitTests/
notifications:
email: false

View File

@ -215,7 +215,6 @@ class TextData
} }
return \PHPExcel\Style\NumberFormat::toFormattedString($value, $mask); return \PHPExcel\Style\NumberFormat::toFormattedString($value, $mask);
} }

View File

@ -427,7 +427,6 @@ class Properties
if (isset($this->customProperties[$propertyName])) { if (isset($this->customProperties[$propertyName])) {
return $this->customProperties[$propertyName]['value']; return $this->customProperties[$propertyName]['value'];
} }
} }
/** /**
@ -441,7 +440,6 @@ class Properties
if (isset($this->customProperties[$propertyName])) { if (isset($this->customProperties[$propertyName])) {
return $this->customProperties[$propertyName]['type']; return $this->customProperties[$propertyName]['type'];
} }
} }
/** /**

View File

@ -1628,7 +1628,6 @@ class Excel5 extends BaseReader implements IReader
// ->setAuthor($author) // ->setAuthor($author)
} }
} }
} }
@ -2503,7 +2502,6 @@ class Excel5 extends BaseReader implements IReader
$offset += $cb; $offset += $cb;
} }
} }
} }
@ -5258,7 +5256,6 @@ class Excel5 extends BaseReader implements IReader
); );
return $splicedData; return $splicedData;
} }

View File

@ -33,6 +33,39 @@ class Date
const CALENDAR_WINDOWS_1900 = 1900; // Base date of 1st Jan 1900 = 1.0 const CALENDAR_WINDOWS_1900 = 1900; // Base date of 1st Jan 1900 = 1.0
const CALENDAR_MAC_1904 = 1904; // Base date of 2nd Jan 1904 = 1.0 const CALENDAR_MAC_1904 = 1904; // Base date of 2nd Jan 1904 = 1.0
/*
* Names of the months of the year, indexed by shortname
* Planned usage for locale settings
*
* @public
* @var string[]
*/
public static $monthNames = [
'Jan' => 'January',
'Feb' => 'February',
'Mar' => 'March',
'Apr' => 'April',
'May' => 'May',
'Jun' => 'June',
'Jul' => 'July',
'Aug' => 'August',
'Sep' => 'September',
'Oct' => 'October',
'Nov' => 'November',
'Dec' => 'December',
];
/*
* @public
* @var string[]
*/
public static $numberSuffixes = [
'st',
'nd',
'rd',
'th',
];
/* /*
* Base calendar year to use for calculations * Base calendar year to use for calculations
* Value is either CALENDAR_WINDOWS_1900 (1900) or CALENDAR_MAC_1904 (1904) * Value is either CALENDAR_WINDOWS_1900 (1900) or CALENDAR_MAC_1904 (1904)
@ -112,7 +145,8 @@ class Date
* @return \DateTimeZone The timezone as a timezone object * @return \DateTimeZone The timezone as a timezone object
* @throws \Exception * @throws \Exception
*/ */
protected static function validateTimeZone($timeZone) { protected static function validateTimeZone($timeZone)
{
if (is_object($timeZone) && $timeZone instanceof \DateTimeZone) { if (is_object($timeZone) && $timeZone instanceof \DateTimeZone) {
return $timeZone; return $timeZone;
} elseif (is_string($timeZone)) { } elseif (is_string($timeZone)) {
@ -130,14 +164,15 @@ class Date
* @return \DateTime PHP date/time object * @return \DateTime PHP date/time object
* @throws \Exception * @throws \Exception
*/ */
public static function excelToDateTimeObject($excelTimestamp = 0, $timeZone = null) { public static function excelToDateTimeObject($excelTimestamp = 0, $timeZone = null)
{
$timeZone = ($timeZone === null) ? self::getDefaultTimezone() : self::validateTimeZone($timeZone); $timeZone = ($timeZone === null) ? self::getDefaultTimezone() : self::validateTimeZone($timeZone);
if (self::$excelCalendar == self::CALENDAR_WINDOWS_1900) { if (self::$excelCalendar == self::CALENDAR_WINDOWS_1900) {
$baseDate = ($excelTimestamp < 60) ? new \DateTime('1899-12-31', $timeZone) : new \DateTime('1899-12-30', $timeZone); $baseDate = ($excelTimestamp < 60) ? new \DateTime('1899-12-31', $timeZone) : new \DateTime('1899-12-30', $timeZone);
} else { } else {
$baseDate = new \DateTime('1904-01-01', $timeZone); $baseDate = new \DateTime('1904-01-01', $timeZone);
} }
$days = floor($excelTimestamp); $days = floor($excelTimestamp);
$partDay = $excelTimestamp - $days; $partDay = $excelTimestamp - $days;
$hours = floor($partDay * 24); $hours = floor($partDay * 24);
$partDay = $partDay * 24 - $hours; $partDay = $partDay * 24 - $hours;
@ -147,9 +182,9 @@ class Date
// $fraction = $partDay - $seconds; // $fraction = $partDay - $seconds;
$interval = '+' . $days . ' days'; $interval = '+' . $days . ' days';
return $baseDate->modify($interval) return $baseDate->modify($interval)
->setTime($hours, $minutes, $seconds); ->setTime($hours, $minutes, $seconds);
} }
/** /**
* Convert a MS serialized datetime value from Excel to a unix timestamp * Convert a MS serialized datetime value from Excel to a unix timestamp
@ -158,10 +193,11 @@ class Date
* @return integer Unix timetamp for this date/time * @return integer Unix timetamp for this date/time
* @throws \Exception * @throws \Exception
*/ */
public static function excelToTimestamp($excelTimestamp = 0, $timeZone = null) { public static function excelToTimestamp($excelTimestamp = 0, $timeZone = null)
return self::excelToDateTimeObject($excelTimestamp, $timeZone) {
return self::excelToDateTimeObject($excelTimestamp, $timeZone)
->format('U'); ->format('U');
} }
/** /**

View File

@ -428,7 +428,6 @@ class SingularValueDecomposition
break; break;
} // end switch } // end switch
} // end while } // end while
} // end constructor } // end constructor

View File

@ -563,7 +563,6 @@ class Spreadsheet
($pIndex > count($this->workSheetCollection) - 1)) { ($pIndex > count($this->workSheetCollection) - 1)) {
--$this->activeSheetIndex; --$this->activeSheetIndex;
} }
} }
/** /**

View File

@ -59,6 +59,5 @@ class RelsVBA extends WriterPart
$objWriter->endElement(); $objWriter->endElement();
return $objWriter->getData(); return $objWriter->getData();
} }
} }

View File

@ -232,7 +232,6 @@ class Workbook extends BIFFwriter
$this->addColor($phpSheet->getTabColor()->getRGB()); $this->addColor($phpSheet->getTabColor()->getRGB());
} }
} }
} }
/** /**

View File

@ -151,7 +151,6 @@ class Xf
$this->rightBorderColor = 0x40; $this->rightBorderColor = 0x40;
$this->_diag_color = 0x40; $this->_diag_color = 0x40;
$this->_style = $style; $this->_style = $style;
} }

View File

@ -26,7 +26,6 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
$this->cellStub->expects($this->any()) $this->cellStub->expects($this->any())
->method('setValueExplicit') ->method('setValueExplicit')
->will($this->returnValue(true)); ->will($this->returnValue(true));
} }
/** /**

View File

@ -18,7 +18,6 @@ class TimeZoneTest extends \PHPUnit_Framework_TestCase
$result = call_user_func(array('\PHPExcel\Shared\TimeZone','setTimezone'), $timezoneValue); $result = call_user_func(array('\PHPExcel\Shared\TimeZone','setTimezone'), $timezoneValue);
$this->assertTrue($result); $this->assertTrue($result);
} }
} }
public function testSetTimezoneWithInvalidValue() public function testSetTimezoneWithInvalidValue()

View File

@ -25,5 +25,4 @@ class SettingsTest extends \PHPUnit_Framework_TestCase
$result = call_user_func(array('PHPExcel\\Settings','getLibXmlLoaderOptions')); $result = call_user_func(array('PHPExcel\\Settings','getLibXmlLoaderOptions'));
$this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID) & $result)); $this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID) & $result));
} }
} }