强制提交

This commit is contained in:
wyn
2026-06-29 10:43:07 +08:00
parent 5860f78f6d
commit 9c8f7cc3b6
220 changed files with 1360 additions and 857 deletions

View File

@@ -7,12 +7,13 @@ $baseDir = dirname($vendorDir);
return array(
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'9c67151ae59aff4788964ce8eb2a0f43' => $vendorDir . '/clue/stream-filter/src/functions_include.php',
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'8cff32064859f4559445b89279f3199c' => $vendorDir . '/php-http/message/src/filters.php',
'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'9b552a3cc426e3287cc811caefa3cf53' => $vendorDir . '/topthink/think-helper/src/helper.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'1cfd2761b63b0a29ed23657ea394cb2d' => $vendorDir . '/topthink/think-captcha/src/helper.php',

View File

@@ -6,6 +6,7 @@ $vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'Smalot\\PdfParser\\' => array($vendorDir . '/smalot/pdfparser/src'),
'Rs\\Json' => array($vendorDir . '/php-jsonpointer/php-jsonpointer/src'),
'PHPExcel' => array($vendorDir . '/phpoffice/phpexcel/Classes'),
'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'),

View File

@@ -15,11 +15,12 @@ return array(
'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'),
'Unirest\\' => array($vendorDir . '/apimatic/unirest-php/src'),
'Tectalic\\OpenAi\\' => array($vendorDir . '/tectalic/openai/src'),
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
'Spatie\\DataTransferObject\\' => array($vendorDir . '/spatie/data-transfer-object/src'),
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
'PhpOffice\\PhpWord\\' => array($vendorDir . '/phpoffice/phpword/src/PhpWord'),
@@ -30,6 +31,7 @@ return array(
'ParagonIE\\ConstantTime\\' => array($vendorDir . '/paragonie/constant_time_encoding/src'),
'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'),
'Nyholm\\Psr7\\' => array($vendorDir . '/nyholm/psr7/src'),
'MyCLabs\\Enum\\' => array($vendorDir . '/myclabs/php-enum/src'),
'Matrix\\' => array($vendorDir . '/markbaker/matrix/classes/src'),
'Http\\Message\\MultipartStream\\' => array($vendorDir . '/php-http/multipart-stream-builder/src'),
'Http\\Message\\' => array($vendorDir . '/php-http/message/src'),
@@ -39,7 +41,6 @@ return array(
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Core\\' => array($vendorDir . '/apimatic/core/src'),
'CoreInterfaces\\' => array($vendorDir . '/apimatic/core-interfaces/src'),
'Composer\\Pcre\\' => array($vendorDir . '/composer/pcre/src'),
'Complex\\' => array($vendorDir . '/markbaker/complex/classes/src'),
'Clue\\StreamFilter\\' => array($vendorDir . '/clue/stream-filter/src'),
);

View File

@@ -8,12 +8,13 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'9c67151ae59aff4788964ce8eb2a0f43' => __DIR__ . '/..' . '/clue/stream-filter/src/functions_include.php',
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'8cff32064859f4559445b89279f3199c' => __DIR__ . '/..' . '/php-http/message/src/filters.php',
'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php',
@@ -50,6 +51,7 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
),
'S' =>
array (
'Symfony\\Polyfill\\Php80\\' => 23,
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Component\\HttpFoundation\\' => 33,
'Spatie\\DataTransferObject\\' => 26,
@@ -74,6 +76,7 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
),
'M' =>
array (
'MyCLabs\\Enum\\' => 13,
'Matrix\\' => 7,
),
'H' =>
@@ -92,7 +95,6 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
array (
'Core\\' => 5,
'CoreInterfaces\\' => 15,
'Composer\\Pcre\\' => 14,
'Complex\\' => 8,
'Clue\\StreamFilter\\' => 18,
),
@@ -138,6 +140,10 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
array (
0 => __DIR__ . '/..' . '/tectalic/openai/src',
),
'Symfony\\Polyfill\\Php80\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
),
'Symfony\\Polyfill\\Mbstring\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
@@ -156,7 +162,7 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
),
'Psr\\Log\\' =>
array (
0 => __DIR__ . '/..' . '/psr/log/src',
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
),
'Psr\\Http\\Message\\' =>
array (
@@ -199,6 +205,10 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
array (
0 => __DIR__ . '/..' . '/nyholm/psr7/src',
),
'MyCLabs\\Enum\\' =>
array (
0 => __DIR__ . '/..' . '/myclabs/php-enum/src',
),
'Matrix\\' =>
array (
0 => __DIR__ . '/..' . '/markbaker/matrix/classes/src',
@@ -235,10 +245,6 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
array (
0 => __DIR__ . '/..' . '/apimatic/core-interfaces/src',
),
'Composer\\Pcre\\' =>
array (
0 => __DIR__ . '/..' . '/composer/pcre/src',
),
'Complex\\' =>
array (
0 => __DIR__ . '/..' . '/markbaker/complex/classes/src',
@@ -250,6 +256,13 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
);
public static $prefixesPsr0 = array (
'S' =>
array (
'Smalot\\PdfParser\\' =>
array (
0 => __DIR__ . '/..' . '/smalot/pdfparser/src',
),
),
'R' =>
array (
'Rs\\Json' =>
@@ -274,7 +287,12 @@ class ComposerStaticInit2bc4f313dba415539e266f7ac2c87dcd
);
public static $classMap = array (
'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
'Stringable' => __DIR__ . '/..' . '/myclabs/php-enum/stubs/Stringable.php',
'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
);
public static function getInitializer(ClassLoader $loader)

File diff suppressed because it is too large Load Diff

View File

@@ -48,7 +48,7 @@ This software is distributed under the [LGPL 2.1](https://www.gnu.org/licenses/o
PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file:
```json
"phpmailer/phpmailer": "^6.11.1"
"phpmailer/phpmailer": "^6.12.0"
```
or run

View File

@@ -1 +1 @@
6.11.1
6.12.0

View File

@@ -9,7 +9,7 @@
*/
$PHPMAILER_LANG['authenticate'] = 'Error SMTP: Imposible autentificar.';
$PHPMAILER_LANG['buggy_php'] = 'Tu versión de PHP ha sido afectada por un bug que puede resultar en mensajes corruptos. Para arreglarlo, cambia a enviar usando SMTP, deshabilita la opción mail.add_x_header en tu php.ini, cambia a MacOS o Linux, o actualiza tu PHP a la versión 7.0.17+ o 7.1.3+.';
$PHPMAILER_LANG['buggy_php'] = 'Tu versión de PHP está afectada por un bug que puede resultar en mensajes corruptos. Para arreglarlo, cambia a enviar usando SMTP, deshabilita la opción mail.add_x_header en tu php.ini, cambia a MacOS o Linux, o actualiza tu PHP a la versión 7.0.17+ o 7.1.3+.';
$PHPMAILER_LANG['connect_host'] = 'Error SMTP: Imposible conectar al servidor SMTP.';
$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Datos no aceptados.';
$PHPMAILER_LANG['empty_message'] = 'El cuerpo del mensaje está vacío.';
@@ -18,7 +18,7 @@ $PHPMAILER_LANG['execute'] = 'Imposible ejecutar: ';
$PHPMAILER_LANG['extension_missing'] = 'Extensión faltante: ';
$PHPMAILER_LANG['file_access'] = 'Imposible acceder al archivo: ';
$PHPMAILER_LANG['file_open'] = 'Error de Archivo: Imposible abrir el archivo: ';
$PHPMAILER_LANG['from_failed'] = 'La siguiente dirección de remitente falló: ';
$PHPMAILER_LANG['from_failed'] = 'La(s) siguiente(s) direcciones de remitente fallaron: ';
$PHPMAILER_LANG['instantiate'] = 'Imposible crear una instancia de la función Mail.';
$PHPMAILER_LANG['invalid_address'] = 'Imposible enviar: dirección de email inválido: ';
$PHPMAILER_LANG['invalid_header'] = 'Nombre o valor de encabezado no válido';
@@ -34,5 +34,3 @@ $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falló.';
$PHPMAILER_LANG['smtp_detail'] = 'Detalle: ';
$PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: ';
$PHPMAILER_LANG['variable_set'] = 'No se pudo configurar la variable: ';
$PHPMAILER_LANG['imap_recommended'] = 'No se recomienda usar el analizador de direcciones simplificado. Instala la extensión IMAP de PHP para un análisis RFC822 más completo.';
$PHPMAILER_LANG['deprecated_argument'] = 'El argumento $useimap ha quedado obsoleto';

View File

@@ -35,7 +35,7 @@ class SMTP
*
* @var string
*/
const VERSION = '6.11.1';
const VERSION = '6.12.0';
/**
* SMTP line break constant.
@@ -205,7 +205,6 @@ class SMTP
'Haraka' => '/[\d]{3} Message Queued \((.*)\)/',
'ZoneMTA' => '/[\d]{3} Message queued as (.*)/',
'Mailjet' => '/[\d]{3} OK queued as (.*)/',
'Gsmtp' => '/[\d]{3} 2\.0\.0 OK (.*) - gsmtp/',
];
/**
@@ -634,41 +633,10 @@ class SMTP
return false;
}
$oauth = $OAuth->getOauth64();
/*
* An SMTP command line can have a maximum length of 512 bytes, including the command name,
* so the base64-encoded OAUTH token has a maximum length of:
* 512 - 13 (AUTH XOAUTH2) - 2 (CRLF) = 497 bytes
* If the token is longer than that, the command and the token must be sent separately as described in
* https://www.rfc-editor.org/rfc/rfc4954#section-4
*/
if ($oauth === '') {
//Sending an empty auth token is legitimate, but it must be encoded as '='
//to indicate it's not a 2-part command
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 =', 235)) {
return false;
}
} elseif (strlen($oauth) <= 497) {
//Authenticate using a token in the initial-response part
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
return false;
}
} else {
//The token is too long, so we need to send it in two parts.
//Send the auth command without a token and expect a 334
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2', 334)) {
return false;
}
//Send the token
if (!$this->sendCommand('OAuth TOKEN', $oauth, [235, 334])) {
return false;
}
//If the server answers with 334, send an empty line and wait for a 235
if (
substr($this->last_reply, 0, 3) === '334'
&& $this->sendCommand('AUTH End', '', 235)
) {
return false;
}
//Start authentication
if (!$this->sendCommand('AUTH', 'AUTH XOAUTH2 ' . $oauth, 235)) {
return false;
}
break;
default:
@@ -1341,16 +1309,7 @@ class SMTP
//stream_select returns false when the `select` system call is interrupted
//by an incoming signal, try the select again
if (
stripos($message, 'interrupted system call') !== false ||
(
// on applications with a different locale than english, the message above is not found because
// it's translated. So we also check for the SOCKET_EINTR constant which is defined under
// Windows and UNIX-like platforms (if available on the platform).
defined('SOCKET_EINTR') &&
stripos($message, 'stream_select(): Unable to select [' . SOCKET_EINTR . ']') !== false
)
) {
if (stripos($message, 'interrupted system call') !== false) {
$this->edebug(
'SMTP -> get_lines(): retrying stream_select',
self::DEBUG_LOWLEVEL

View File

@@ -45,6 +45,7 @@ jobs:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -75,6 +76,7 @@ jobs:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2

View File

@@ -48,7 +48,7 @@ Math is an open source project licensed under the terms of [MIT](https://github.
| **Simple** | Fraction | :material-check: | :material-check: |
| | Superscript | :material-check: | |
| **Architectural** | Row | :material-check: | :material-check: |
| | Semantics | | |
| | Semantics | :material-check: | |
## Contributing

View File

@@ -10,6 +10,7 @@ use PhpOffice\Math\Element;
use PhpOffice\Math\Exception\InvalidInputException;
use PhpOffice\Math\Exception\NotImplementedException;
use PhpOffice\Math\Math;
use PhpOffice\Math\Reader\Security\XmlScanner;
class MathML implements ReaderInterface
{
@@ -22,8 +23,17 @@ class MathML implements ReaderInterface
/** @var DOMXPath */
private $xpath;
/** @var XmlScanner */
private $xmlScanner;
public function __construct()
{
$this->xmlScanner = XmlScanner::getInstance();
}
public function read(string $content): ?Math
{
$content = $this->xmlScanner->scan($content);
$content = str_replace(
[
'&InvisibleTimes;',
@@ -35,7 +45,7 @@ class MathML implements ReaderInterface
);
$this->dom = new DOMDocument();
$this->dom->loadXML($content, LIBXML_DTDLOAD);
$this->dom->loadXML($content);
$this->math = new Math();
$this->parseNode(null, $this->math);

View File

@@ -40,6 +40,26 @@ class MathML implements WriterInterface
{
$tagName = $this->getElementTagName($element);
// Element\AbstractGroupElement
if ($element instanceof Element\Semantics) {
$this->output->startElement($tagName);
// Write elements
foreach ($element->getElements() as $childElement) {
$this->writeElementItem($childElement);
}
// Write annotations
foreach ($element->getAnnotations() as $encoding => $annotation) {
$this->output->startElement('annotation');
$this->output->writeAttribute('encoding', $encoding);
$this->output->text($annotation);
$this->output->endElement();
}
$this->output->endElement();
return;
}
// Element\AbstractGroupElement
if ($element instanceof Element\AbstractGroupElement) {
$this->output->startElement($tagName);
@@ -121,6 +141,9 @@ class MathML implements WriterInterface
if ($element instanceof Element\Operator) {
return 'mo';
}
if ($element instanceof Element\Semantics) {
return 'semantics';
}
throw new NotImplementedException(sprintf(
'%s : The element of the class `%s` has no tag name',

View File

@@ -80,6 +80,35 @@ class MathMLTest extends WriterTestCase
$this->assertIsSchemaMathMLValid($output);
}
public function testWriteSemantics(): void
{
$opTimes = new Element\Operator('&InvisibleTimes;');
$math = new Math();
$semantics = new Element\Semantics();
$semantics->add(new Element\Identifier('y'));
$semantics->addAnnotation('application/x-tex', ' y ');
$math->add($semantics);
$writer = new MathML();
$output = $writer->write($math);
$expected = '<?xml version="1.0" encoding="UTF-8"?>'
. PHP_EOL
. '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">'
. '<math xmlns="http://www.w3.org/1998/Math/MathML">'
. '<semantics>'
. '<mi>y</mi>'
. '<annotation encoding="application/x-tex"> y </annotation>'
. '</semantics>'
. '</math>'
. PHP_EOL;
$this->assertEquals($expected, $output);
$this->assertIsSchemaMathMLValid($output);
}
public function testWriteNotImplemented(): void
{
$this->expectException(NotImplementedException::class);

View File

@@ -8,7 +8,7 @@
],
"homepage": "https://phpoffice.github.io/PHPWord/",
"type": "library",
"license": "LGPL-3.0",
"license": "LGPL-3.0-only",
"authors": [
{
"name": "Mark Baker"
@@ -36,20 +36,67 @@
],
"scripts": {
"test": [
"phpunit --color=always"
"@php vendor/bin/phpunit --color=always"
],
"test-no-coverage": [
"phpunit --color=always --no-coverage"
"@php vendor/bin/phpunit --color=always --no-coverage"
],
"check": [
"php-cs-fixer fix --ansi --dry-run --diff",
"phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n",
"phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php",
"@php vendor/bin/php-cs-fixer fix --ansi --dry-run --diff",
"@php vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php",
"@test-no-coverage",
"phpstan analyse --ansi"
"@php vendor/bin/phpstan analyse --ansi"
],
"fix": [
"php-cs-fixer fix --ansi"
"@php vendor/bin/php-cs-fixer fix --ansi"
],
"samples": [
"php samples/Sample_01_SimpleText.php",
"php samples/Sample_02_TabStops.php",
"php samples/Sample_03_Sections.php",
"php samples/Sample_04_Textrun.php",
"php samples/Sample_05_Multicolumn.php",
"php samples/Sample_06_Footnote.php",
"php samples/Sample_07_TemplateCloneRow.php",
"php samples/Sample_08_ParagraphPagination.php",
"php samples/Sample_09_Tables.php",
"php samples/Sample_10_EastAsianFontStyle.php",
"php samples/Sample_11_ReadWord97.php",
"php samples/Sample_11_ReadWord2007.php",
"php samples/Sample_12_HeaderFooter.php",
"php samples/Sample_13_Images.php",
"php samples/Sample_14_ListItem.php",
"php samples/Sample_15_Link.php",
"php samples/Sample_16_Object.php",
"php samples/Sample_17_TitleTOC.php",
"php samples/Sample_18_Watermark.php",
"php samples/Sample_19_TextBreak.php",
"php samples/Sample_20_BGColor.php",
"php samples/Sample_21_TableRowRules.php",
"php samples/Sample_22_CheckBox.php",
"php samples/Sample_23_TemplateBlock.php",
"php samples/Sample_24_ReadODText.php",
"php samples/Sample_25_TextBox.php",
"php samples/Sample_26_Html.php",
"php samples/Sample_27_Field.php",
"php samples/Sample_28_ReadRTF.php",
"php samples/Sample_29_Line.php",
"php samples/Sample_30_ReadHTML.php",
"php samples/Sample_31_Shape.php",
"php samples/Sample_32_Chart.php",
"php samples/Sample_33_FormField.php",
"php samples/Sample_34_SDT.php",
"php samples/Sample_35_InternalLink.php",
"php samples/Sample_36_RTL.php",
"php samples/Sample_37_Comments.php",
"php samples/Sample_38_Protection.php",
"php samples/Sample_39_TrackChanges.php",
"php samples/Sample_40_TemplateSetComplexValue.php",
"php samples/Sample_41_TemplateSetChart.php",
"php samples/Sample_42_TemplateSetCheckbox.php",
"php samples/Sample_43_RTLDefault.php",
"php samples/Sample_44_ExtractVariablesFromReaderWord2007.php",
"php samples/Sample_45_Autoloader.php"
]
},
"scripts-descriptions": {
@@ -58,34 +105,28 @@
"check": "Runs PHP CheckStyle and PHP Mess detector",
"fix": "Fixes issues found by PHP-CS"
},
"config": {
"platform": {
"php": "8.0"
}
},
"require": {
"php": "^7.1|^8.0",
"ext-dom": "*",
"ext-gd": "*",
"ext-zip": "*",
"ext-json": "*",
"ext-xml": "*",
"phpoffice/math": "^0.2"
"phpoffice/math": "^0.3"
},
"require-dev": {
"ext-zip": "*",
"ext-gd": "*",
"ext-libxml": "*",
"dompdf/dompdf": "^2.0",
"mpdf/mpdf": "^8.1",
"phpmd/phpmd": "^2.13",
"phpunit/phpunit": ">=7.0",
"tecnickcom/tcpdf": "^6.5",
"symfony/process": "^4.4 || ^5.0",
"dompdf/dompdf": "^2.0 || ^3.0",
"friendsofphp/php-cs-fixer": "^3.3",
"phpstan/phpstan-phpunit": "@stable"
"mpdf/mpdf": "^7.0 || ^8.0",
"phpmd/phpmd": "^2.13",
"phpstan/phpstan": "^0.12.88 || ^1.0.0",
"phpstan/phpstan-phpunit": "^1.0 || ^2.0",
"phpunit/phpunit": ">=7.0",
"symfony/process": "^4.4 || ^5.0",
"tecnickcom/tcpdf": "^6.5"
},
"suggest": {
"ext-zip": "Allows writing OOXML and ODF",
"ext-gd2": "Allows adding images",
"ext-xmlwriter": "Allows writing OOXML and ODF",
"ext-xsl": "Allows applying XSL style sheet to headers, to main document part, and to footers of an OOXML template",
"dompdf/dompdf": "Allows writing PDF"

View File

@@ -375,11 +375,6 @@ parameters:
count: 1
path: src/PhpWord/Shared/Drawing.php
-
message: "#^Binary operation \"\\*\" between string and 50 results in an error\\.$#"
count: 1
path: src/PhpWord/Shared/Html.php
-
message: "#^Call to an undefined method DOMNode\\:\\:getAttribute\\(\\)\\.$#"
count: 1
@@ -435,6 +430,11 @@ parameters:
count: 1
path: src/PhpWord/Shared/Html.php
-
message: "#^Method PhpOffice\\\\PhpWord\\\\Shared\\\\Html\\:\\:parseRuby\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpWord/Shared/Html.php
-
message: "#^Method PhpOffice\\\\PhpWord\\\\Shared\\\\Html\\:\\:parseStyleDeclarations\\(\\) has no return type specified\\.$#"
count: 1
@@ -447,7 +447,7 @@ parameters:
-
message: "#^Parameter \\#1 \\$attribute of static method PhpOffice\\\\PhpWord\\\\Shared\\\\Html\\:\\:parseStyle\\(\\) expects DOMAttr, DOMNode given\\.$#"
count: 1
count: 3
path: src/PhpWord/Shared/Html.php
-
@@ -685,11 +685,6 @@ parameters:
count: 1
path: src/PhpWord/Style/Cell.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Cell\\:\\:\\$shading is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Cell.php
-
message: "#^Method PhpOffice\\\\PhpWord\\\\Style\\\\Chart\\:\\:getMajorTickPosition\\(\\) has no return type specified\\.$#"
count: 1
@@ -760,41 +755,6 @@ parameters:
count: 1
path: src/PhpWord/Style/Font.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Font\\:\\:\\$allCaps is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Font.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Font\\:\\:\\$doubleStrikethrough is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Font.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Font\\:\\:\\$lang is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Font.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Font\\:\\:\\$paragraph is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Font.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Font\\:\\:\\$shading is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Font.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Font\\:\\:\\$smallCaps is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Font.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Font\\:\\:\\$strikethrough is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Font.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Line\\:\\:\\$weight \\(int\\) does not accept float\\|int\\|null\\.$#"
count: 1
@@ -815,21 +775,6 @@ parameters:
count: 1
path: src/PhpWord/Style/Paragraph.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Paragraph\\:\\:\\$indentation is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Paragraph.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Paragraph\\:\\:\\$shading is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Paragraph.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Paragraph\\:\\:\\$spacing is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Paragraph.php
-
message: "#^Result of && is always false\\.$#"
count: 1
@@ -840,36 +785,6 @@ parameters:
count: 1
path: src/PhpWord/Style/Section.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Section\\:\\:\\$lineNumbering is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Section.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Shape\\:\\:\\$extrusion is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Shape.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Shape\\:\\:\\$fill is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Shape.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Shape\\:\\:\\$frame is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Shape.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Shape\\:\\:\\$outline is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Shape.php
-
message: "#^Property PhpOffice\\\\PhpWord\\\\Style\\\\Shape\\:\\:\\$shadow is never written, only read\\.$#"
count: 1
path: src/PhpWord/Style/Shape.php
-
message: "#^Method PhpOffice\\\\PhpWord\\\\Style\\\\TOC\\:\\:setTabLeader\\(\\) should return PhpOffice\\\\PhpWord\\\\Style\\\\TOC but returns PhpOffice\\\\PhpWord\\\\Style\\\\Tab\\.$#"
count: 1
@@ -1120,11 +1035,6 @@ parameters:
count: 1
path: src/PhpWord/Writer/AbstractWriter.php
-
message: "#^PHPDoc tag @param has invalid value \\(\\\\PhpOffice\\\\PhpWord\\\\PhpWord\\)\\: Unexpected token \"\\\\n \\*\", expected variable at offset 78$#"
count: 1
path: src/PhpWord/Writer/AbstractWriter.php
-
message: "#^Method PhpOffice\\\\PhpWord\\\\Writer\\\\HTML\\\\Element\\\\AbstractElement\\:\\:write\\(\\) has no return type specified\\.$#"
count: 1
@@ -1146,14 +1056,14 @@ parameters:
path: src/PhpWord/Writer/ODText/Element/Table.php
-
message: "#^Method PhpOffice\\\\PhpWord\\\\Writer\\\\ODText\\\\Element\\\\Text\\:\\:replacetabs\\(\\) has parameter \\$text with no type specified\\.$#"
message: "#^Method PhpOffice\\\\PhpWord\\\\Writer\\\\ODText\\\\Element\\\\AbstractElement\\:\\:replaceTabs\\(\\) has parameter \\$text with no type specified\\.$#"
count: 1
path: src/PhpWord/Writer/ODText/Element/Text.php
path: src/PhpWord/Writer/ODText/Element/AbstractElement.php
-
message: "#^Method PhpOffice\\\\PhpWord\\\\Writer\\\\ODText\\\\Element\\\\Text\\:\\:replacetabs\\(\\) has parameter \\$xmlWriter with no type specified\\.$#"
message: "#^Method PhpOffice\\\\PhpWord\\\\Writer\\\\ODText\\\\Element\\\\AbstractElement\\:\\:replaceTabs\\(\\) has parameter \\$xmlWriter with no type specified\\.$#"
count: 1
path: src/PhpWord/Writer/ODText/Element/Text.php
path: src/PhpWord/Writer/ODText/Element/AbstractElement.php
-
message: "#^Method PhpOffice\\\\PhpWord\\\\Writer\\\\ODText\\\\Element\\\\Text\\:\\:writeChangeInsertion\\(\\) has parameter \\$start with no type specified\\.$#"
@@ -1315,11 +1225,6 @@ parameters:
count: 1
path: src/PhpWord/Writer/RTF/Style/Border.php
-
message: "#^PHPDoc tag @param has invalid value \\(\\\\PhpOffice\\\\PhpWord\\\\PhpWord\\)\\: Unexpected token \"\\\\n \", expected variable at offset 86$#"
count: 1
path: src/PhpWord/Writer/Word2007.php
-
message: "#^Method PhpOffice\\\\PhpWord\\\\Writer\\\\Word2007\\\\Element\\\\AbstractElement\\:\\:write\\(\\) has no return type specified\\.$#"
count: 1
@@ -1426,29 +1331,29 @@ parameters:
path: tests/PhpWordTests/AbstractTestReader.php
-
message: "#^Method PhpOffice\\\\PhpWordTests\\\\AbstractWebServerEmbeddedTest\\:\\:getBaseUrl\\(\\) has no return type specified\\.$#"
message: "#^Method PhpOffice\\\\PhpWordTests\\\\AbstractWebServerEmbedded\\:\\:getBaseUrl\\(\\) has no return type specified\\.$#"
count: 1
path: tests/PhpWordTests/AbstractWebServerEmbeddedTest.php
path: tests/PhpWordTests/AbstractWebServerEmbedded.php
-
message: "#^Method PhpOffice\\\\PhpWordTests\\\\AbstractWebServerEmbeddedTest\\:\\:getRemoteBmpImageUrl\\(\\) has no return type specified\\.$#"
message: "#^Method PhpOffice\\\\PhpWordTests\\\\AbstractWebServerEmbedded\\:\\:getRemoteBmpImageUrl\\(\\) has no return type specified\\.$#"
count: 1
path: tests/PhpWordTests/AbstractWebServerEmbeddedTest.php
path: tests/PhpWordTests/AbstractWebServerEmbedded.php
-
message: "#^Method PhpOffice\\\\PhpWordTests\\\\AbstractWebServerEmbeddedTest\\:\\:getRemoteGifImageUrl\\(\\) has no return type specified\\.$#"
message: "#^Method PhpOffice\\\\PhpWordTests\\\\AbstractWebServerEmbedded\\:\\:getRemoteGifImageUrl\\(\\) has no return type specified\\.$#"
count: 1
path: tests/PhpWordTests/AbstractWebServerEmbeddedTest.php
path: tests/PhpWordTests/AbstractWebServerEmbedded.php
-
message: "#^Method PhpOffice\\\\PhpWordTests\\\\AbstractWebServerEmbeddedTest\\:\\:getRemoteImageUrl\\(\\) has no return type specified\\.$#"
message: "#^Method PhpOffice\\\\PhpWordTests\\\\AbstractWebServerEmbedded\\:\\:getRemoteImageUrl\\(\\) has no return type specified\\.$#"
count: 1
path: tests/PhpWordTests/AbstractWebServerEmbeddedTest.php
path: tests/PhpWordTests/AbstractWebServerEmbedded.php
-
message: "#^Property PhpOffice\\\\PhpWordTests\\\\AbstractWebServerEmbeddedTest\\:\\:\\$httpServer has no type specified\\.$#"
message: "#^Property PhpOffice\\\\PhpWordTests\\\\AbstractWebServerEmbedded\\:\\:\\$httpServer has no type specified\\.$#"
count: 1
path: tests/PhpWordTests/AbstractWebServerEmbeddedTest.php
path: tests/PhpWordTests/AbstractWebServerEmbedded.php
-
message: "#^Parameter \\#1 \\$width of class PhpOffice\\\\PhpWord\\\\Element\\\\Cell constructor expects int\\|null, string given\\.$#"
@@ -1789,6 +1694,11 @@ parameters:
message: "#^Cannot access property \\$length on DOMNodeList\\<DOMNode\\>\\|false\\.$#"
count: 9
path: tests/PhpWordTests/Writer/HTML/ElementTest.php
-
message: "#^Cannot access property \\$length on DOMNodeList\\<DOMNode\\>\\|false\\.$#"
count: 2
path: tests/PhpWordTests/Writer/HTML/Element/RubyTest.php
-
message: "#^Cannot call method item\\(\\) on DOMNodeList\\<DOMNode\\>\\|false\\.$#"

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -23,6 +24,7 @@ use PhpOffice\PhpWord\Element\Chart;
* Charts collection.
*
* @since 0.12.0
*
* @extends AbstractCollection<Chart>
*/
class Charts extends AbstractCollection

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -23,6 +24,7 @@ use PhpOffice\PhpWord\Element\Comment;
* Comments collection.
*
* @since 0.12.0
*
* @extends AbstractCollection<Comment>
*/
class Comments extends AbstractCollection

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -23,6 +24,7 @@ use PhpOffice\PhpWord\Element\Endnote;
* Endnotes collection.
*
* @since 0.10.0
*
* @extends AbstractCollection<Endnote>
*/
class Endnotes extends AbstractCollection

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -23,6 +24,7 @@ use PhpOffice\PhpWord\Element\Footnote;
* Footnotes collection.
*
* @since 0.10.0
*
* @extends AbstractCollection<Footnote>
*/
class Footnotes extends AbstractCollection

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -23,6 +24,7 @@ use PhpOffice\PhpWord\Element\Title;
* Titles collection.
*
* @since 0.10.0
*
* @extends AbstractCollection<Title>
*/
class Titles extends AbstractCollection

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -49,6 +50,7 @@ use ReflectionClass;
* @method FormField addFormField(string $type, mixed $fStyle = null, mixed $pStyle = null)
* @method SDT addSDT(string $type)
* @method Formula addFormula(Math $math)
* @method Ruby addRuby(TextRun $baseText, TextRun $rubyText, \PhpOffice\PhpWord\ComplexType\RubyProperties $properties)
* @method \PhpOffice\PhpWord\Element\OLEObject addObject(string $source, mixed $style = null) deprecated, use addOLEObject instead
*
* @since 0.10.0
@@ -58,7 +60,7 @@ abstract class AbstractContainer extends AbstractElement
/**
* Elements collection.
*
* @var \PhpOffice\PhpWord\Element\AbstractElement[]
* @var AbstractElement[]
*/
protected $elements = [];
@@ -80,7 +82,7 @@ abstract class AbstractContainer extends AbstractElement
* @param mixed $function
* @param mixed $args
*
* @return \PhpOffice\PhpWord\Element\AbstractElement
* @return AbstractElement
*/
public function __call($function, $args)
{
@@ -90,7 +92,7 @@ abstract class AbstractContainer extends AbstractElement
'Footnote', 'Endnote', 'CheckBox', 'TextBox', 'Field',
'Line', 'Shape', 'Title', 'TOC', 'PageBreak',
'Chart', 'FormField', 'SDT', 'Comment',
'Formula',
'Formula', 'Ruby',
];
$functions = [];
foreach ($elements as $element) {
@@ -130,7 +132,7 @@ abstract class AbstractContainer extends AbstractElement
*
* @param string $elementName
*
* @return \PhpOffice\PhpWord\Element\AbstractElement
* @return AbstractElement
*/
protected function addElement($elementName)
{
@@ -149,7 +151,7 @@ abstract class AbstractContainer extends AbstractElement
$elementArgs = $args;
array_shift($elementArgs); // Shift the $elementName off the beginning of array
/** @var \PhpOffice\PhpWord\Element\AbstractElement $element Type hint */
/** @var AbstractElement $element Type hint */
$element = $reflection->newInstanceArgs($elementArgs);
// Set parent container
@@ -165,7 +167,7 @@ abstract class AbstractContainer extends AbstractElement
/**
* Get all elements.
*
* @return \PhpOffice\PhpWord\Element\AbstractElement[]
* @return AbstractElement[]
*/
public function getElements()
{
@@ -177,7 +179,7 @@ abstract class AbstractContainer extends AbstractElement
*
* @param int $index
*
* @return null|\PhpOffice\PhpWord\Element\AbstractElement
* @return null|AbstractElement
*/
public function getElement($index)
{
@@ -191,13 +193,13 @@ abstract class AbstractContainer extends AbstractElement
/**
* Removes the element at requested index.
*
* @param int|\PhpOffice\PhpWord\Element\AbstractElement $toRemove
* @param AbstractElement|int $toRemove
*/
public function removeElement($toRemove): void
{
if (is_int($toRemove) && array_key_exists($toRemove, $this->elements)) {
unset($this->elements[$toRemove]);
} elseif ($toRemove instanceof \PhpOffice\PhpWord\Element\AbstractElement) {
} elseif ($toRemove instanceof AbstractElement) {
foreach ($this->elements as $key => $element) {
if ($element->getElementId() === $toRemove->getElementId()) {
unset($this->elements[$key]);
@@ -253,7 +255,7 @@ abstract class AbstractContainer extends AbstractElement
'Footnote' => ['Section', 'TextRun', 'Cell', 'ListItemRun'],
'Endnote' => ['Section', 'TextRun', 'Cell'],
'PreserveText' => ['Section', 'Header', 'Footer', 'Cell'],
'Title' => ['Section', 'Cell'],
'Title' => ['Section', 'Cell', 'Header'],
'TOC' => ['Section'],
'PageBreak' => ['Section'],
'Chart' => ['Section', 'Cell'],

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -148,8 +149,6 @@ abstract class AbstractElement
/**
* Get PhpWord.
*
* @return ?PhpWord
*/
public function getPhpWord(): ?PhpWord
{
@@ -256,7 +255,7 @@ abstract class AbstractElement
*/
public function setElementId(): void
{
$this->elementId = substr(md5(mt_rand()), 0, 6);
$this->elementId = substr(md5((string) mt_rand()), 0, 6);
}
/**
@@ -291,8 +290,6 @@ abstract class AbstractElement
/**
* Get comments start.
*
* @return Comments
*/
public function getCommentsRangeStart(): ?Comments
{
@@ -301,8 +298,6 @@ abstract class AbstractElement
/**
* Get comment start.
*
* @return Comment
*/
public function getCommentRangeStart(): ?Comment
{
@@ -339,8 +334,6 @@ abstract class AbstractElement
/**
* Get comments end.
*
* @return Comments
*/
public function getCommentsRangeEnd(): ?Comments
{
@@ -349,8 +342,6 @@ abstract class AbstractElement
/**
* Get comment end.
*
* @return Comment
*/
public function getCommentRangeEnd(): ?Comment
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -39,7 +40,7 @@ class Cell extends AbstractContainer
/**
* Cell style.
*
* @var ?\PhpOffice\PhpWord\Style\Cell
* @var ?CellStyle
*/
private $style;
@@ -47,7 +48,7 @@ class Cell extends AbstractContainer
* Create new instance.
*
* @param null|int $width
* @param array|\PhpOffice\PhpWord\Style\Cell $style
* @param array|CellStyle $style
*/
public function __construct($width = null, $style = null)
{
@@ -58,7 +59,7 @@ class Cell extends AbstractContainer
/**
* Get cell style.
*
* @return ?\PhpOffice\PhpWord\Style\Cell
* @return ?CellStyle
*/
public function getStyle()
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -128,16 +129,16 @@ class Field extends AbstractElement
/**
* Font style.
*
* @var \PhpOffice\PhpWord\Style\Font|string
* @var Font|string
*/
protected $fontStyle;
/**
* Set Font style.
*
* @param array|\PhpOffice\PhpWord\Style\Font|string $style
* @param array|Font|string $style
*
* @return \PhpOffice\PhpWord\Style\Font|string
* @return Font|string
*/
public function setFontStyle($style = null)
{
@@ -158,7 +159,7 @@ class Field extends AbstractElement
/**
* Get Font style.
*
* @return \PhpOffice\PhpWord\Style\Font|string
* @return Font|string
*/
public function getFontStyle()
{
@@ -172,7 +173,7 @@ class Field extends AbstractElement
* @param array $properties
* @param array $options
* @param null|string|TextRun $text
* @param array|\PhpOffice\PhpWord\Style\Font|string $fontStyle
* @param array|Font|string $fontStyle
*/
public function __construct($type = null, $properties = [], $options = [], $text = null, $fontStyle = null)
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -29,7 +30,7 @@ class Footnote extends AbstractContainer
/**
* Paragraph style.
*
* @var null|\PhpOffice\PhpWord\Style\Paragraph|string
* @var null|Paragraph|string
*/
protected $paragraphStyle;
@@ -43,7 +44,7 @@ class Footnote extends AbstractContainer
/**
* Create new instance.
*
* @param array|\PhpOffice\PhpWord\Style\Paragraph|string $paragraphStyle
* @param array|Paragraph|string $paragraphStyle
*/
public function __construct($paragraphStyle = null)
{
@@ -54,7 +55,7 @@ class Footnote extends AbstractContainer
/**
* Get paragraph style.
*
* @return null|\PhpOffice\PhpWord\Style\Paragraph|string
* @return null|Paragraph|string
*/
public function getParagraphStyle()
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -28,14 +29,14 @@ class ListItem extends AbstractElement
/**
* Element style.
*
* @var ?\PhpOffice\PhpWord\Style\ListItem
* @var ?ListItemStyle
*/
private $style;
/**
* Text object.
*
* @var \PhpOffice\PhpWord\Element\Text
* @var Text
*/
private $textObject;
@@ -71,7 +72,7 @@ class ListItem extends AbstractElement
/**
* Get style.
*
* @return ?\PhpOffice\PhpWord\Style\ListItem
* @return ?ListItemStyle
*/
public function getStyle()
{
@@ -81,7 +82,7 @@ class ListItem extends AbstractElement
/**
* Get Text object.
*
* @return \PhpOffice\PhpWord\Element\Text
* @return Text
*/
public function getTextObject()
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -32,7 +33,7 @@ class ListItemRun extends TextRun
/**
* ListItem Style.
*
* @var ?\PhpOffice\PhpWord\Style\ListItem
* @var ?ListItemStyle
*/
private $style;
@@ -66,7 +67,7 @@ class ListItemRun extends TextRun
/**
* Get ListItem style.
*
* @return ?\PhpOffice\PhpWord\Style\ListItem
* @return ?ListItemStyle
*/
public function getStyle()
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -35,7 +36,7 @@ class OLEObject extends AbstractElement
/**
* Image Style.
*
* @var ?\PhpOffice\PhpWord\Style\Image
* @var ?ImageStyle
*/
private $style;
@@ -100,7 +101,7 @@ class OLEObject extends AbstractElement
/**
* Get object style.
*
* @return ?\PhpOffice\PhpWord\Style\Image
* @return ?ImageStyle
*/
public function getStyle()
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -36,14 +37,14 @@ class Row extends AbstractElement
/**
* Row style.
*
* @var ?\PhpOffice\PhpWord\Style\Row
* @var ?RowStyle
*/
private $style;
/**
* Row cells.
*
* @var \PhpOffice\PhpWord\Element\Cell[]
* @var Cell[]
*/
private $cells = [];
@@ -65,7 +66,7 @@ class Row extends AbstractElement
* @param int $width
* @param mixed $style
*
* @return \PhpOffice\PhpWord\Element\Cell
* @return Cell
*/
public function addCell($width = null, $style = null)
{
@@ -79,7 +80,7 @@ class Row extends AbstractElement
/**
* Get all cells.
*
* @return \PhpOffice\PhpWord\Element\Cell[]
* @return Cell[]
*/
public function getCells()
{
@@ -89,7 +90,7 @@ class Row extends AbstractElement
/**
* Get row style.
*
* @return ?\PhpOffice\PhpWord\Style\Row
* @return ?RowStyle
*/
public function getStyle()
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -29,14 +30,14 @@ class TOC extends AbstractElement
/**
* TOC style.
*
* @var \PhpOffice\PhpWord\Style\TOC
* @var TOCStyle
*/
private $tocStyle;
/**
* Font style.
*
* @var \PhpOffice\PhpWord\Style\Font|string
* @var Font|string
*/
private $fontStyle;
@@ -94,7 +95,7 @@ class TOC extends AbstractElement
$titles = $this->phpWord->getTitles()->getItems();
foreach ($titles as $i => $title) {
/** @var \PhpOffice\PhpWord\Element\Title $title Type hint */
/** @var Title $title Type hint */
$depth = $title->getDepth();
if ($this->minDepth > $depth) {
unset($titles[$i]);
@@ -110,7 +111,7 @@ class TOC extends AbstractElement
/**
* Get TOC Style.
*
* @return \PhpOffice\PhpWord\Style\TOC
* @return TOCStyle
*/
public function getStyleTOC()
{
@@ -120,7 +121,7 @@ class TOC extends AbstractElement
/**
* Get Font Style.
*
* @return \PhpOffice\PhpWord\Style\Font|string
* @return Font|string
*/
public function getStyleFont()
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -36,14 +37,14 @@ class Text extends AbstractElement
/**
* Text style.
*
* @var \PhpOffice\PhpWord\Style\Font|string
* @var Font|string
*/
protected $fontStyle;
/**
* Paragraph style.
*
* @var \PhpOffice\PhpWord\Style\Paragraph|string
* @var Paragraph|string
*/
protected $paragraphStyle;
@@ -64,10 +65,10 @@ class Text extends AbstractElement
/**
* Set Text style.
*
* @param array|\PhpOffice\PhpWord\Style\Font|string $style
* @param array|\PhpOffice\PhpWord\Style\Paragraph|string $paragraphStyle
* @param array|Font|string $style
* @param array|Paragraph|string $paragraphStyle
*
* @return \PhpOffice\PhpWord\Style\Font|string
* @return Font|string
*/
public function setFontStyle($style = null, $paragraphStyle = null)
{
@@ -90,7 +91,7 @@ class Text extends AbstractElement
/**
* Get Text style.
*
* @return \PhpOffice\PhpWord\Style\Font|string
* @return Font|string
*/
public function getFontStyle()
{
@@ -100,9 +101,9 @@ class Text extends AbstractElement
/**
* Set Paragraph style.
*
* @param array|\PhpOffice\PhpWord\Style\Paragraph|string $style
* @param array|Paragraph|string $style
*
* @return \PhpOffice\PhpWord\Style\Paragraph|string
* @return Paragraph|string
*/
public function setParagraphStyle($style = null)
{
@@ -123,7 +124,7 @@ class Text extends AbstractElement
/**
* Get Paragraph style.
*
* @return \PhpOffice\PhpWord\Style\Paragraph|string
* @return Paragraph|string
*/
public function getParagraphStyle()
{
@@ -146,10 +147,8 @@ class Text extends AbstractElement
/**
* Get Text content.
*
* @return ?string
*/
public function getText()
public function getText(): ?string
{
return $this->text;
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -34,7 +35,7 @@ class TextBox extends AbstractContainer
/**
* TextBox style.
*
* @var ?\PhpOffice\PhpWord\Style\TextBox
* @var ?TextBoxStyle
*/
private $style;
@@ -51,7 +52,7 @@ class TextBox extends AbstractContainer
/**
* Get textbox style.
*
* @return ?\PhpOffice\PhpWord\Style\TextBox
* @return ?TextBoxStyle
*/
public function getStyle()
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -93,14 +94,14 @@ class Settings
/**
* Spelling and Grammatical Checking State.
*
* @var \PhpOffice\PhpWord\ComplexType\ProofState
* @var ProofState
*/
private $proofState;
/**
* Document Editing Restrictions.
*
* @var \PhpOffice\PhpWord\Metadata\Protection
* @var Protection
*/
private $documentProtection;
@@ -266,7 +267,7 @@ class Settings
/**
* Get the Visibility of Annotation Types.
*
* @return \PhpOffice\PhpWord\ComplexType\TrackChangesView
* @return TrackChangesView
*/
public function getRevisionView()
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -33,7 +34,7 @@ class HTML extends AbstractReader implements ReaderInterface
*
* @param string $docFile
*
* @return \PhpOffice\PhpWord\PhpWord
* @return PhpWord
*/
public function load($docFile)
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -33,7 +34,7 @@ class RTF extends AbstractReader implements ReaderInterface
*
* @param string $docFile
*
* @return \PhpOffice\PhpWord\PhpWord
* @return PhpWord
*/
public function load($docFile)
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -42,7 +43,7 @@ class Document
/**
* PhpWord object.
*
* @var \PhpOffice\PhpWord\PhpWord
* @var PhpWord
*/
private $phpWord;

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -39,7 +40,7 @@ class Word2007 extends AbstractReader implements ReaderInterface
*
* @param string $docFile
*
* @return \PhpOffice\PhpWord\PhpWord
* @return PhpWord
*/
public function load($docFile)
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -21,10 +22,13 @@ use DateTime;
use DOMElement;
use InvalidArgumentException;
use PhpOffice\Math\Reader\OfficeMathML;
use PhpOffice\PhpWord\ComplexType\RubyProperties;
use PhpOffice\PhpWord\ComplexType\TblWidth as TblWidthComplexType;
use PhpOffice\PhpWord\Element\AbstractContainer;
use PhpOffice\PhpWord\Element\AbstractElement;
use PhpOffice\PhpWord\Element\FormField;
use PhpOffice\PhpWord\Element\Ruby;
use PhpOffice\PhpWord\Element\Text;
use PhpOffice\PhpWord\Element\TextRun;
use PhpOffice\PhpWord\Element\TrackChange;
use PhpOffice\PhpWord\PhpWord;
@@ -183,7 +187,7 @@ abstract class AbstractPart
/**
* Read w:p.
*
* @param \PhpOffice\PhpWord\Element\AbstractContainer $parent
* @param AbstractContainer $parent
* @param string $docPart
*
* @todo Get font style for preserve text
@@ -296,7 +300,8 @@ abstract class AbstractPart
if ($headingDepth !== null) {
$textContent = null;
$nodes = $xmlReader->getElements('w:r|w:hyperlink', $domNode);
if ($nodes->length === 1) {
$hasRubyElement = $xmlReader->elementExists('w:r/w:ruby', $domNode);
if ($nodes->length === 1 && !$hasRubyElement) {
$textContent = htmlspecialchars($xmlReader->getValue('w:t', $nodes->item(0)), ENT_QUOTES, 'UTF-8');
} else {
$textContent = new TextRun($paragraphStyle);
@@ -450,7 +455,7 @@ abstract class AbstractPart
/**
* Read w:r.
*
* @param \PhpOffice\PhpWord\Element\AbstractContainer $parent
* @param AbstractContainer $parent
* @param string $docPart
* @param mixed $paragraphStyle
*
@@ -584,9 +589,47 @@ abstract class AbstractPart
}
} elseif ($node->nodeName == 'w:softHyphen') {
$element = $parent->addText("\u{200c}", $fontStyle, $paragraphStyle);
} elseif ($node->nodeName == 'w:ruby') {
$rubyPropertiesNode = $xmlReader->getElement('w:rubyPr', $node);
$properties = $this->readRubyProperties($xmlReader, $rubyPropertiesNode);
// read base text node
$baseText = new TextRun($paragraphStyle);
$baseTextNode = $xmlReader->getElement('w:rubyBase/w:r', $node);
$this->readRun($xmlReader, $baseTextNode, $baseText, $docPart, $paragraphStyle);
// read the actual ruby text (e.g. furigana in Japanese)
$rubyText = new TextRun($paragraphStyle);
$rubyTextNode = $xmlReader->getElement('w:rt/w:r', $node);
$this->readRun($xmlReader, $rubyTextNode, $rubyText, $docPart, $paragraphStyle);
// add element to parent
$parent->addRuby($baseText, $rubyText, $properties);
}
}
/**
* Read w:rubyPr element.
*
* @param XMLReader $xmlReader reader for XML
* @param DOMElement $domNode w:RubyPr element
*
* @return RubyProperties ruby properties from element
*/
protected function readRubyProperties(XMLReader $xmlReader, DOMElement $domNode): RubyProperties
{
$rubyAlignment = $xmlReader->getElement('w:rubyAlign', $domNode)->getAttribute('w:val');
$rubyHps = $xmlReader->getElement('w:hps', $domNode)->getAttribute('w:val'); // font face
$rubyHpsRaise = $xmlReader->getElement('w:hpsRaise', $domNode)->getAttribute('w:val'); // pts above base text
$rubyHpsBaseText = $xmlReader->getElement('w:hpsBaseText', $domNode)->getAttribute('w:val'); // base text size
$rubyLid = $xmlReader->getElement('w:lid', $domNode)->getAttribute('w:val'); // type of ruby
$properties = new RubyProperties();
$properties->setAlignment($rubyAlignment);
$properties->setFontFaceSize((float) $rubyHps);
$properties->setFontPointsAboveBaseText((float) $rubyHpsRaise);
$properties->setFontSizeForBaseText((float) $rubyHpsBaseText);
$properties->setLanguageId($rubyLid);
return $properties;
}
/**
* Read w:tbl.
*
@@ -661,8 +704,11 @@ abstract class AbstractPart
'alignment' => [self::READ_VALUE, 'w:jc'],
'basedOn' => [self::READ_VALUE, 'w:basedOn'],
'next' => [self::READ_VALUE, 'w:next'],
'indent' => [self::READ_VALUE, 'w:ind', 'w:left'],
'hanging' => [self::READ_VALUE, 'w:ind', 'w:hanging'],
'indentLeft' => [self::READ_VALUE, 'w:ind', 'w:left'],
'indentRight' => [self::READ_VALUE, 'w:ind', 'w:right'],
'indentHanging' => [self::READ_VALUE, 'w:ind', 'w:hanging'],
'indentFirstLine' => [self::READ_VALUE, 'w:ind', 'w:firstLine'],
'indentFirstLineChars' => [self::READ_VALUE, 'w:ind', 'w:firstLineChars'],
'spaceAfter' => [self::READ_VALUE, 'w:spacing', 'w:after'],
'spaceBefore' => [self::READ_VALUE, 'w:spacing', 'w:before'],
'widowControl' => [self::READ_FALSE, 'w:widowControl'],

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -34,7 +35,7 @@ class Document extends AbstractPart
/**
* PhpWord object.
*
* @var \PhpOffice\PhpWord\PhpWord
* @var PhpWord
*/
private $phpWord;

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -46,6 +47,9 @@ class Styles extends AbstractPart
if (array_key_exists('size', $fontDefaultStyle)) {
$phpWord->setDefaultFontSize($fontDefaultStyle['size']);
}
if (array_key_exists('color', $fontDefaultStyle)) {
$phpWord->setDefaultFontColor($fontDefaultStyle['color']);
}
if (array_key_exists('lang', $fontDefaultStyle)) {
$phpWord->getSettings()->setThemeFontLang(new Language($fontDefaultStyle['lang']));
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -29,7 +30,7 @@ class Settings
*/
public const ZIPARCHIVE = 'ZipArchive';
public const PCLZIP = 'PclZip';
public const OLD_LIB = \PhpOffice\PhpWord\Shared\ZipArchive::class; // @deprecated 0.11
public const OLD_LIB = Shared\ZipArchive::class; // @deprecated 0.11
/**
* PDF rendering libraries.
@@ -117,6 +118,20 @@ class Settings
*/
private static $defaultFontName = self::DEFAULT_FONT_NAME;
/**
* Default asian font name.
*
* @var string
*/
private static $defaultAsianFontName = self::DEFAULT_FONT_NAME;
/**
* Default font color.
*
* @var string
*/
private static $defaultFontColor = self::DEFAULT_FONT_COLOR;
/**
* Default font size.
*
@@ -354,6 +369,14 @@ class Settings
return self::$defaultFontName;
}
/**
* Get default font name.
*/
public static function getDefaultAsianFontName(): string
{
return self::$defaultAsianFontName;
}
/**
* Set default font name.
*/
@@ -368,6 +391,39 @@ class Settings
return false;
}
public static function setDefaultAsianFontName(string $value): bool
{
if (trim($value) !== '') {
self::$defaultAsianFontName = $value;
return true;
}
return false;
}
/**
* Get default font color.
*/
public static function getDefaultFontColor(): string
{
return self::$defaultFontColor;
}
/**
* Set default font color.
*/
public static function setDefaultFontColor(string $value): bool
{
if (trim($value) !== '') {
self::$defaultFontColor = $value;
return true;
}
return false;
}
/**
* Get default font size.
*

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -39,10 +40,6 @@ class Css
{
$cssContent = str_replace(["\r", "\n"], '', $this->cssContent);
preg_match_all('/(.+?)\s?\{\s?(.+?)\s?\}/', $cssContent, $cssExtracted);
// Check the number of extracted
if (count($cssExtracted) != 3) {
return;
}
// Check if there are x selectors and x rules
if (count($cssExtracted[1]) != count($cssExtracted[2])) {
return;

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -17,6 +18,8 @@
namespace PhpOffice\PhpWord\Shared\Microsoft;
use PhpOffice\PhpWord\Exception\Exception;
/**
* Password encoder for microsoft office applications.
*/
@@ -118,8 +121,11 @@ class PasswordEncoder
// Get the single-byte values by iterating through the Unicode characters of the truncated password.
// For each character, if the low byte is not equal to 0, take it. Otherwise, take the high byte.
$passUtf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8');
$byteChars = [];
if (!is_string($passUtf8)) {
throw new Exception('Failed to convert password to UCS-2LE');
}
$byteChars = [];
for ($i = 0; $i < mb_strlen($password); ++$i) {
$byteChars[$i] = ord(substr($passUtf8, $i * 2, 1));

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -17,6 +18,8 @@
namespace PhpOffice\PhpWord\Shared;
use PhpOffice\PhpWord\Exception\Exception;
/**
* Text.
*/
@@ -147,6 +150,9 @@ class Text
if (null !== $value && !self::isUTF8($value)) {
// PHP8.2 : utf8_encode is deprecated, but mb_convert_encoding always usable
$value = (function_exists('mb_convert_encoding')) ? mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1') : utf8_encode($value);
if ($value === false) {
throw new Exception('Unable to convert text to UTF-8');
}
}
return $value;

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -26,7 +27,7 @@ use PhpOffice\PhpWord\Shared\AbstractEnum;
* Since ISO/IEC-29500:2008 the type must not be used for table alignment.
*
* @since 0.13.0
* @see \PhpOffice\PhpWord\SimpleType\JcTable For table alignment modes available since ISO/IEC-29500:2008.
* @see JcTable For table alignment modes available since ISO/IEC-29500:2008.
* @see http://www.datypic.com/sc/ooxml/t-w_ST_Jc.html
*/
final class Jc extends AbstractEnum

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -41,7 +42,7 @@ class Style
* @param string $styleName
* @param AbstractStyle|array $styles
*
* @return \PhpOffice\PhpWord\Style\Paragraph
* @return Paragraph
*/
public static function addParagraphStyle($styleName, $styles)
{
@@ -55,7 +56,7 @@ class Style
* @param AbstractStyle|array $fontStyle
* @param AbstractStyle|array $paragraphStyle
*
* @return \PhpOffice\PhpWord\Style\Font
* @return Font
*/
public static function addFontStyle($styleName, $fontStyle, $paragraphStyle = null)
{
@@ -68,7 +69,7 @@ class Style
* @param string $styleName
* @param AbstractStyle|array $styles
*
* @return \PhpOffice\PhpWord\Style\Font
* @return Font
*/
public static function addLinkStyle($styleName, $styles)
{
@@ -81,7 +82,7 @@ class Style
* @param string $styleName
* @param AbstractStyle|array $styleValues
*
* @return \PhpOffice\PhpWord\Style\Numbering
* @return Numbering
*
* @since 0.10.0
*/
@@ -97,7 +98,7 @@ class Style
* @param AbstractStyle|array $fontStyle
* @param AbstractStyle|array $paragraphStyle
*
* @return \PhpOffice\PhpWord\Style\Font
* @return Font
*/
public static function addTitleStyle($depth, $fontStyle, $paragraphStyle = null)
{
@@ -117,7 +118,7 @@ class Style
* @param array $styleTable
* @param null|array $styleFirstRow
*
* @return \PhpOffice\PhpWord\Style\Table
* @return Table
*/
public static function addTableStyle($styleName, $styleTable, $styleFirstRow = null)
{
@@ -151,7 +152,7 @@ class Style
*
* @param AbstractStyle|array $styles Paragraph style definition
*
* @return \PhpOffice\PhpWord\Style\Paragraph
* @return Paragraph
*/
public static function setDefaultParagraphStyle($styles)
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -134,7 +135,7 @@ abstract class AbstractStyle
/**
* Return style value of child style object, e.g. `left` from `Indentation` child style of `Paragraph`.
*
* @param \PhpOffice\PhpWord\Style\AbstractStyle $substyleObject
* @param AbstractStyle $substyleObject
* @param string $substyleProperty
*
* @return mixed
@@ -316,16 +317,15 @@ abstract class AbstractStyle
* Set object value.
*
* @param mixed $value
* @param string $styleName
* @param mixed &$style
*
* @return mixed
*/
protected function setObjectVal($value, $styleName, &$style)
protected function setObjectVal($value, string $styleName, &$style)
{
$styleClass = substr(static::class, 0, strrpos(static::class, '\\')) . '\\' . $styleName;
$styleClass = substr(static::class, 0, (int) strrpos(static::class, '\\')) . '\\' . $styleName;
if (is_array($value)) {
/** @var \PhpOffice\PhpWord\Style\AbstractStyle $style Type hint */
/** @var AbstractStyle $style Type hint */
if (!$style instanceof $styleClass) {
$style = new $styleClass();
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
@@ -69,10 +70,30 @@ class Cell extends Border
/**
* Vertical align (top, center, both, bottom).
*
* @var string
* @var null|string
*/
private $vAlign;
/**
* @var null|int
*/
private $paddingTop;
/**
* @var null|int
*/
private $paddingBottom;
/**
* @var null|int
*/
private $paddingLeft;
/**
* @var null|int
*/
private $paddingRight;
/**
* Text Direction.
*
@@ -93,14 +114,14 @@ class Cell extends Border
* - restart: Start/restart merged region
* - continue: Continue merged region
*
* @var string
* @var null|string
*/
private $vMerge;
/**
* Shading.
*
* @var \PhpOffice\PhpWord\Style\Shading
* @var Shading
*/
private $shading;
@@ -128,7 +149,7 @@ class Cell extends Border
/**
* Get vertical align.
*
* @return string
* @return null|string
*/
public function getVAlign()
{
@@ -138,12 +159,18 @@ class Cell extends Border
/**
* Set vertical align.
*
* @param string $value
* @param null|string $value
*
* @return self
*/
public function setVAlign($value = null)
{
if ($value === null) {
$this->vAlign = null;
return $this;
}
VerticalJc::validate($value);
$this->vAlign = $this->setEnumVal($value, VerticalJc::values(), $this->vAlign);
@@ -235,7 +262,7 @@ class Cell extends Border
/**
* Get vertical merge (rowspan).
*
* @return string
* @return null|string
*/
public function getVMerge()
{
@@ -245,12 +272,18 @@ class Cell extends Border
/**
* Set vertical merge (rowspan).
*
* @param string $value
* @param null|string $value
*
* @return self
*/
public function setVMerge($value = null)
{
if ($value === null) {
$this->vMerge = null;
return $this;
}
$enum = [self::VMERGE_RESTART, self::VMERGE_CONTINUE];
$this->vMerge = $this->setEnumVal($value, $enum, $this->vMerge);
@@ -260,7 +293,7 @@ class Cell extends Border
/**
* Get shading.
*
* @return \PhpOffice\PhpWord\Style\Shading
* @return Shading
*/
public function getShading()
{
@@ -344,4 +377,84 @@ class Cell extends Border
{
return $this->noWrap;
}
/**
* Get style padding-top.
*/
public function getPaddingTop(): ?int
{
return $this->paddingTop;
}
/**
* Set style padding-top.
*
* @return $this
*/
public function setPaddingTop(int $value): self
{
$this->paddingTop = $value;
return $this;
}
/**
* Get style padding-bottom.
*/
public function getPaddingBottom(): ?int
{
return $this->paddingBottom;
}
/**
* Set style padding-bottom.
*
* @return $this
*/
public function setPaddingBottom(int $value): self
{
$this->paddingBottom = $value;
return $this;
}
/**
* Get style padding-left.
*/
public function getPaddingLeft(): ?int
{
return $this->paddingLeft;
}
/**
* Set style padding-left.
*
* @return $this
*/
public function setPaddingLeft(int $value): self
{
$this->paddingLeft = $value;
return $this;
}
/**
* Get style padding-right.
*/
public function getPaddingRight(): ?int
{
return $this->paddingRight;
}
/**
* Set style padding-right.
*
* @return $this
*/
public function setPaddingRight(int $value): self
{
$this->paddingRight = $value;
return $this;
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

View File

@@ -1,4 +1,5 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.

Some files were not shown because too many files have changed in this diff Show More