phpcs cleanup

This commit is contained in:
MarkBaker 2018-11-20 08:18:35 +01:00
parent 0a9e15ca69
commit 5854ce3738
4 changed files with 11 additions and 11 deletions

View File

@ -4,11 +4,11 @@ namespace PhpOffice\PhpSpreadsheet\Reader;
use DateTime;
use DateTimeZone;
use PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner;
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\Document\Properties;
use PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner;
use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Settings;
use PhpOffice\PhpSpreadsheet\Shared\Date;

View File

@ -7,7 +7,7 @@ use PhpOffice\PhpSpreadsheet\Reader\Exception;
class XmlScanner
{
/**
* Identifies whether the thread-safe libxmlDisableEntityLoader() function is available
* Identifies whether the thread-safe libxmlDisableEntityLoader() function is available.
*
* @var bool
*/
@ -30,12 +30,13 @@ class XmlScanner
if (PHP_MAJOR_VERSION > 7) {
switch (PHP_MINOR_VERSION) {
case 2:
return (PHP_RELEASE_VERSION >= 1);
return PHP_RELEASE_VERSION >= 1;
case 1:
return (PHP_RELEASE_VERSION >= 13);
return PHP_RELEASE_VERSION >= 13;
case 0:
return (PHP_RELEASE_VERSION >= 27);
return PHP_RELEASE_VERSION >= 27;
}
return true;
}
@ -45,13 +46,14 @@ class XmlScanner
/**
* Scan the XML for use of <!ENTITY to prevent XXE/XEE attacks.
*
* @param string $filestream
* @param mixed $xml
*
* @throws Exception
*
* @return string
*/
public function scan($xml) {
public function scan($xml)
{
$pattern = '/encoding="(.*?)"/';
$result = preg_match($pattern, $xml, $matches);
$charset = $result ? $matches[1] : 'UTF-8';

View File

@ -2,8 +2,8 @@
namespace PhpOffice\PhpSpreadsheetTests\Reader\Security;
use PHPUnit\Framework\TestCase;
use PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner;
use PHPUnit\Framework\TestCase;
class XmlScannerTest extends TestCase
{
@ -30,7 +30,6 @@ class XmlScannerTest extends TestCase
return $tests;
}
/**
* @dataProvider providerInvalidXML
*
@ -55,4 +54,4 @@ class XmlScannerTest extends TestCase
return $tests;
}
}
}

View File

@ -3,7 +3,6 @@
namespace PhpOffice\PhpSpreadsheetTests\Reader;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\Reader\BaseReader;
use PhpOffice\PhpSpreadsheet\Reader\Xml;
use PHPUnit\Framework\TestCase;