Leading backslashes in global function/constant calls were removed.

This commit is contained in:
Roman Syroeshko 2014-04-08 21:56:18 +04:00
parent cdb3a20cb6
commit 191d37b280
33 changed files with 87 additions and 87 deletions

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word Document // New Word Document
echo date('H:i:s') , " Create new PhpWord object" , \EOL; echo date('H:i:s') , " Create new PhpWord object" , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->addFontStyle('rStyle', array('bold' => true, 'italic' => true, 'size' => 16)); $phpWord->addFontStyle('rStyle', array('bold' => true, 'italic' => true, 'size' => 16));
$phpWord->addParagraphStyle('pStyle', array('align' => 'center', 'spaceAfter' => 100)); $phpWord->addParagraphStyle('pStyle', array('align' => 'center', 'spaceAfter' => 100));
@ -48,7 +48,7 @@ $section->addImage('resources/_earth.jpg', array('width'=>18, 'height'=>18));
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word Document // New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , \EOL; echo date('H:i:s') , ' Create new PhpWord object' , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
// Ads styles // Ads styles
@ -36,7 +36,7 @@ $section->addText("\tCenter Aligned", NULL, 'centerTab');
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word Document // New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , \EOL; echo date('H:i:s') , ' Create new PhpWord object' , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
// New portrait section // New portrait section
@ -29,7 +29,7 @@ $section->addFooter()->addText('Footer');
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word Document // New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , \EOL; echo date('H:i:s') , ' Create new PhpWord object' , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
// Ads styles // Ads styles
@ -37,7 +37,7 @@ $textrun->addText(' Here is some more text. ');
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word Document // New Word Document
echo date('H:i:s') , " Create new PhpWord object" , \EOL; echo date('H:i:s') , " Create new PhpWord object" , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
$filler = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' . $filler = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' .
'Nulla fermentum, tortor id adipiscing adipiscing, tortor turpis commodo. ' . 'Nulla fermentum, tortor id adipiscing adipiscing, tortor turpis commodo. ' .
@ -39,7 +39,7 @@ $section->addText('Normal paragraph again.');
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word Document // New Word Document
echo date('H:i:s') , " Create new PhpWord object" , \EOL; echo date('H:i:s') , " Create new PhpWord object" , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
\PhpOffice\PhpWord\Settings::setCompatibility(false); \PhpOffice\PhpWord\Settings::setCompatibility(false);
@ -41,7 +41,7 @@ $footnote->addText('The reference for this is wrapped in its own line');
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s') , " Create new PhpWord object" , \EOL; echo date('H:i:s') , " Create new PhpWord object" , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
$document = $phpWord->loadTemplate('resources/Sample_07_TemplateCloneRow.docx'); $document = $phpWord->loadTemplate('resources/Sample_07_TemplateCloneRow.docx');
@ -56,7 +56,7 @@ $document->setValue('userName#3', 'Ray');
$document->setValue('userPhone#3', '+1 428 889 775'); $document->setValue('userPhone#3', '+1 428 889 775');
$name = 'Sample_07_TemplateCloneRow.docx'; $name = 'Sample_07_TemplateCloneRow.docx';
echo date('H:i:s'), " Write to Word2007 format", \EOL; echo date('H:i:s'), " Write to Word2007 format", EOL;
$document->saveAs($name); $document->saveAs($name);
rename($name, "results/{$name}"); rename($name, "results/{$name}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s') , " Create new PhpWord object" , \EOL; echo date('H:i:s') , " Create new PhpWord object" , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
$phpWord->setDefaultParagraphStyle(array( $phpWord->setDefaultParagraphStyle(array(
'align' => 'both', 'align' => 'both',
@ -49,7 +49,7 @@ $section->addText('Paragraph with pageBreakBefore = true (default: false). ' .
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word Document // New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , \EOL; echo date('H:i:s') , ' Create new PhpWord object' , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection(); $section = $phpWord->addSection();
$header = array('size' => 16, 'bold' => true); $header = array('size' => 16, 'bold' => true);
@ -88,7 +88,7 @@ $table->addCell(null, $cellRowContinue);
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word Document // New Word Document
echo date('H:i:s') , ' Create new PhpWord object' , \EOL; echo date('H:i:s') , ' Create new PhpWord object' , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection(); $section = $phpWord->addSection();
$header = array('size' => 16, 'bold' => true); $header = array('size' => 16, 'bold' => true);
@ -13,7 +13,7 @@ $section->addText('中文楷体样式测试',array('name' => '楷体', 'size' =>
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -4,13 +4,13 @@ include_once 'Sample_Header.php';
// Read contents // Read contents
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$source = "resources/{$name}.docx"; $source = "resources/{$name}.docx";
echo date('H:i:s'), " Reading contents from `{$source}`", \EOL; echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source); $phpWord = \PhpOffice\PhpWord\IOFactory::load($source);
// (Re)write contents // (Re)write contents
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s') , " Create new PhpWord object" , \EOL; echo date('H:i:s') , " Create new PhpWord object" , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
// New portrait section // New portrait section
@ -64,7 +64,7 @@ $section2->addText('Some text...');
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s'), " Create new PhpWord object", \EOL; echo date('H:i:s'), " Create new PhpWord object", EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code // Begin code
@ -24,7 +24,7 @@ $section->addImage($source);
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s'), " Create new PhpWord object", \EOL; echo date('H:i:s'), " Create new PhpWord object", EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code // Begin code
@ -48,7 +48,7 @@ $section->addListItem('List Item 7', 0, 'myOwnStyle', $listStyle, 'P-Style');
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s'), " Create new PhpWord object", \EOL; echo date('H:i:s'), " Create new PhpWord object", EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code // Begin code
@ -22,7 +22,7 @@ $section->addLink('http://www.yahoo.com', null, 'myOwnLinkStyle');
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s'), " Create new PhpWord object", \EOL; echo date('H:i:s'), " Create new PhpWord object", EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code // Begin code
@ -17,7 +17,7 @@ $section->addObject('resources/_sheet.xls');
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s'), " Create new PhpWord object", \EOL; echo date('H:i:s'), " Create new PhpWord object", EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code // Begin code
@ -66,14 +66,14 @@ $section->addText('Text');
$section->addTitle('Subtitle 3.1.2', 3); $section->addTitle('Subtitle 3.1.2', 3);
$section->addText('Text'); $section->addText('Text');
echo date('H:i:s'), " Note: Please refresh TOC manually.", \EOL; echo date('H:i:s'), " Note: Please refresh TOC manually.", EOL;
// End code // End code
// Save file // Save file
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s'), " Create new PhpWord object", \EOL; echo date('H:i:s'), " Create new PhpWord object", EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code // Begin code
@ -18,7 +18,7 @@ $section->addText('The header reference to the current section includes a waterm
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s'), " Create new PhpWord object", \EOL; echo date('H:i:s'), " Create new PhpWord object", EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code // Begin code
@ -31,7 +31,7 @@ $section->addText('Done.');
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s'), " Create new PhpWord object", \EOL; echo date('H:i:s'), " Create new PhpWord object", EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection(); $section = $phpWord->addSection();
@ -14,7 +14,7 @@ $section->addText("Compatible with font colors", array("color"=>"0000ff", "bgCol
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s'), " Create new PhpWord object", \EOL; echo date('H:i:s'), " Create new PhpWord object", EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection(); $section = $phpWord->addSection();
@ -31,7 +31,7 @@ $section->addText("So: $"."table2->addRow(3750, array('exactHeight'=>true));");
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s'), " Create new PhpWord object", \EOL; echo date('H:i:s'), " Create new PhpWord object", EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection(); $section = $phpWord->addSection();
@ -18,7 +18,7 @@ $cell->addCheckBox('chkBox2', 'Checkbox 2');
$name = basename(__FILE__, '.php'); $name = basename(__FILE__, '.php');
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
foreach ($writers as $writer => $extension) { foreach ($writers as $writer => $extension) {
echo date('H:i:s'), " Write to {$writer} format", \EOL; echo date('H:i:s'), " Write to {$writer} format", EOL;
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
$xmlWriter->save("{$name}.{$extension}"); $xmlWriter->save("{$name}.{$extension}");
rename("{$name}.{$extension}", "results/{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}");

View File

@ -2,7 +2,7 @@
include_once 'Sample_Header.php'; include_once 'Sample_Header.php';
// New Word document // New Word document
echo date('H:i:s') , " Create new PhpWord object" , \EOL; echo date('H:i:s') , " Create new PhpWord object" , EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord = new \PhpOffice\PhpWord\PhpWord();
$document = $phpWord->loadTemplate('resources/Sample_23_TemplateBlock.docx'); $document = $phpWord->loadTemplate('resources/Sample_23_TemplateBlock.docx');

View File

@ -89,7 +89,7 @@ class Image extends AbstractElement
if (stripos(strrev($source), strrev('.php')) === 0) { if (stripos(strrev($source), strrev('.php')) === 0) {
$this->isMemImage = true; $this->isMemImage = true;
} else { } else {
$this->isMemImage = (filter_var($source, \FILTER_VALIDATE_URL) !== false); $this->isMemImage = (filter_var($source, FILTER_VALIDATE_URL) !== false);
} }
// Check supported types // Check supported types
@ -105,9 +105,9 @@ class Image extends AbstractElement
} }
} else { } else {
$supportedTypes = array( $supportedTypes = array(
\IMAGETYPE_JPEG, \IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_GIF,
\IMAGETYPE_PNG, \IMAGETYPE_BMP, IMAGETYPE_PNG, IMAGETYPE_BMP,
\IMAGETYPE_TIFF_II, \IMAGETYPE_TIFF_MM IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM
); );
if (!file_exists($source)) { if (!file_exists($source)) {
throw new InvalidImageException(); throw new InvalidImageException();
@ -124,7 +124,7 @@ class Image extends AbstractElement
if (!in_array($this->imageType, $supportedTypes)) { if (!in_array($this->imageType, $supportedTypes)) {
throw new UnsupportedImageTypeException(); throw new UnsupportedImageTypeException();
} }
$this->imageType = \image_type_to_mime_type($this->imageType); $this->imageType = image_type_to_mime_type($this->imageType);
} }
// Set private properties // Set private properties

View File

@ -48,7 +48,7 @@ class Object extends AbstractElement
$supportedTypes = array('xls', 'doc', 'ppt', 'xlsx', 'docx', 'pptx'); $supportedTypes = array('xls', 'doc', 'ppt', 'xlsx', 'docx', 'pptx');
$inf = pathinfo($src); $inf = pathinfo($src);
if (\file_exists($src) && in_array($inf['extension'], $supportedTypes)) { if (file_exists($src) && in_array($inf['extension'], $supportedTypes)) {
$this->source = $src; $this->source = $src;
$this->style = $this->setStyle(new ImageStyle(), $style, true); $this->style = $this->setStyle(new ImageStyle(), $style, true);
return $this; return $this;

View File

@ -52,7 +52,7 @@ class PreserveText extends AbstractElement
$this->fontStyle = $this->setStyle(new Font('text'), $styleFont); $this->fontStyle = $this->setStyle(new Font('text'), $styleFont);
$this->paragraphStyle = $this->setStyle(new Paragraph(), $styleParagraph); $this->paragraphStyle = $this->setStyle(new Paragraph(), $styleParagraph);
$matches = preg_split('/({.*?})/', $text, null, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY); $matches = preg_split('/({.*?})/', $text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
if (isset($matches[0])) { if (isset($matches[0])) {
$this->text = $matches; $this->text = $matches;
} }

View File

@ -100,7 +100,7 @@ class PhpWord
*/ */
public function addSection($settings = null) public function addSection($settings = null)
{ {
$section = new Section(\count($this->sections) + 1, $settings); $section = new Section(count($this->sections) + 1, $settings);
$this->sections[] = $section; $this->sections[] = $section;
return $section; return $section;

View File

@ -101,22 +101,22 @@ class RTF extends AbstractWriter implements WriterInterface
$sRTFContent .= '\deff0'; $sRTFContent .= '\deff0';
// Set the default tab size (720 twips) // Set the default tab size (720 twips)
$sRTFContent .= '\deftab720'; $sRTFContent .= '\deftab720';
$sRTFContent .= \PHP_EOL; $sRTFContent .= PHP_EOL;
// Set the font tbl group // Set the font tbl group
$sRTFContent .= '{\fonttbl'; $sRTFContent .= '{\fonttbl';
foreach ($this->fontTable as $idx => $font) { foreach ($this->fontTable as $idx => $font) {
$sRTFContent .= '{\f' . $idx . '\fnil\fcharset0 ' . $font . ';}'; $sRTFContent .= '{\f' . $idx . '\fnil\fcharset0 ' . $font . ';}';
} }
$sRTFContent .= '}' . \PHP_EOL; $sRTFContent .= '}' . PHP_EOL;
// Set the color tbl group // Set the color tbl group
$sRTFContent .= '{\colortbl '; $sRTFContent .= '{\colortbl ';
foreach ($this->colorTable as $idx => $color) { foreach ($this->colorTable as $idx => $color) {
$arrColor = Drawing::htmlToRGB($color); $arrColor = Drawing::htmlToRGB($color);
$sRTFContent .= ';\red' . $arrColor[0] . '\green' . $arrColor[1] . '\blue' . $arrColor[2] . ''; $sRTFContent .= ';\red' . $arrColor[0] . '\green' . $arrColor[1] . '\blue' . $arrColor[2] . '';
} }
$sRTFContent .= ';}' . \PHP_EOL; $sRTFContent .= ';}' . PHP_EOL;
// Set the generator // Set the generator
$sRTFContent .= '{\*\generator PhpWord;}' . \PHP_EOL; $sRTFContent .= '{\*\generator PhpWord;}' . PHP_EOL;
// Set the view mode of the document // Set the view mode of the document
$sRTFContent .= '\viewkind4'; $sRTFContent .= '\viewkind4';
// Set the numberof bytes that follows a unicode character // Set the numberof bytes that follows a unicode character
@ -131,7 +131,7 @@ class RTF extends AbstractWriter implements WriterInterface
$sRTFContent .= '\kerning1'; $sRTFContent .= '\kerning1';
// Set the font size in half-points // Set the font size in half-points
$sRTFContent .= '\fs' . (PhpWord::DEFAULT_FONT_SIZE * 2); $sRTFContent .= '\fs' . (PhpWord::DEFAULT_FONT_SIZE * 2);
$sRTFContent .= \PHP_EOL; $sRTFContent .= PHP_EOL;
// Body // Body
$sRTFContent .= $this->getDataContent(); $sRTFContent .= $this->getDataContent();
@ -392,7 +392,7 @@ class RTF extends AbstractWriter implements WriterInterface
} }
if (!$withoutP) { if (!$withoutP) {
$sRTFText .= '\par' . \PHP_EOL; $sRTFText .= '\par' . PHP_EOL;
} }
return $sRTFText; return $sRTFText;
} }
@ -407,15 +407,15 @@ class RTF extends AbstractWriter implements WriterInterface
$sRTFText = ''; $sRTFText = '';
$elements = $textrun->getElements(); $elements = $textrun->getElements();
if (count($elements) > 0) { if (count($elements) > 0) {
$sRTFText .= '\pard\nowidctlpar' . \PHP_EOL; $sRTFText .= '\pard\nowidctlpar' . PHP_EOL;
foreach ($elements as $element) { foreach ($elements as $element) {
if ($element instanceof Text) { if ($element instanceof Text) {
$sRTFText .= '{'; $sRTFText .= '{';
$sRTFText .= $this->getDataContentText($element, true); $sRTFText .= $this->getDataContentText($element, true);
$sRTFText .= '}' . \PHP_EOL; $sRTFText .= '}' . PHP_EOL;
} }
} }
$sRTFText .= '\par' . \PHP_EOL; $sRTFText .= '\par' . PHP_EOL;
} }
return $sRTFText; return $sRTFText;
} }
@ -429,7 +429,7 @@ class RTF extends AbstractWriter implements WriterInterface
{ {
$this->lastParagraphStyle = ''; $this->lastParagraphStyle = '';
return '\par' . \PHP_EOL; return '\par' . PHP_EOL;
} }
/** /**
@ -440,9 +440,9 @@ class RTF extends AbstractWriter implements WriterInterface
private function getDataContentUnsupportedElement($element) private function getDataContentUnsupportedElement($element)
{ {
$sRTFText = ''; $sRTFText = '';
$sRTFText .= '\pard\nowidctlpar' . \PHP_EOL; $sRTFText .= '\pard\nowidctlpar' . PHP_EOL;
$sRTFText .= "{$element}"; $sRTFText .= "{$element}";
$sRTFText .= '\par' . \PHP_EOL; $sRTFText .= '\par' . PHP_EOL;
return $sRTFText; return $sRTFText;
} }

View File

@ -26,7 +26,7 @@ class AutoloaderTest extends \PHPUnit_Framework_TestCase
Autoloader::register(); Autoloader::register();
$this->assertContains( $this->assertContains(
array('PhpOffice\\PhpWord\\Autoloader', 'autoload'), array('PhpOffice\\PhpWord\\Autoloader', 'autoload'),
\spl_autoload_functions() spl_autoload_functions()
); );
} }
@ -35,19 +35,19 @@ class AutoloaderTest extends \PHPUnit_Framework_TestCase
*/ */
public function testAutoload() public function testAutoload()
{ {
$declared = \get_declared_classes(); $declared = get_declared_classes();
$declaredCount = \count($declared); $declaredCount = count($declared);
Autoloader::autoload('Foo'); Autoloader::autoload('Foo');
$this->assertEquals( $this->assertEquals(
$declaredCount, $declaredCount,
\count(get_declared_classes()), count(get_declared_classes()),
'PhpOffice\\PhpWord\\Autoloader::autoload() is trying to load ' . 'PhpOffice\\PhpWord\\Autoloader::autoload() is trying to load ' .
'classes outside of the PhpOffice\\PhpWord namespace' 'classes outside of the PhpOffice\\PhpWord namespace'
); );
// TODO change this class to the main PhpWord class when it is namespaced // TODO change this class to the main PhpWord class when it is namespaced
Autoloader::autoload('PhpOffice\\PhpWord\\Exception\\InvalidStyleException'); Autoloader::autoload('PhpOffice\\PhpWord\\Exception\\InvalidStyleException');
$this->assertTrue( $this->assertTrue(
\in_array('PhpOffice\\PhpWord\\Exception\\InvalidStyleException', \get_declared_classes()), in_array('PhpOffice\\PhpWord\\Exception\\InvalidStyleException', get_declared_classes()),
'PhpOffice\\PhpWord\\Autoloader::autoload() failed to autoload the ' . 'PhpOffice\\PhpWord\\Autoloader::autoload() failed to autoload the ' .
'PhpOffice\\PhpWord\\Exception\\InvalidStyleException class' 'PhpOffice\\PhpWord\\Exception\\InvalidStyleException class'
); );

View File

@ -53,7 +53,7 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase
$phpWord = new PhpWord(); $phpWord = new PhpWord();
$this->assertEquals(new Section(1), $phpWord->addSection()); $this->assertEquals(new Section(1), $phpWord->addSection());
$phpWord->addSection(); $phpWord->addSection();
$this->assertEquals(2, \count($phpWord->getSections())); $this->assertEquals(2, count($phpWord->getSections()));
} }
/** /**
@ -144,9 +144,9 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase
*/ */
public function testLoadTemplateException() public function testLoadTemplateException()
{ {
$templateFqfn = \join( $templateFqfn = join(
\DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR,
array(\PHPWORD_TESTS_BASE_DIR, 'PhpWord', 'Tests', '_files', 'templates', 'blanks.docx') array(PHPWORD_TESTS_BASE_DIR, 'PhpWord', 'Tests', '_files', 'templates', 'blanks.docx')
); );
$phpWord = new PhpWord(); $phpWord = new PhpWord();
$phpWord->loadTemplate($templateFqfn); $phpWord->loadTemplate($templateFqfn);

View File

@ -128,9 +128,9 @@ class ODTextTest extends \PHPUnit_Framework_TestCase
public function testSetGetUseDiskCaching() public function testSetGetUseDiskCaching()
{ {
$object = new ODText(); $object = new ODText();
$object->setUseDiskCaching(true, \PHPWORD_TESTS_BASE_DIR); $object->setUseDiskCaching(true, PHPWORD_TESTS_BASE_DIR);
$this->assertTrue($object->getUseDiskCaching()); $this->assertTrue($object->getUseDiskCaching());
$this->assertEquals(\PHPWORD_TESTS_BASE_DIR, $object->getDiskCachingDirectory()); $this->assertEquals(PHPWORD_TESTS_BASE_DIR, $object->getDiskCachingDirectory());
} }
/** /**
@ -140,9 +140,9 @@ class ODTextTest extends \PHPUnit_Framework_TestCase
*/ */
public function testSetUseDiskCachingException() public function testSetUseDiskCachingException()
{ {
$dir = \join( $dir = join(
\DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR,
array(\PHPWORD_TESTS_BASE_DIR, 'foo') array(PHPWORD_TESTS_BASE_DIR, 'foo')
); );
$object = new ODText(); $object = new ODText();

View File

@ -169,7 +169,7 @@ class Word2007Test extends \PHPUnit_Framework_TestCase
$phpWord = new PhpWord(); $phpWord = new PhpWord();
$section = $phpWord->addSection(); $section = $phpWord->addSection();
$object = new Word2007($phpWord); $object = new Word2007($phpWord);
$object->setUseDiskCaching(true, \PHPWORD_TESTS_BASE_DIR); $object->setUseDiskCaching(true, PHPWORD_TESTS_BASE_DIR);
$writer = new Word2007($phpWord); $writer = new Word2007($phpWord);
$writer->save('php://output'); $writer->save('php://output');
@ -183,9 +183,9 @@ class Word2007Test extends \PHPUnit_Framework_TestCase
*/ */
public function testSetUseDiskCachingException() public function testSetUseDiskCachingException()
{ {
$dir = \join( $dir = join(
\DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR,
array(\PHPWORD_TESTS_BASE_DIR, 'foo') array(PHPWORD_TESTS_BASE_DIR, 'foo')
); );
$object = new Word2007(); $object = new Word2007();

View File

@ -16,11 +16,11 @@ if (!defined('PHPWORD_TESTS_BASE_DIR')) {
$vendor = realpath(__DIR__ . '/../vendor'); $vendor = realpath(__DIR__ . '/../vendor');
if (\file_exists($vendor . "/autoload.php")) { if (file_exists($vendor . "/autoload.php")) {
require $vendor . "/autoload.php"; require $vendor . "/autoload.php";
} else { } else {
$vendor = realpath(__DIR__ . '/../../../'); $vendor = realpath(__DIR__ . '/../../../');
if (\file_exists($vendor . "/autoload.php")) { if (file_exists($vendor . "/autoload.php")) {
require $vendor . "/autoload.php"; require $vendor . "/autoload.php";
} else { } else {
throw new Exception("Unable to load dependencies"); throw new Exception("Unable to load dependencies");
@ -35,7 +35,7 @@ spl_autoload_register(function ($class) {
$class = join(DIRECTORY_SEPARATOR, array('PhpWord', 'Tests', '_includes')) . $class = join(DIRECTORY_SEPARATOR, array('PhpWord', 'Tests', '_includes')) .
substr($class, strlen($prefix)); substr($class, strlen($prefix));
$file = __DIR__ . DIRECTORY_SEPARATOR . $class . '.php'; $file = __DIR__ . DIRECTORY_SEPARATOR . $class . '.php';
if (\file_exists($file)) { if (file_exists($file)) {
require_once $file; require_once $file;
} }
} }