diff --git a/README.md b/README.md index 2ee8e766..9b11d116 100755 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ $section->addText('Hello world! I am formatted by a user defined style', 'myOwnStyle'); // You can also put the appended element to local object like this: -$fontStyle = new PhpOffice\PhpWord\Style\Font(); +$fontStyle = new \PhpOffice\PhpWord\Style\Font(); $fontStyle->setBold(true); $fontStyle->setName('Verdana'); $fontStyle->setSize(22); @@ -111,7 +111,7 @@ $myTextElement = $section->addText('Hello World!'); $myTextElement->setFontStyle($fontStyle); // Finally, write the document: -$xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); +$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); $xmlWriter->save('helloWorld.docx'); ``` @@ -125,15 +125,15 @@ You can use PhpWord helper functions to convert inches, centimeters, or points t ```php // Paragraph with 6 points space after $phpWord->addParagraphStyle('My Style', array( - 'spaceAfter' => PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(6)) + 'spaceAfter' => \PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(6)) ); $section = $phpWord->createSection(); $sectionStyle = $section->getSettings(); // half inch left margin -$sectionStyle->setMarginLeft(PhpOffice\PhpWord\Shared\Font::inchSizeToTwips(.5)); +$sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Font::inchSizeToTwips(.5)); // 2 cm right margin -$sectionStyle->setMarginRight(PhpOffice\PhpWord\Shared\Font::centimeterSizeToTwips(2)); +$sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Font::centimeterSizeToTwips(2)); ``` diff --git a/Tests/PhpWord/DocumentPropertiesTest.php b/Tests/PhpWord/DocumentPropertiesTest.php index b8ad9374..f6e6ba3c 100644 --- a/Tests/PhpWord/DocumentPropertiesTest.php +++ b/Tests/PhpWord/DocumentPropertiesTest.php @@ -4,8 +4,7 @@ namespace PhpWord\Tests; use PhpOffice\PhpWord\DocumentProperties; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\DocumentProperties + * @coversDefaultClass \PhpOffice\PhpWord\DocumentProperties * @runTestsInSeparateProcesses */ class DocumentPropertiesTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Exceptions/ExceptionTest.php b/Tests/PhpWord/Exceptions/ExceptionTest.php index 12dcbf48..bea725c9 100644 --- a/Tests/PhpWord/Exceptions/ExceptionTest.php +++ b/Tests/PhpWord/Exceptions/ExceptionTest.php @@ -6,8 +6,8 @@ use PhpOffice\PhpWord\Exceptions\Exception; class ExceptionTest extends \PHPUnit_Framework_TestCase { /** - * @expectedException PhpOffice\PhpWord\Exceptions\Exception - * @covers PhpOffice\PhpWord\Exceptions\Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception + * @covers \PhpOffice\PhpWord\Exceptions\Exception */ public function testThrowException() { diff --git a/Tests/PhpWord/Exceptions/InvalidImageExceptionTest.php b/Tests/PhpWord/Exceptions/InvalidImageExceptionTest.php index e6257fa8..f804d56d 100644 --- a/Tests/PhpWord/Exceptions/InvalidImageExceptionTest.php +++ b/Tests/PhpWord/Exceptions/InvalidImageExceptionTest.php @@ -6,8 +6,8 @@ use PhpOffice\PhpWord\Exceptions\InvalidImageException; class InvalidImageExceptionTest extends \PHPUnit_Framework_TestCase { /** - * @expectedException PhpOffice\PhpWord\Exceptions\InvalidImageException - * @covers PhpOffice\PhpWord\Exceptions\InvalidImageException + * @expectedException \PhpOffice\PhpWord\Exceptions\InvalidImageException + * @covers \PhpOffice\PhpWord\Exceptions\InvalidImageException */ public function testThrowException() { diff --git a/Tests/PhpWord/Exceptions/InvalidStyleExceptionTest.php b/Tests/PhpWord/Exceptions/InvalidStyleExceptionTest.php index 7a0e7741..2572bdf3 100644 --- a/Tests/PhpWord/Exceptions/InvalidStyleExceptionTest.php +++ b/Tests/PhpWord/Exceptions/InvalidStyleExceptionTest.php @@ -6,8 +6,8 @@ use PhpOffice\PhpWord\Exceptions\InvalidStyleException; class InvalidStyleExceptionTest extends \PHPUnit_Framework_TestCase { /** - * @expectedException PhpOffice\PhpWord\Exceptions\InvalidStyleException - * @covers PhpOffice\PhpWord\Exceptions\InvalidStyleException + * @expectedException \PhpOffice\PhpWord\Exceptions\InvalidStyleException + * @covers \PhpOffice\PhpWord\Exceptions\InvalidStyleException */ public function testThrowException() { diff --git a/Tests/PhpWord/Exceptions/UnsupportedImageTypeExceptionTest.php b/Tests/PhpWord/Exceptions/UnsupportedImageTypeExceptionTest.php index d5e93506..7d314fa0 100644 --- a/Tests/PhpWord/Exceptions/UnsupportedImageTypeExceptionTest.php +++ b/Tests/PhpWord/Exceptions/UnsupportedImageTypeExceptionTest.php @@ -6,8 +6,8 @@ use PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException; class UnsupportedImageTypeExceptionTest extends \PHPUnit_Framework_TestCase { /** - * @expectedException PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException - * @covers PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException + * @expectedException \PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException + * @covers \PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException */ public function testThrowException() { diff --git a/Tests/PhpWord/IOFactoryTest.php b/Tests/PhpWord/IOFactoryTest.php index d10bcfeb..db90c470 100644 --- a/Tests/PhpWord/IOFactoryTest.php +++ b/Tests/PhpWord/IOFactoryTest.php @@ -5,8 +5,7 @@ use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\IOFactory; /** - * @@coversDefaultClass PhpOffice\PhpWord\IOFactory - * @package PhpWord\Tests + * @coversDefaultClass \PhpOffice\PhpWord\IOFactory * @runTestsInSeparateProcesses */ final class IOFactoryTest extends \PHPUnit_Framework_TestCase @@ -24,7 +23,7 @@ final class IOFactoryTest extends \PHPUnit_Framework_TestCase /** * @covers ::createWriter - * @expectedException PhpOffice\PhpWord\Exceptions\Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception * @expectedExceptionMessage Could not instantiate "Word2006" class. */ final public function testNonexistentWriterCanNotBeCreated() @@ -45,7 +44,7 @@ final class IOFactoryTest extends \PHPUnit_Framework_TestCase /** * @covers ::createReader - * @expectedException PhpOffice\PhpWord\Exceptions\Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception * @expectedExceptionMessage Could not instantiate "Word2006" class. */ final public function testNonexistentReaderCanNotBeCreated() diff --git a/Tests/PhpWord/MediaTest.php b/Tests/PhpWord/MediaTest.php index 6dd33aa6..179fbc02 100644 --- a/Tests/PhpWord/MediaTest.php +++ b/Tests/PhpWord/MediaTest.php @@ -37,7 +37,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase /** * Todo: add memory image to this test * - * @covers PhpOffice\PhpWord\Media::addSectionMediaElement + * @covers \PhpOffice\PhpWord\Media::addSectionMediaElement */ public function testAddSectionMediaElement() { diff --git a/Tests/PhpWord/Reader/Word2007Test.php b/Tests/PhpWord/Reader/Word2007Test.php index 40219d34..63f771d2 100644 --- a/Tests/PhpWord/Reader/Word2007Test.php +++ b/Tests/PhpWord/Reader/Word2007Test.php @@ -4,14 +4,8 @@ namespace PhpWord\Tests\Reader; use PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\PhpWord\IOFactory; -/** - * @package PhpWord\Tests - */ class Word2007Test extends \PHPUnit_Framework_TestCase { - /** @var Test file directory */ - private $dir; - /** * Init */ @@ -25,27 +19,25 @@ class Word2007Test extends \PHPUnit_Framework_TestCase public function testCanRead() { $dir = join( - DIRECTORY_SEPARATOR, + \DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'documents') ); $object = new Word2007; - $file = $dir . DIRECTORY_SEPARATOR . 'reader.docx'; + $file = $dir . \DIRECTORY_SEPARATOR . 'reader.docx'; $this->assertTrue($object->canRead($file)); } /** - * Test canRead() failure - * - * @expectedException Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception */ public function testCanReadFailed() { $dir = join( - DIRECTORY_SEPARATOR, + \DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'documents') ); $object = new Word2007; - $file = $dir . DIRECTORY_SEPARATOR . 'foo.docx'; + $file = $dir . \DIRECTORY_SEPARATOR . 'foo.docx'; $this->assertFalse($object->canRead($file)); $object = IOFactory::load($file); } @@ -56,10 +48,10 @@ class Word2007Test extends \PHPUnit_Framework_TestCase public function testLoad() { $dir = join( - DIRECTORY_SEPARATOR, + \DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'documents') ); - $file = $dir . DIRECTORY_SEPARATOR . 'reader.docx'; + $file = $dir . \DIRECTORY_SEPARATOR . 'reader.docx'; $object = IOFactory::load($file); $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $object); } diff --git a/Tests/PhpWord/Section/ImageTest.php b/Tests/PhpWord/Section/ImageTest.php index 4067f218..d341a8ed 100644 --- a/Tests/PhpWord/Section/ImageTest.php +++ b/Tests/PhpWord/Section/ImageTest.php @@ -4,7 +4,7 @@ namespace PhpWord\Tests\Section; use PhpOffice\PhpWord\Section\Image; /** - * @coversDefaultClass PhpOffice\PhpWord\Section\Image + * @coversDefaultClass \PhpOffice\PhpWord\Section\Image */ class ImageTest extends \PHPUnit_Framework_TestCase { @@ -32,7 +32,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase $oImage = new Image( $src, array('width' => 210, 'height' => 210, 'align' => 'center', - 'wrappingStyle' => PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_BEHIND) + 'wrappingStyle' => \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_BEHIND) ); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Image', $oImage->getStyle()); @@ -52,7 +52,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException PhpOffice\PhpWord\Exceptions\InvalidImageException + * @expectedException \PhpOffice\PhpWord\Exceptions\InvalidImageException * @covers ::__construct */ public function testImageNotFound() @@ -61,7 +61,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException + * @expectedException \PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException * @covers ::__construct */ public function testInvalidImageTypes() diff --git a/Tests/PhpWord/Section/ListItemTest.php b/Tests/PhpWord/Section/ListItemTest.php index 3b2fff10..ff65bfb8 100644 --- a/Tests/PhpWord/Section/ListItemTest.php +++ b/Tests/PhpWord/Section/ListItemTest.php @@ -18,7 +18,7 @@ class ListItemTest extends \PHPUnit_Framework_TestCase 'text', 1, null, - array('listType' => PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER) + array('listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER) ); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\ListItem', $oListItem->getStyle()); diff --git a/Tests/PhpWord/Section/TextBreakTest.php b/Tests/PhpWord/Section/TextBreakTest.php index 38640381..ceb0ea94 100644 --- a/Tests/PhpWord/Section/TextBreakTest.php +++ b/Tests/PhpWord/Section/TextBreakTest.php @@ -6,8 +6,7 @@ use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Paragraph; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\Section\TextBreak + * @coversDefaultClass \PhpOffice\PhpWord\Section\TextBreak * @runTestsInSeparateProcesses */ class TextBreakTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/SectionTest.php b/Tests/PhpWord/SectionTest.php index dc90f808..55d649e1 100644 --- a/Tests/PhpWord/SectionTest.php +++ b/Tests/PhpWord/SectionTest.php @@ -4,8 +4,7 @@ namespace PhpWord\Tests; use PhpOffice\PhpWord\Section; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\Section + * @coversDefaultClass \PhpOffice\PhpWord\Section * @runTestsInSeparateProcesses */ class SectionTest extends \PHPUnit_Framework_TestCase @@ -75,11 +74,11 @@ class SectionTest extends \PHPUnit_Framework_TestCase public function testAddElements() { $objectSource = join( - DIRECTORY_SEPARATOR, + \DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'documents', 'sheet.xls') ); $imageSource = join( - DIRECTORY_SEPARATOR, + \DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'images', 'PhpWord.png') ); $imageUrl = 'http://php.net//images/logos/php-med-trans-light.gif'; diff --git a/Tests/PhpWord/SettingsTest.php b/Tests/PhpWord/SettingsTest.php index 13f8dd52..bd33cb61 100644 --- a/Tests/PhpWord/SettingsTest.php +++ b/Tests/PhpWord/SettingsTest.php @@ -4,8 +4,7 @@ namespace PhpWord\Tests; use PhpOffice\PhpWord\Settings; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\Settings + * @coversDefaultClass \PhpOffice\PhpWord\Settings * @runTestsInSeparateProcesses */ class SettingsTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Shared/DrawingTest.php b/Tests/PhpWord/Shared/DrawingTest.php index 95dc30f1..5c7001ed 100644 --- a/Tests/PhpWord/Shared/DrawingTest.php +++ b/Tests/PhpWord/Shared/DrawingTest.php @@ -4,7 +4,6 @@ namespace PhpWord\Tests\Shared; use PhpOffice\PhpWord\Shared\Drawing; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class DrawingTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Shared/FileTest.php b/Tests/PhpWord/Shared/FileTest.php index 197a318e..579f2662 100644 --- a/Tests/PhpWord/Shared/FileTest.php +++ b/Tests/PhpWord/Shared/FileTest.php @@ -4,8 +4,7 @@ namespace PhpWord\Tests\Shared; use PhpOffice\PhpWord\Shared\File; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\Shared\File + * @coversDefaultClass \PhpOffice\PhpWord\Shared\File * @runTestsInSeparateProcesses */ class FileTest extends \PHPUnit_Framework_TestCase @@ -15,7 +14,7 @@ class FileTest extends \PHPUnit_Framework_TestCase */ public function testFileExists() { - $dir = join(DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'templates')); + $dir = join(\DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'templates')); chdir($dir); $this->assertTrue(File::file_exists('blank.docx')); } @@ -24,7 +23,7 @@ class FileTest extends \PHPUnit_Framework_TestCase */ public function testNoFileExists() { - $dir = join(DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'templates')); + $dir = join(\DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'templates')); chdir($dir); $this->assertFalse(File::file_exists('404.docx')); } @@ -34,10 +33,10 @@ class FileTest extends \PHPUnit_Framework_TestCase */ public function testRealpath() { - $dir = join(DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'templates')); + $dir = join(\DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'templates')); chdir($dir); $file = 'blank.docx'; - $expected = $dir . DIRECTORY_SEPARATOR . $file; + $expected = $dir . \DIRECTORY_SEPARATOR . $file; $this->assertEquals($expected, File::realpath($file)); } } \ No newline at end of file diff --git a/Tests/PhpWord/Shared/FontTest.php b/Tests/PhpWord/Shared/FontTest.php index 0a662a3f..1ba48310 100644 --- a/Tests/PhpWord/Shared/FontTest.php +++ b/Tests/PhpWord/Shared/FontTest.php @@ -5,7 +5,6 @@ use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Shared\Font; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class FontTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Shared/StringTest.php b/Tests/PhpWord/Shared/StringTest.php index dec719d8..9da8502d 100644 --- a/Tests/PhpWord/Shared/StringTest.php +++ b/Tests/PhpWord/Shared/StringTest.php @@ -4,8 +4,7 @@ namespace PhpWord\Tests\Shared; use PhpOffice\PhpWord\Shared\String; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\Shared\String + * @coversDefaultClass \PhpOffice\PhpWord\Shared\String * @runTestsInSeparateProcesses */ class StringTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Style/CellTest.php b/Tests/PhpWord/Style/CellTest.php index 9da9eefd..ee79ec3b 100644 --- a/Tests/PhpWord/Style/CellTest.php +++ b/Tests/PhpWord/Style/CellTest.php @@ -4,7 +4,6 @@ namespace PhpWord\Tests\Style; use PhpOffice\PhpWord\Style\Cell; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class CellTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Style/FontTest.php b/Tests/PhpWord/Style/FontTest.php index 105c46d7..5bef23b1 100644 --- a/Tests/PhpWord/Style/FontTest.php +++ b/Tests/PhpWord/Style/FontTest.php @@ -6,7 +6,6 @@ use PhpOffice\PhpWord\Style\Font; use PhpWord\Tests\TestHelperDOCX; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class FontTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Style/ImageTest.php b/Tests/PhpWord/Style/ImageTest.php index c06bba2e..3b8cd96f 100644 --- a/Tests/PhpWord/Style/ImageTest.php +++ b/Tests/PhpWord/Style/ImageTest.php @@ -4,7 +4,6 @@ namespace PhpWord\Tests\Style; use PhpOffice\PhpWord\Style\Image; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class ImageTest extends \PHPUnit_Framework_TestCase @@ -56,7 +55,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase /** * Test setWrappingStyle exception * - * @expectedException InvalidArgumentException + * @expectedException \InvalidArgumentException */ public function testSetWrappingStyleException() { diff --git a/Tests/PhpWord/Style/ListItemTest.php b/Tests/PhpWord/Style/ListItemTest.php index 6383fde8..5c7a3332 100644 --- a/Tests/PhpWord/Style/ListItemTest.php +++ b/Tests/PhpWord/Style/ListItemTest.php @@ -4,7 +4,6 @@ namespace PhpWord\Tests\Style; use PhpOffice\PhpWord\Style\ListItem; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class ListItemTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Style/ParagraphTest.php b/Tests/PhpWord/Style/ParagraphTest.php index 37d87263..05eabbb3 100644 --- a/Tests/PhpWord/Style/ParagraphTest.php +++ b/Tests/PhpWord/Style/ParagraphTest.php @@ -7,7 +7,6 @@ use PhpOffice\PhpWord\Style\Tab; use PhpWord\Tests\TestHelperDOCX; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class ParagraphTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Style/RowTest.php b/Tests/PhpWord/Style/RowTest.php index ca5f6a63..b83f2e5f 100644 --- a/Tests/PhpWord/Style/RowTest.php +++ b/Tests/PhpWord/Style/RowTest.php @@ -4,7 +4,6 @@ namespace PhpWord\Tests\Style; use PhpOffice\PhpWord\Style\Row; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class RowTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Style/TOCTest.php b/Tests/PhpWord/Style/TOCTest.php index 68650ddb..6f252073 100644 --- a/Tests/PhpWord/Style/TOCTest.php +++ b/Tests/PhpWord/Style/TOCTest.php @@ -4,8 +4,7 @@ namespace PhpWord\Tests\Style; use PhpOffice\PhpWord\Style\TOC; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\Style\TOC + * @coversDefaultClass \PhpOffice\PhpWord\Style\TOC * @runTestsInSeparateProcesses */ class TOCTest extends \PHPUnit_Framework_TestCase @@ -18,9 +17,9 @@ class TOCTest extends \PHPUnit_Framework_TestCase $object = new TOC(); $properties = array( - 'tabPos' => 9062, + 'tabPos' => 9062, 'tabLeader' => TOC::TABLEADER_DOT, - 'indent' => 200, + 'indent' => 200, ); foreach ($properties as $key => $value) { // set/get diff --git a/Tests/PhpWord/Style/TableFullTest.php b/Tests/PhpWord/Style/TableFullTest.php index 8ea594ff..e84191e0 100644 --- a/Tests/PhpWord/Style/TableFullTest.php +++ b/Tests/PhpWord/Style/TableFullTest.php @@ -4,7 +4,6 @@ namespace PhpWord\Tests\Style; use PhpOffice\PhpWord\Style\TableFull; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class TableFullTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Style/TableTest.php b/Tests/PhpWord/Style/TableTest.php index 0837b853..c9ea7301 100644 --- a/Tests/PhpWord/Style/TableTest.php +++ b/Tests/PhpWord/Style/TableTest.php @@ -4,7 +4,6 @@ namespace PhpWord\Tests\Style; use PhpOffice\PhpWord\Style\Table; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class TableTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Style/TabsTest.php b/Tests/PhpWord/Style/TabsTest.php index 3bfb138e..dcecdf93 100644 --- a/Tests/PhpWord/Style/TabsTest.php +++ b/Tests/PhpWord/Style/TabsTest.php @@ -6,7 +6,6 @@ use PhpOffice\PhpWord\Style\Tab; use PhpWord\Tests\TestHelperDOCX; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class TabsTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/StyleTest.php b/Tests/PhpWord/StyleTest.php index 226387d0..bd24188f 100644 --- a/Tests/PhpWord/StyleTest.php +++ b/Tests/PhpWord/StyleTest.php @@ -4,8 +4,7 @@ namespace PhpWord\Tests; use PhpOffice\PhpWord\Style; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\Style + * @coversDefaultClass \PhpOffice\PhpWord\Style * @runTestsInSeparateProcesses */ class StyleTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/TOCTest.php b/Tests/PhpWord/TOCTest.php index d519cdf1..7007e03b 100644 --- a/Tests/PhpWord/TOCTest.php +++ b/Tests/PhpWord/TOCTest.php @@ -4,8 +4,7 @@ namespace PhpWord\Tests; use PhpOffice\PhpWord\TOC; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\TOC + * @coversDefaultClass \PhpOffice\PhpWord\TOC * @runTestsInSeparateProcesses */ class TOCTest extends \PHPUnit_Framework_TestCase @@ -18,14 +17,11 @@ class TOCTest extends \PHPUnit_Framework_TestCase public function testConstruct() { $expected = array( - 'tabPos' => 9062, - 'tabLeader' => PhpOffice\PhpWord\Style\TOC::TABLEADER_DOT, - 'indent' => 200, - ); - $object = new TOC( - array('size' => 11), - array('tabPos' => $expected['tabPos']) + 'tabPos' => 9062, + 'tabLeader' => \PhpOffice\PhpWord\Style\TOC::TABLEADER_DOT, + 'indent' => 200, ); + $object = new TOC(array('size' => 11), array('tabPos' => $expected['tabPos'])); $tocStyle = $object->getStyleTOC(); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\TOC', $tocStyle); diff --git a/Tests/PhpWord/TemplateTest.php b/Tests/PhpWord/TemplateTest.php index d15185ec..ebb0c665 100644 --- a/Tests/PhpWord/TemplateTest.php +++ b/Tests/PhpWord/TemplateTest.php @@ -5,7 +5,7 @@ use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Template; /** - * @coversDefaultClass PhpOffice\PhpWord\Template + * @coversDefaultClass \PhpOffice\PhpWord\Template */ final class TemplateTest extends \PHPUnit_Framework_TestCase { @@ -87,7 +87,7 @@ final class TemplateTest extends \PHPUnit_Framework_TestCase /** * @covers ::applyXslStyleSheet - * @expectedException Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception * @expectedExceptionMessage Could not set values for the given XSL style sheet parameters. * @test */ @@ -109,7 +109,7 @@ final class TemplateTest extends \PHPUnit_Framework_TestCase ); /* - * We have to use error control below, because XSLTProcessor::setParameter omits warning on failure. + * We have to use error control below, because \XSLTProcessor::setParameter omits warning on failure. * This warning fails the test. */ @$template->applyXslStyleSheet($xslDOMDocument, array(1 => 'somevalue')); @@ -117,7 +117,7 @@ final class TemplateTest extends \PHPUnit_Framework_TestCase /** * @covers ::applyXslStyleSheet - * @expectedException Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception * @expectedExceptionMessage Could not load XML from the given template. * @test */ @@ -139,7 +139,7 @@ final class TemplateTest extends \PHPUnit_Framework_TestCase ); /* - * We have to use error control below, because DOMDocument::loadXML omits warning on failure. + * We have to use error control below, because \DOMDocument::loadXML omits warning on failure. * This warning fails the test. */ @$template->applyXslStyleSheet($xslDOMDocument); diff --git a/Tests/PhpWord/Writer/ODText/ContentTest.php b/Tests/PhpWord/Writer/ODText/ContentTest.php index ce3a7b3b..64f224ca 100644 --- a/Tests/PhpWord/Writer/ODText/ContentTest.php +++ b/Tests/PhpWord/Writer/ODText/ContentTest.php @@ -5,8 +5,7 @@ use PhpOffice\PhpWord\PhpWord; use PhpWord\Tests\TestHelperDOCX; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\Writer\ODText\Content + * @coversDefaultClass \PhpOffice\PhpWord\Writer\ODText\Content * @runTestsInSeparateProcesses */ class ContentTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Writer/ODTextTest.php b/Tests/PhpWord/Writer/ODTextTest.php index 0338f4e0..631360d8 100644 --- a/Tests/PhpWord/Writer/ODTextTest.php +++ b/Tests/PhpWord/Writer/ODTextTest.php @@ -5,8 +5,7 @@ use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Writer\ODText; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\Writer\ODText + * @coversDefaultClass \PhpOffice\PhpWord\Writer\ODText * @runTestsInSeparateProcesses */ class ODTextTest extends \PHPUnit_Framework_TestCase @@ -36,7 +35,7 @@ class ODTextTest extends \PHPUnit_Framework_TestCase /** * @covers ::getPhpWord - * @expectedException Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception * @expectedExceptionMessage No PhpWord assigned. */ public function testConstructWithNull() @@ -104,7 +103,7 @@ class ODTextTest extends \PHPUnit_Framework_TestCase /** * @covers ::save - * @expectedException Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception * @expectedExceptionMessage PhpWord object unassigned. */ public function testSaveException() @@ -136,7 +135,7 @@ class ODTextTest extends \PHPUnit_Framework_TestCase /** * @covers ::setUseDiskCaching - * @expectedException Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception */ public function testSetUseDiskCachingException() { diff --git a/Tests/PhpWord/Writer/RTFTest.php b/Tests/PhpWord/Writer/RTFTest.php index 3b6cb723..656f6d47 100644 --- a/Tests/PhpWord/Writer/RTFTest.php +++ b/Tests/PhpWord/Writer/RTFTest.php @@ -5,8 +5,7 @@ use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Writer\RTF; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\Writer\RTF + * @coversDefaultClass \PhpOffice\PhpWord\Writer\RTF * @runTestsInSeparateProcesses */ class RTFTest extends \PHPUnit_Framework_TestCase @@ -24,7 +23,7 @@ class RTFTest extends \PHPUnit_Framework_TestCase /** * covers ::__construct - * @expectedException Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception * @expectedExceptionMessage No PhpWord assigned. */ public function testConstructWithNull() @@ -48,7 +47,7 @@ class RTFTest extends \PHPUnit_Framework_TestCase /** * @covers ::save - * @expectedException Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception * @expectedExceptionMessage PhpWord object unassigned. */ public function testSaveException() diff --git a/Tests/PhpWord/Writer/Word2007/BaseTest.php b/Tests/PhpWord/Writer/Word2007/BaseTest.php index 1d00e06e..ea44e9f1 100644 --- a/Tests/PhpWord/Writer/Word2007/BaseTest.php +++ b/Tests/PhpWord/Writer/Word2007/BaseTest.php @@ -5,8 +5,7 @@ use PhpOffice\PhpWord\PhpWord; use PhpWord\Tests\TestHelperDOCX; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\Writer\Word2007\Base + * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Base * @runTestsInSeparateProcesses */ class BaseTest extends \PHPUnit_Framework_TestCase @@ -48,7 +47,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase $pStyle = 'pStyle'; $aStyle = array('align' => 'justify', 'spaceBefore' => 120, 'spaceAfter' => 120); $imageSrc = join( - DIRECTORY_SEPARATOR, + \DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'images', 'earth.jpg') ); @@ -321,7 +320,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase public function testWriteWatermark() { $imageSrc = join( - DIRECTORY_SEPARATOR, + \DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'images', 'earth.jpg') ); diff --git a/Tests/PhpWord/Writer/Word2007/DocumentTest.php b/Tests/PhpWord/Writer/Word2007/DocumentTest.php index 056e7b55..e3eb8470 100644 --- a/Tests/PhpWord/Writer/Word2007/DocumentTest.php +++ b/Tests/PhpWord/Writer/Word2007/DocumentTest.php @@ -5,7 +5,6 @@ use PhpOffice\PhpWord\PhpWord; use PhpWord\Tests\TestHelperDOCX; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class DocumentTest extends \PHPUnit_Framework_TestCase @@ -40,7 +39,7 @@ class DocumentTest extends \PHPUnit_Framework_TestCase public function testElements() { $objectSrc = join( - DIRECTORY_SEPARATOR, + \DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'documents', 'sheet.xls') ); diff --git a/Tests/PhpWord/Writer/Word2007/FootnotesTest.php b/Tests/PhpWord/Writer/Word2007/FootnotesTest.php index fe419986..3913ff2c 100644 --- a/Tests/PhpWord/Writer/Word2007/FootnotesTest.php +++ b/Tests/PhpWord/Writer/Word2007/FootnotesTest.php @@ -5,7 +5,6 @@ use PhpOffice\PhpWord\PhpWord; use PhpWord\Tests\TestHelperDOCX; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class FootnotesTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Writer/Word2007/StylesTest.php b/Tests/PhpWord/Writer/Word2007/StylesTest.php index cbebb19a..5de21c7d 100644 --- a/Tests/PhpWord/Writer/Word2007/StylesTest.php +++ b/Tests/PhpWord/Writer/Word2007/StylesTest.php @@ -5,7 +5,6 @@ use PhpOffice\PhpWord\PhpWord; use PhpWord\Tests\TestHelperDOCX; /** - * @package PhpWord\Tests * @runTestsInSeparateProcesses */ class StylesTest extends \PHPUnit_Framework_TestCase diff --git a/Tests/PhpWord/Writer/Word2007Test.php b/Tests/PhpWord/Writer/Word2007Test.php index a4365e4d..9bdf74a2 100644 --- a/Tests/PhpWord/Writer/Word2007Test.php +++ b/Tests/PhpWord/Writer/Word2007Test.php @@ -6,8 +6,7 @@ use PhpOffice\PhpWord\Writer\Word2007; use PhpWord\Tests\TestHelperDOCX; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord\Writer\Word2007 + * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007 * @runTestsInSeparateProcesses */ class Word2007Test extends \PHPUnit_Framework_TestCase @@ -118,7 +117,7 @@ class Word2007Test extends \PHPUnit_Framework_TestCase /** * @covers ::setUseDiskCaching - * @expectedException Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception */ public function testSetUseDiskCachingException() { diff --git a/Tests/PhpWordTest.php b/Tests/PhpWordTest.php index 73841bd7..cc51755f 100644 --- a/Tests/PhpWordTest.php +++ b/Tests/PhpWordTest.php @@ -7,8 +7,7 @@ use PhpOffice\PhpWord\Section; use PhpOffice\PhpWord\Style; /** - * @package PhpWord\Tests - * @coversDefaultClass PhpOffice\PhpWord + * @coversDefaultClass \PhpOffice\PhpWord\PhpWord * @runTestsInSeparateProcesses */ class PhpWordTest extends \PHPUnit_Framework_TestCase @@ -144,7 +143,7 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase /** * @covers ::loadTemplate - * @expectedException PhpOffice\PhpWord\Exceptions\Exception + * @expectedException \PhpOffice\PhpWord\Exceptions\Exception */ public function testLoadTemplateException() { diff --git a/Tests/_inc/TestHelperDOCX.php b/Tests/_inc/TestHelperDOCX.php index 0e63dcf8..bd3d4f8c 100644 --- a/Tests/_inc/TestHelperDOCX.php +++ b/Tests/_inc/TestHelperDOCX.php @@ -10,8 +10,8 @@ class TestHelperDOCX static protected $file; /** - * @param PhpOffice\PhpWord $phpWord - * @return PhpWord\Tests\XmlDocument + * @param \PhpOffice\PhpWord\PhpWord $phpWord + * @return \PhpWord\Tests\XmlDocument */ public static function getDocument(PhpWord $phpWord, $writerName = 'Word2007') { diff --git a/Tests/_inc/XmlDocument.php b/Tests/_inc/XmlDocument.php index 3a6c182d..c6b1e83e 100644 --- a/Tests/_inc/XmlDocument.php +++ b/Tests/_inc/XmlDocument.php @@ -1,8 +1,6 @@ file = $file; $file = $this->path . '/' . $file; - $this->dom = new DOMDocument(); + $this->dom = new \DOMDocument(); $this->dom->load($file); return $this->dom; } @@ -112,4 +110,4 @@ class XmlDocument $nodeList = $this->getNodeList($path, $file); return !($nodeList->length == 0); } -} +} \ No newline at end of file diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php index c986ffcb..dd261c3b 100755 --- a/Tests/bootstrap.php +++ b/Tests/bootstrap.php @@ -8,7 +8,7 @@ if (!\defined('PHPWORD_TESTS_BASE_DIR')) { // loading classes with PSR-4 autoloader require_once __DIR__ . '/../src/Autoloader.php'; -PhpOffice\PhpWord\Autoloader::register(); +\PhpOffice\PhpWord\Autoloader::register(); require_once __DIR__ . '/_inc/TestHelperDOCX.php'; require_once __DIR__ . '/_inc/XmlDocument.php'; \ No newline at end of file diff --git a/samples/Sample_01_SimpleText.php b/samples/Sample_01_SimpleText.php index bdb163ba..a2fe9e9b 100755 --- a/samples/Sample_01_SimpleText.php +++ b/samples/Sample_01_SimpleText.php @@ -1,12 +1,12 @@ '); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word Document -echo date('H:i:s') , " Create new PhpWord object" , EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s') , " Create new PhpWord object" , \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->addFontStyle('rStyle', array('bold' => true, 'italic' => true, 'size' => 16)); $phpWord->addParagraphStyle('pStyle', array('align' => 'center', 'spaceAfter' => 100)); $phpWord->addTitleStyle(1, array('bold' => true), array('spaceAfter' => 240)); @@ -51,12 +51,12 @@ $section->addImage('resources/_earth.jpg', array('width'=>18, 'height'=>18)); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; \ No newline at end of file +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; \ No newline at end of file diff --git a/samples/Sample_02_TabStops.php b/samples/Sample_02_TabStops.php index 1026cc09..24f47678 100755 --- a/samples/Sample_02_TabStops.php +++ b/samples/Sample_02_TabStops.php @@ -1,29 +1,29 @@ '); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word Document -echo date('H:i:s') , ' Create new PhpWord object' , EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s') , ' Create new PhpWord object' , \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); // Ads styles $phpWord->addParagraphStyle('multipleTab', array( 'tabs' => array( - new PhpOffice\PhpWord\Style\Tab('left', 1550), - new PhpOffice\PhpWord\Style\Tab('center', 3200), - new PhpOffice\PhpWord\Style\Tab('right', 5300) + new \PhpOffice\PhpWord\Style\Tab('left', 1550), + new \PhpOffice\PhpWord\Style\Tab('center', 3200), + new \PhpOffice\PhpWord\Style\Tab('right', 5300) ) )); $phpWord->addParagraphStyle('rightTab', array( 'tabs' => array( - new PhpOffice\PhpWord\Style\Tab('right', 9090) + new \PhpOffice\PhpWord\Style\Tab('right', 9090) ) )); $phpWord->addParagraphStyle('centerTab', array( 'tabs' => array( - new PhpOffice\PhpWord\Style\Tab('center', 4680) + new \PhpOffice\PhpWord\Style\Tab('center', 4680) ) )); @@ -39,12 +39,12 @@ $section->addText("\tCenter Aligned", NULL, 'centerTab'); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_03_Sections.php b/samples/Sample_03_Sections.php index 4d269454..e3c1057c 100755 --- a/samples/Sample_03_Sections.php +++ b/samples/Sample_03_Sections.php @@ -1,12 +1,12 @@ '); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word Document -echo date('H:i:s') , ' Create new PhpWord object' , EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s') , ' Create new PhpWord object' , \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); // New portrait section $section = $phpWord->createSection(array('borderColor' => '00FF00', 'borderSize' => 12)); @@ -32,12 +32,12 @@ $section->createFooter()->addText('Footer'); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_04_Textrun.php b/samples/Sample_04_Textrun.php index ac0d274a..0d984dfe 100644 --- a/samples/Sample_04_Textrun.php +++ b/samples/Sample_04_Textrun.php @@ -1,18 +1,18 @@ '); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word Document -echo date('H:i:s') , ' Create new PhpWord object' , EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s') , ' Create new PhpWord object' , \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); // Ads styles $phpWord->addParagraphStyle('pStyle', array('spacing'=>100)); $phpWord->addFontStyle('BoldText', array('bold'=>true)); $phpWord->addFontStyle('ColoredText', array('color'=>'FF8080')); -$phpWord->addLinkStyle('NLink', array('color'=>'0000FF', 'underline' => PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)); +$phpWord->addLinkStyle('NLink', array('color'=>'0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)); // New portrait section $section = $phpWord->createSection(); @@ -38,12 +38,12 @@ $textrun->addText(' Here is some more text. '); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_05_Multicolumn.php b/samples/Sample_05_Multicolumn.php index 3148177c..2b630d27 100644 --- a/samples/Sample_05_Multicolumn.php +++ b/samples/Sample_05_Multicolumn.php @@ -1,12 +1,12 @@ '); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word Document -echo date('H:i:s') , " Create new PhpWord object" , EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s') , " Create new PhpWord object" , \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); $filler = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' . 'Nulla fermentum, tortor id adipiscing adipiscing, tortor turpis commodo. ' . 'Donec vulputate iaculis metus, vel luctus dolor hendrerit ac. ' . @@ -42,12 +42,12 @@ $section->addText('Normal paragraph again.'); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_06_Footnote.php b/samples/Sample_06_Footnote.php index b6d8aba4..fd495afb 100755 --- a/samples/Sample_06_Footnote.php +++ b/samples/Sample_06_Footnote.php @@ -1,12 +1,12 @@ '); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word Document -echo date('H:i:s') , " Create new PhpWord object" , EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s') , " Create new PhpWord object" , \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); // New portrait section $section = $phpWord->createSection(); @@ -15,7 +15,7 @@ $section = $phpWord->createSection(); $phpWord->addParagraphStyle('pStyle', array('spacing'=>100)); $phpWord->addFontStyle('BoldText', array('bold'=>true)); $phpWord->addFontStyle('ColoredText', array('color'=>'FF8080')); -$phpWord->addLinkStyle('NLink', array('color'=>'0000FF', 'underline' => PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)); +$phpWord->addLinkStyle('NLink', array('color'=>'0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)); // Add text elements $textrun = $section->createTextRun('pStyle'); @@ -40,12 +40,12 @@ $footnote->addText('The reference for this is wrapped in its own line'); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_07_TemplateCloneRow.php b/samples/Sample_07_TemplateCloneRow.php index bbe94a0f..3dc92a06 100755 --- a/samples/Sample_07_TemplateCloneRow.php +++ b/samples/Sample_07_TemplateCloneRow.php @@ -1,12 +1,12 @@ '); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word document -echo date('H:i:s') , " Create new PhpWord object" , EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s') , " Create new PhpWord object" , \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); $document = $phpWord->loadTemplate('resources/Sample_07_TemplateCloneRow.docx'); @@ -57,10 +57,10 @@ $document->setValue('userName#3', 'Ray'); $document->setValue('userPhone#3', '+1 428 889 775'); $name = 'Sample_07_TemplateCloneRow_result.docx'; -echo date('H:i:s'), " Write to Word2007 format", EOL; +echo date('H:i:s'), " Write to Word2007 format", \EOL; $document->saveAs($name); rename($name, "results/{$name}"); // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_08_ParagraphPagination.php b/samples/Sample_08_ParagraphPagination.php index 588370f6..e0d646cd 100644 --- a/samples/Sample_08_ParagraphPagination.php +++ b/samples/Sample_08_ParagraphPagination.php @@ -1,15 +1,15 @@ '); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word document -echo date('H:i:s') , " Create new PhpWord object" , EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s') , " Create new PhpWord object" , \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->setDefaultParagraphStyle(array( 'align' => 'both', - 'spaceAfter' => PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(12), + 'spaceAfter' => \PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(12), 'spacing' => 120, )); @@ -52,12 +52,12 @@ $section->addText('Paragraph with pageBreakBefore = true (default: false). ' . $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_09_Tables.php b/samples/Sample_09_Tables.php index a184be5a..a43b98d8 100644 --- a/samples/Sample_09_Tables.php +++ b/samples/Sample_09_Tables.php @@ -1,12 +1,12 @@ '); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word Document -echo date('H:i:s') , ' Create new PhpWord object' , EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s') , ' Create new PhpWord object' , \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->createSection(); $header = array('size' => 16, 'bold' => true); @@ -32,7 +32,7 @@ $section->addText("Fancy table", $header); $styleTable = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80); $styleFirstRow = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF'); $styleCell = array('valign' => 'center'); -$styleCellBTLR = array('valign' => 'center', 'textDirection' => PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR); +$styleCellBTLR = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR); $fontStyle = array('bold' => true, 'align' => 'center'); $phpWord->addTableStyle('Fancy Table', $styleTable, $styleFirstRow); $table = $section->addTable('Fancy Table'); @@ -80,12 +80,12 @@ $table->addCell(null, $cellRowContinue); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_10_EastAsianFontStyle.php b/samples/Sample_10_EastAsianFontStyle.php index 48a19539..6770d1ff 100644 --- a/samples/Sample_10_EastAsianFontStyle.php +++ b/samples/Sample_10_EastAsianFontStyle.php @@ -1,12 +1,12 @@ '); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word Document -echo date('H:i:s') , ' Create new PhpWord object' , EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s') , ' Create new PhpWord object' , \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); $section = $phpWord->createSection(); $header = array('size' => 16, 'bold' => true); //1.Use EastAisa FontStyle @@ -16,12 +16,12 @@ $section->addText('中文楷体样式测试',array('name' => '楷体', 'size' => $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_11_ReadWord2007.php b/samples/Sample_11_ReadWord2007.php index 3ba4905e..980b1d4f 100644 --- a/samples/Sample_11_ReadWord2007.php +++ b/samples/Sample_11_ReadWord2007.php @@ -1,24 +1,24 @@ '); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // Read contents $name = basename(__FILE__, '.php'); $source = "resources/{$name}.docx"; -echo date('H:i:s'), " Reading contents from `{$source}`", EOL; -$phpWord = PhpOffice\PhpWord\IOFactory::load($source); +echo date('H:i:s'), " Reading contents from `{$source}`", \EOL; +$phpWord = \PhpOffice\PhpWord\IOFactory::load($source); // (Re)write contents $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_12_HeaderFooter.php b/samples/Sample_12_HeaderFooter.php index 73589d99..dd1b24d9 100644 --- a/samples/Sample_12_HeaderFooter.php +++ b/samples/Sample_12_HeaderFooter.php @@ -1,12 +1,12 @@ '); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word document -echo date('H:i:s') , " Create new PhpWord object" , EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s') , " Create new PhpWord object" , \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); // New portrait section $section = $phpWord->createSection(); @@ -63,12 +63,12 @@ $section2->addText('Some text...'); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_13_Images.php b/samples/Sample_13_Images.php index 5bd480d8..e64f6386 100644 --- a/samples/Sample_13_Images.php +++ b/samples/Sample_13_Images.php @@ -4,13 +4,13 @@ */ // Init -error_reporting(E_ALL); -define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '
'); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word document -echo date('H:i:s'), " Create new PhpWord object", EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s'), " Create new PhpWord object", \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); // Begin code $section = $phpWord->createSection(); @@ -31,12 +31,12 @@ $section->addMemoryImage($source); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_14_ListItem.php b/samples/Sample_14_ListItem.php index f3894d25..7b23fb05 100644 --- a/samples/Sample_14_ListItem.php +++ b/samples/Sample_14_ListItem.php @@ -4,13 +4,13 @@ */ // Init -error_reporting(E_ALL); -define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '
'); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word document -echo date('H:i:s'), " Create new PhpWord object", EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s'), " Create new PhpWord object", \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); // Begin code $section = $phpWord->createSection(); @@ -31,7 +31,7 @@ $section->addListItem('List Item 1.3.2', 2); $section->addTextBreak(2); // Add listitem elements -$listStyle = array('listType' => PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER); +$listStyle = array('listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER); $section->addListItem('List Item 1', 0, null, $listStyle); $section->addListItem('List Item 2', 0, null, $listStyle); $section->addListItem('List Item 3', 0, null, $listStyle); @@ -40,7 +40,7 @@ $section->addTextBreak(2); // Add listitem elements $phpWord->addFontStyle('myOwnStyle', array('color'=>'FF0000')); $phpWord->addParagraphStyle('P-Style', array('spaceAfter'=>95)); -$listStyle = array('listType' => PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER_NESTED); +$listStyle = array('listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER_NESTED); $section->addListItem('List Item 1', 0, 'myOwnStyle', $listStyle, 'P-Style'); $section->addListItem('List Item 2', 0, 'myOwnStyle', $listStyle, 'P-Style'); $section->addListItem('List Item 3', 1, 'myOwnStyle', $listStyle, 'P-Style'); @@ -55,12 +55,12 @@ $section->addListItem('List Item 7', 0, 'myOwnStyle', $listStyle, 'P-Style'); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_15_Link.php b/samples/Sample_15_Link.php index 69916ae6..34519e8b 100644 --- a/samples/Sample_15_Link.php +++ b/samples/Sample_15_Link.php @@ -4,19 +4,19 @@ */ // Init -error_reporting(E_ALL); -define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '
'); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word document -echo date('H:i:s'), " Create new PhpWord object", EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s'), " Create new PhpWord object", \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); // Begin code $section = $phpWord->createSection(); // Add hyperlink elements -$section->addLink('http://www.google.com', 'Best search engine', array('color'=>'0000FF', 'underline' => PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)); +$section->addLink('http://www.google.com', 'Best search engine', array('color'=>'0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)); $section->addTextBreak(2); $phpWord->addLinkStyle('myOwnLinkStyle', array('bold'=>true, 'color'=>'808000')); @@ -29,12 +29,12 @@ $section->addLink('http://www.yahoo.com', null, 'myOwnLinkStyle'); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_16_Object.php b/samples/Sample_16_Object.php index 29d62705..1d2a51cb 100644 --- a/samples/Sample_16_Object.php +++ b/samples/Sample_16_Object.php @@ -4,13 +4,13 @@ */ // Init -error_reporting(E_ALL); -define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '
'); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word document -echo date('H:i:s'), " Create new PhpWord object", EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s'), " Create new PhpWord object", \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); // Begin code $section = $phpWord->createSection(); @@ -24,12 +24,12 @@ $section->addObject('resources/_sheet.xls'); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_17_TitleTOC.php b/samples/Sample_17_TitleTOC.php index cbed2d7f..7cc89e14 100644 --- a/samples/Sample_17_TitleTOC.php +++ b/samples/Sample_17_TitleTOC.php @@ -4,13 +4,13 @@ */ // Init -error_reporting(E_ALL); -define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '
'); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word document -echo date('H:i:s'), " Create new PhpWord object", EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s'), " Create new PhpWord object", \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); // Begin code $section = $phpWord->createSection(); @@ -49,19 +49,19 @@ $section->addTextBreak(2); $section->addTitle('I am a Subtitle of Title 3', 2); $section->addText('Again and again, more 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 // Save file $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_18_Watermark.php b/samples/Sample_18_Watermark.php index e80a0530..60f735da 100644 --- a/samples/Sample_18_Watermark.php +++ b/samples/Sample_18_Watermark.php @@ -4,13 +4,13 @@ */ // Init -error_reporting(E_ALL); -define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '
'); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word document -echo date('H:i:s'), " Create new PhpWord object", EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s'), " Create new PhpWord object", \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); // Begin code @@ -25,12 +25,12 @@ $section->addText('The header reference to the current section includes a waterm $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/samples/Sample_19_TextBreak.php b/samples/Sample_19_TextBreak.php index d6bdafc4..7fffed6d 100644 --- a/samples/Sample_19_TextBreak.php +++ b/samples/Sample_19_TextBreak.php @@ -4,13 +4,13 @@ */ // Init -error_reporting(E_ALL); -define('EOL', (PHP_SAPI == 'cli') ? PHP_EOL : '
'); +error_reporting(\E_ALL); +define('EOL', (\PHP_SAPI == 'cli') ? \PHP_EOL : '
'); require_once '../src/PhpWord.php'; // New Word document -echo date('H:i:s'), " Create new PhpWord object", EOL; -$phpWord = new PhpOffice\PhpWord\PhpWord(); +echo date('H:i:s'), " Create new PhpWord object", \EOL; +$phpWord = new \PhpOffice\PhpWord\PhpWord(); // Begin code $fontStyle = array('size' => 24); @@ -38,12 +38,12 @@ $section->addText('Done.'); $name = basename(__FILE__, '.php'); $writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); foreach ($writers as $writer => $extension) { - echo date('H:i:s'), " Write to {$writer} format", EOL; - $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); + echo date('H:i:s'), " Write to {$writer} format", \EOL; + $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); $xmlWriter->save("{$name}.{$extension}"); rename("{$name}.{$extension}", "results/{$name}.{$extension}"); } // Done -echo date('H:i:s'), " Done writing file(s)", EOL; -echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", EOL; +echo date('H:i:s'), " Done writing file(s)", \EOL; +echo date('H:i:s'), " Peak memory usage: ", (memory_get_peak_usage(true) / 1024 / 1024), " MB", \EOL; diff --git a/src/Autoloader.php b/src/Autoloader.php index ace06fcc..cc82d236 100644 --- a/src/Autoloader.php +++ b/src/Autoloader.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/DocumentProperties.php b/src/DocumentProperties.php index 25dddc2f..6dc31608 100644 --- a/src/DocumentProperties.php +++ b/src/DocumentProperties.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -152,8 +150,8 @@ class DocumentProperties /** * Set Creator * - * @param string $pValue - * @return PhpOffice\PhpWord\DocumentProperties + * @param string $pValue + * @return \PhpOffice\PhpWord\DocumentProperties */ public function setCreator($pValue = '') { @@ -174,8 +172,8 @@ class DocumentProperties /** * Set Last Modified By * - * @param string $pValue - * @return PhpOffice\PhpWord\DocumentProperties + * @param string $pValue + * @return \PhpOffice\PhpWord\DocumentProperties */ public function setLastModifiedBy($pValue = '') { @@ -196,8 +194,8 @@ class DocumentProperties /** * Set Created * - * @param datetime $pValue - * @return PhpOffice\PhpWord\DocumentProperties + * @param datetime $pValue + * @return \PhpOffice\PhpWord\DocumentProperties */ public function setCreated($pValue = null) { @@ -221,8 +219,8 @@ class DocumentProperties /** * Set Modified * - * @param datetime $pValue - * @return PhpOffice\PhpWord\DocumentProperties + * @param datetime $pValue + * @return \PhpOffice\PhpWord\DocumentProperties */ public function setModified($pValue = null) { @@ -246,8 +244,8 @@ class DocumentProperties /** * Set Title * - * @param string $pValue - * @return PhpOffice\PhpWord\DocumentProperties + * @param string $pValue + * @return \PhpOffice\PhpWord\DocumentProperties */ public function setTitle($pValue = '') { @@ -268,8 +266,8 @@ class DocumentProperties /** * Set Description * - * @param string $pValue - * @return PhpOffice\PhpWord\DocumentProperties + * @param string $pValue + * @return \PhpOffice\PhpWord\DocumentProperties */ public function setDescription($pValue = '') { @@ -290,8 +288,8 @@ class DocumentProperties /** * Set Subject * - * @param string $pValue - * @return PhpOffice\PhpWord\DocumentProperties + * @param string $pValue + * @return \PhpOffice\PhpWord\DocumentProperties */ public function setSubject($pValue = '') { @@ -313,7 +311,7 @@ class DocumentProperties * Set Keywords * * @param string $pValue - * @return PhpOffice\PhpWord\DocumentProperties + * @return \PhpOffice\PhpWord\DocumentProperties */ public function setKeywords($pValue = '') { @@ -335,7 +333,7 @@ class DocumentProperties * Set Category * * @param string $pValue - * @return PhpOffice\PhpWord\DocumentProperties + * @return \PhpOffice\PhpWord\DocumentProperties */ public function setCategory($pValue = '') { @@ -357,7 +355,7 @@ class DocumentProperties * Set Company * * @param string $pValue - * @return PhpOffice\PhpWord\DocumentProperties + * @return \PhpOffice\PhpWord\DocumentProperties */ public function setCompany($pValue = '') { @@ -379,7 +377,7 @@ class DocumentProperties * Set Manager * * @param string $pValue - * @return PhpOffice\PhpWord\DocumentProperties + * @return \PhpOffice\PhpWord\DocumentProperties */ public function setManager($pValue = '') { @@ -447,7 +445,7 @@ class DocumentProperties * 's': String * 'd': Date/Time * 'b': Boolean - * @return PhpOffice\PhpWord\DocumentProperties + * @return \PhpOffice\PhpWord\DocumentProperties */ public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null) { diff --git a/src/Exceptions/InvalidImageException.php b/src/Exceptions/InvalidImageException.php index aca82c8c..11a2a660 100644 --- a/src/Exceptions/InvalidImageException.php +++ b/src/Exceptions/InvalidImageException.php @@ -2,11 +2,7 @@ namespace PhpOffice\PhpWord\Exceptions; /** - * InvalidImageException - * * Exception used for when an image is not found - * - * @package PhpWord */ class InvalidImageException extends Exception { diff --git a/src/Exceptions/InvalidStyleException.php b/src/Exceptions/InvalidStyleException.php index df405cf9..6eccb8e0 100644 --- a/src/Exceptions/InvalidStyleException.php +++ b/src/Exceptions/InvalidStyleException.php @@ -4,11 +4,7 @@ namespace PhpOffice\PhpWord\Exceptions; use InvalidArgumentException; /** - * InvalidStyleException - * * Exception used for when a style value is invalid - * - * @package PhpWord */ class InvalidStyleException extends InvalidArgumentException { diff --git a/src/Exceptions/UnsupportedImageTypeException.php b/src/Exceptions/UnsupportedImageTypeException.php index 1e126df7..80f459c5 100644 --- a/src/Exceptions/UnsupportedImageTypeException.php +++ b/src/Exceptions/UnsupportedImageTypeException.php @@ -2,11 +2,7 @@ namespace PhpOffice\PhpWord\Exceptions; /** - * UnsupportedImageTypeException - * * Exception used for when an image type is unsupported - * - * @package PhpWord */ class UnsupportedImageTypeException extends Exception { diff --git a/src/Footnote.php b/src/Footnote.php index a66a340f..92aaadfc 100644 --- a/src/Footnote.php +++ b/src/Footnote.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -51,7 +49,7 @@ class Footnote * * @return mixed */ - public static function addFootnoteElement(PhpOffice\PhpWord\Section\Footnote $footnote) + public static function addFootnoteElement(\PhpOffice\PhpWord\Section\Footnote $footnote) { $refID = self::countFootnoteElements() + 2; diff --git a/src/HashTable.php b/src/HashTable.php index 183820c4..4a8cca07 100644 --- a/src/HashTable.php +++ b/src/HashTable.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,8 @@ namespace PhpOffice\PhpWord; +use PhpOffice\PhpWord\Exceptions\Exception; + /** * @codeCoverageIgnore Legacy from PHPExcel */ @@ -47,8 +47,7 @@ class HashTable public $_keyMap = array(); /** - * @param PhpOffice\PhpWord\IComparable[] $pSource Optional source array to create HashTable from - * @throws Exception + * @param \PhpOffice\PhpWord\IComparable[] $pSource Optional source array to create HashTable from */ public function __construct($pSource = null) { @@ -60,8 +59,8 @@ class HashTable /** * Add HashTable items from source * - * @param PhpOffice\PhpWord\IComparable[] $pSource Source array to create HashTable from - * @throws Exception + * @param \PhpOffice\PhpWord\IComparable[] $pSource Source array to create HashTable from + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function addFromSource($pSource = null) { @@ -80,8 +79,7 @@ class HashTable /** * Add HashTable item * - * @param PhpOffice\PhpWord\IComparable $pSource Item to add - * @throws Exception + * @param \PhpOffice\PhpWord\IComparable $pSource Item to add */ public function add(IComparable $pSource = null) { @@ -110,8 +108,7 @@ class HashTable /** * Remove HashTable item * - * @param PhpOffice\PhpWord\IComparable $pSource Item to remove - * @throws Exception + * @param \PhpOffice\PhpWord\IComparable $pSource Item to remove */ public function remove(IComparable $pSource = null) { @@ -161,7 +158,7 @@ class HashTable /** * @param int $pIndex - * @return PhpOffice\PhpWord\IComparable + * @return \PhpOffice\PhpWord\IComparable */ public function getByIndex($pIndex = 0) { @@ -174,7 +171,7 @@ class HashTable /** * @param string $pHashCode - * @return PhpOffice\PhpWord\IComparable + * @return \PhpOffice\PhpWord\IComparable * */ public function getByHashCode($pHashCode = '') @@ -187,7 +184,7 @@ class HashTable } /** - * @return PhpOffice\PhpWord\IComparable[] + * @return \PhpOffice\PhpWord\IComparable[] */ public function toArray() { diff --git a/src/IOFactory.php b/src/IOFactory.php index 88810f79..ffe825a0 100644 --- a/src/IOFactory.php +++ b/src/IOFactory.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,16 +25,15 @@ namespace PhpOffice\PhpWord; -use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Exceptions\Exception; abstract class IOFactory { /** - * @param PhpOffice\PhpWord $phpWord + * @param \PhpOffice\PhpWord\PhpWord $phpWord * @param string $name - * @return PhpOffice\PhpWord\Writer\IWriter - * @throws PhpOffice\PhpWord\Exceptions\Exception + * @return \PhpOffice\PhpWord\Writer\IWriter + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public static function createWriter(PhpWord $phpWord, $name) { @@ -51,8 +48,8 @@ abstract class IOFactory /** * @param string $name - * @return PhpOffice\PhpWord\Reader\IReader - * @throws PhpOffice\PhpWord\Exceptions\Exception + * @return \PhpOffice\PhpWord\Reader\IReader + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public static function createReader($name) { @@ -70,7 +67,7 @@ abstract class IOFactory * * @param string $filename The name of the file * @param string $readerName - * @return PhpOffice\PhpWord + * @return \PhpOffice\PhpWord */ public static function load($filename, $readerName = 'Word2007') { diff --git a/src/Media.php b/src/Media.php index 2656b3fd..f7954df3 100644 --- a/src/Media.php +++ b/src/Media.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -37,9 +35,9 @@ class Media * @var array */ private static $_sectionMedia = array( - 'images' => array(), + 'images' => array(), 'embeddings' => array(), - 'links' => array() + 'links' => array() ); /** @@ -66,9 +64,9 @@ class Media /** * Add new Section Media Element * - * @param string $src - * @param string $type - * @param PhpOffice\PhpWord\Section\MemoryImage|null $memoryImage + * @param string $src + * @param string $type + * @param \PhpOffice\PhpWord\Section\MemoryImage|null $memoryImage * @return mixed */ public static function addSectionMediaElement($src, $type, MemoryImage $memoryImage = null) @@ -93,7 +91,7 @@ class Media $isMemImage = true; } if (!$isMemImage) { - $isMemImage = (filter_var($src, FILTER_VALIDATE_URL) !== false); + $isMemImage = (filter_var($src, \FILTER_VALIDATE_URL) !== false); } $extension = ''; if ($isMemImage) { @@ -103,15 +101,15 @@ class Media $media['imagefunction'] = $memoryImage->getImageFunction(); } else { $imageType = exif_imagetype($src); - if ($imageType === IMAGETYPE_JPEG) { + if ($imageType === \IMAGETYPE_JPEG) { $extension = 'jpg'; - } elseif ($imageType === IMAGETYPE_GIF) { + } elseif ($imageType === \IMAGETYPE_GIF) { $extension = 'gif'; - } elseif ($imageType === IMAGETYPE_PNG) { + } elseif ($imageType === \IMAGETYPE_PNG) { $extension = 'png'; - } elseif ($imageType === IMAGETYPE_BMP) { + } elseif ($imageType === \IMAGETYPE_BMP) { $extension = 'bmp'; - } elseif ($imageType === IMAGETYPE_TIFF_II || $imageType === IMAGETYPE_TIFF_MM) { + } elseif ($imageType === \IMAGETYPE_TIFF_II || $imageType === \IMAGETYPE_TIFF_MM) { $extension = 'tif'; } } @@ -204,9 +202,9 @@ class Media /** * Add new Header Media Element * - * @param int $headerCount - * @param string $src - * @param PhpOffice\PhpWord\Section\MemoryImage|null $memoryImage + * @param int $headerCount + * @param string $src + * @param \PhpOffice\PhpWord\Section\MemoryImage|null $memoryImage * @return int */ public static function addHeaderMediaElement($headerCount, $src, MemoryImage $memoryImage = null) @@ -276,9 +274,9 @@ class Media /** * Add new Footer Media Element * - * @param int $footerCount - * @param string $src - * @param PhpOffice\PhpWord\Section\MemoryImage|null $memoryImage + * @param int $footerCount + * @param string $src + * @param \PhpOffice\PhpWord\Section\MemoryImage|null $memoryImage * @return int */ public static function addFooterMediaElement($footerCount, $src, MemoryImage $memoryImage = null) diff --git a/src/PhpWord.php b/src/PhpWord.php index 9439f9ce..c2adbe87 100644 --- a/src/PhpWord.php +++ b/src/PhpWord.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -37,7 +35,7 @@ use PhpOffice\PhpWord\Template; if (!defined('PHPWORD_BASE_DIR')) { define('PHPWORD_BASE_DIR', \realpath(__DIR__) . \DIRECTORY_SEPARATOR); require \PHPWORD_BASE_DIR . 'Autoloader.php'; - Autoloader::register(); + \PhpOffice\PhpWord\Autoloader::register(); } // @codeCoverageIgnoreEnd @@ -55,7 +53,7 @@ class PhpWord const DEFAULT_FONT_SIZE = 10; /** - * @var PhpOffice\PhpWord\DocumentProperties + * @var \PhpOffice\PhpWord\DocumentProperties */ private $_documentProperties; @@ -70,7 +68,7 @@ class PhpWord private $_defaultFontSize; /** - * @var PhpOffice\PhpWord\Section[] + * @var \PhpOffice\PhpWord\Section[] */ private $_sections = array(); @@ -82,7 +80,7 @@ class PhpWord } /** - * @return PhpOffice\PhpWord\DocumentProperties + * @return \PhpOffice\PhpWord\DocumentProperties */ public function getDocumentProperties() { @@ -90,8 +88,8 @@ class PhpWord } /** - * @param PhpOffice\PhpWord\DocumentProperties $documentProperties - * @return PhpOffice\PhpWord + * @param \PhpOffice\PhpWord\DocumentProperties $documentProperties + * @return \PhpOffice\PhpWord\PhpWord */ public function setDocumentProperties(DocumentProperties $documentProperties) { @@ -101,8 +99,8 @@ class PhpWord } /** - * @param PhpOffice\PhpWord\Section\Settings $settings - * @return PhpOffice\PhpWord\Section + * @param \PhpOffice\PhpWord\Section\Settings $settings + * @return \PhpOffice\PhpWord\Section */ public function createSection($settings = null) { @@ -210,7 +208,7 @@ class PhpWord } /** - * @return PhpOffice\PhpWord\Section[] + * @return \PhpOffice\PhpWord\Section[] */ public function getSections() { @@ -219,8 +217,8 @@ class PhpWord /** * @param string $filename Fully qualified filename. - * @return PhpOffice\PhpWord\Template - * @throws PhpOffice\PhpWord\Exceptions\Exception + * @return \PhpOffice\PhpWord\Template + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function loadTemplate($filename) { diff --git a/src/Reader/AbstractReader.php b/src/Reader/AbstractReader.php index f92980cb..0d68e313 100644 --- a/src/Reader/AbstractReader.php +++ b/src/Reader/AbstractReader.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -61,7 +59,7 @@ abstract class AbstractReader implements IReader * Set read data only * * @param bool $pValue - * @return PhpOffice\PhpWord\Reader\IReader + * @return \PhpOffice\PhpWord\Reader\IReader */ public function setReadDataOnly($pValue = true) { @@ -74,7 +72,7 @@ abstract class AbstractReader implements IReader * * @param string $pFilename * @return resource - * @throws Exception + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ protected function openFile($pFilename) { diff --git a/src/Reader/IReader.php b/src/Reader/IReader.php index 94db13e5..7c14b8fa 100644 --- a/src/Reader/IReader.php +++ b/src/Reader/IReader.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -32,8 +30,8 @@ interface IReader /** * Can the current IReader read the file? * - * @param string $pFilename - * @return boolean + * @param string $pFilename + * @return boolean */ public function canRead($pFilename); @@ -43,4 +41,4 @@ interface IReader * @param string $pFilename */ public function load($pFilename); -} +} \ No newline at end of file diff --git a/src/Reader/Word2007.php b/src/Reader/Word2007.php index f978e03d..aecf899c 100644 --- a/src/Reader/Word2007.php +++ b/src/Reader/Word2007.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -44,7 +42,7 @@ class Word2007 extends AbstractReader implements IReader * * @param string $pFilename * @return bool - * @throws PhpOffice\PhpWord\Exceptions\Exception + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function canRead($pFilename) { @@ -78,7 +76,7 @@ class Word2007 extends AbstractReader implements IReader } /** - * @param ZipArchive $archive + * @param \ZipArchive $archive * @param string $fileName * @param bool $removeNamespace * @return mixed @@ -109,7 +107,7 @@ class Word2007 extends AbstractReader implements IReader * Loads PhpWord from file * * @param string $pFilename - * @return PhpOffice\PhpWord|null + * @return \PhpOffice\PhpWord\PhpWord|null */ public function load($pFilename) { @@ -271,7 +269,7 @@ class Word2007 extends AbstractReader implements IReader /** * Load section settings from SimpleXMLElement * - * @param SimpleXMLElement $elm + * @param \SimpleXMLElement $elm * @return array|string|null * * @todo Implement gutter @@ -333,7 +331,7 @@ class Word2007 extends AbstractReader implements IReader /** * Load paragraph style from SimpleXMLElement * - * @param SimpleXMLElement $elm + * @param \SimpleXMLElement $elm * @return array|string|null */ private function loadParagraphStyle($elm) @@ -394,7 +392,7 @@ class Word2007 extends AbstractReader implements IReader /** * Load font style from SimpleXMLElement * - * @param SimpleXMLElement $elm + * @param \SimpleXMLElement $elm * @return array|string|null */ private function loadFontStyle($elm) diff --git a/src/Section.php b/src/Section.php index cfcb6bc9..7fabb0b9 100644 --- a/src/Section.php +++ b/src/Section.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -29,8 +27,8 @@ namespace PhpOffice\PhpWord; use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Section\Footer; -use PhpOffice\PhpWord\Section\Footnote; use PhpOffice\PhpWord\Section\Image; +use PhpOffice\PhpWord\Section\Header; use PhpOffice\PhpWord\Section\Link; use PhpOffice\PhpWord\Section\ListItem; use PhpOffice\PhpWord\Section\MemoryImage; @@ -56,7 +54,7 @@ class Section /** * Section settings * - * @var PhpOffice\PhpWord\Section\Settings + * @var \PhpOffice\PhpWord\Section\Settings */ private $_settings; @@ -77,7 +75,7 @@ class Section /** * Section Footer * - * @var PhpOffice\PhpWord\Section\Footer + * @var \PhpOffice\PhpWord\Section\Footer */ private $_footer = null; @@ -115,7 +113,7 @@ class Section /** * Get Section Settings * - * @return PhpOffice\PhpWord\Section\Settings + * @return \PhpOffice\PhpWord\Section\Settings */ public function getSettings() { @@ -128,7 +126,7 @@ class Section * @param string $text * @param mixed $styleFont * @param mixed $styleParagraph - * @return PhpOffice\PhpWord\Section\Text + * @return \PhpOffice\PhpWord\Section\Text */ public function addText($text, $styleFont = null, $styleParagraph = null) { @@ -147,7 +145,7 @@ class Section * @param string $linkName * @param mixed $styleFont * @param mixed $styleParagraph - * @return PhpOffice\PhpWord\Section\Link + * @return \PhpOffice\PhpWord\Section\Link */ public function addLink($linkSrc, $linkName = null, $styleFont = null, $styleParagraph = null) { @@ -172,8 +170,8 @@ class Section * Add a TextBreak Element * * @param int $count - * @param null|string|array|PhpOffice\PhpWord\Style\Font $fontStyle - * @param null|string|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle + * @param null|string|array|\PhpOffice\PhpWord\Style\Font $fontStyle + * @param null|string|array|\PhpOffice\PhpWord\Style\Paragraph $paragraphStyle */ public function addTextBreak($count = 1, $fontStyle = null, $paragraphStyle = null) { @@ -194,7 +192,7 @@ class Section * Add a Table Element * * @param mixed $style - * @return PhpOffice\PhpWord\Section\Table + * @return \PhpOffice\PhpWord\Section\Table */ public function addTable($style = null) { @@ -211,7 +209,7 @@ class Section * @param mixed $styleFont * @param mixed $styleList * @param mixed $styleParagraph - * @return PhpOffice\PhpWord\Section\ListItem + * @return \PhpOffice\PhpWord\Section\ListItem */ public function addListItem($text, $depth = 0, $styleFont = null, $styleList = null, $styleParagraph = null) { @@ -228,8 +226,8 @@ class Section * * @param string $src * @param mixed $style - * @return PhpOffice\PhpWord\Section\Object - * @throws Exception + * @return \PhpOffice\PhpWord\Section\Object + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function addObject($src, $style = null) { @@ -269,8 +267,8 @@ class Section * * @param string $src * @param mixed $style - * @return PhpOffice\PhpWord\Section\Image - * @throws Exception + * @return \PhpOffice\PhpWord\Section\Image + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function addImage($src, $style = null) { @@ -291,8 +289,8 @@ class Section * * @param string $link * @param mixed $style - * @return PhpOffice\PhpWord\Section\MemoryImage - * @throws Exception + * @return \PhpOffice\PhpWord\Section\MemoryImage + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function addMemoryImage($link, $style = null) { @@ -312,7 +310,7 @@ class Section * * @param mixed $styleFont * @param mixed $styleTOC - * @return PhpOffice\PhpWord\TOC + * @return \PhpOffice\PhpWord\TOC */ public function addTOC($styleFont = null, $styleTOC = null) { @@ -326,7 +324,7 @@ class Section * * @param string $text * @param int $depth - * @return PhpOffice\PhpWord\Section\Title + * @return \PhpOffice\PhpWord\Section\Title */ public function addTitle($text, $depth = 1) { @@ -357,7 +355,7 @@ class Section * Create a new TextRun * * @param mixed $styleParagraph - * @return PhpOffice\PhpWord\Section\TextRun + * @return \PhpOffice\PhpWord\Section\TextRun */ public function createTextRun($styleParagraph = null) { @@ -379,7 +377,7 @@ class Section /** * Create a new Header * - * @return PhpOffice\PhpWord\Section\Header + * @return \PhpOffice\PhpWord\Section\Header */ public function createHeader() { @@ -417,7 +415,7 @@ class Section /** * Create a new Footer * - * @return PhpOffice\PhpWord\Section\Footer + * @return \PhpOffice\PhpWord\Section\Footer */ public function createFooter() { @@ -427,9 +425,7 @@ class Section } /** - * Get Footer - * - * @return PhpOffice\PhpWord\Section\Footer + * @return \PhpOffice\PhpWord\Section\Footer */ public function getFooter() { @@ -440,11 +436,11 @@ class Section * Create a new Footnote Element * * @param mixed $styleParagraph - * @return PhpOffice\PhpWord\Section\Footnote + * @return \PhpOffice\PhpWord\Section\Footnote */ public function createFootnote($styleParagraph = null) { - $footnote = new Footnote($styleParagraph); + $footnote = new \PhpOffice\PhpWord\Section\Footnote($styleParagraph); $refID = Footnote::addFootnoteElement($footnote); $footnote->setReferenceId($refID); $this->_elementCollection[] = $footnote; diff --git a/src/Section/Footer.php b/src/Section/Footer.php index 8c88bd84..085bcd07 100644 --- a/src/Section/Footer.php +++ b/src/Section/Footer.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Section; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Media; use PhpOffice\PhpWord\Section\Footer\PreserveText; use PhpOffice\PhpWord\Shared\String; @@ -68,7 +67,7 @@ class Footer * @param string $text * @param mixed $styleFont * @param mixed $styleParagraph - * @return PhpOffice\PhpWord\Section\Text + * @return \PhpOffice\PhpWord\Section\Text */ public function addText($text, $styleFont = null, $styleParagraph = null) { @@ -84,8 +83,8 @@ class Footer * Add TextBreak * * @param int $count - * @param null|string|array|PhpOffice\PhpWord\Style\Font $fontStyle - * @param null|string|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle + * @param null|string|array|\PhpOffice\PhpWord\Style\Font $fontStyle + * @param null|string|array|\PhpOffice\PhpWord\Style\Paragraph $paragraphStyle */ public function addTextBreak($count = 1, $fontStyle = null, $paragraphStyle = null) { @@ -97,7 +96,7 @@ class Footer /** * Create a new TextRun * - * @return PhpOffice\PhpWord\Section\TextRun + * @return \PhpOffice\PhpWord\Section\TextRun */ public function createTextRun($styleParagraph = null) { @@ -110,7 +109,7 @@ class Footer * Add a Table Element * * @param mixed $style - * @return PhpOffice\PhpWord\Section\Table + * @return \PhpOffice\PhpWord\Section\Table */ public function addTable($style = null) { @@ -124,7 +123,7 @@ class Footer * * @param string $src * @param mixed $style - * @return Image + * @return \PhpOffice\PhpWord\Section\Image */ public function addImage($src, $style = null) { @@ -146,7 +145,7 @@ class Footer * * @param string $link * @param mixed $style - * @return PhpOffice\PhpWord\Section\MemoryImage + * @return \PhpOffice\PhpWord\Section\MemoryImage */ public function addMemoryImage($link, $style = null) { @@ -168,7 +167,7 @@ class Footer * @param string $text * @param mixed $styleFont * @param mixed $styleParagraph - * @return PhpOffice\PhpWord\Section\Footer\PreserveText + * @return \PhpOffice\PhpWord\Section\Footer\PreserveText */ public function addPreserveText($text, $styleFont = null, $styleParagraph = null) { diff --git a/src/Section/Footer/PreserveText.php b/src/Section/Footer/PreserveText.php index fa9f8a86..635af9f2 100644 --- a/src/Section/Footer/PreserveText.php +++ b/src/Section/Footer/PreserveText.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -42,14 +40,14 @@ class PreserveText /** * Text style * - * @var PhpOffice\PhpWord\Style\Font + * @var \PhpOffice\PhpWord\Style\Font */ private $_styleFont; /** * Paragraph style * - * @var PhpOffice\PhpWord\Style\Paragraph + * @var \PhpOffice\PhpWord\Style\Paragraph */ private $_styleParagraph; @@ -90,7 +88,7 @@ class PreserveText $this->_styleParagraph = $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])) { $this->_text = $matches[0]; } @@ -101,7 +99,7 @@ class PreserveText /** * Get Text style * - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function getFontStyle() { @@ -111,7 +109,7 @@ class PreserveText /** * Get Paragraph style * - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function getParagraphStyle() { diff --git a/src/Section/Footnote.php b/src/Section/Footnote.php index e5b6e6d8..2a9eacaf 100644 --- a/src/Section/Footnote.php +++ b/src/Section/Footnote.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -34,7 +32,7 @@ class Footnote /** * Paragraph style * - * @var PhpOffice\PhpWord\Style\Paragraph + * @var \PhpOffice\PhpWord\Style\Paragraph */ private $_styleParagraph; @@ -80,7 +78,7 @@ class Footnote * * @var string $text * @var mixed $styleFont - * @return PhpOffice\PhpWord\Section\Text + * @return \PhpOffice\PhpWord\Section\Text */ public function addText($text = null, $styleFont = null) { @@ -96,13 +94,13 @@ class Footnote * @param string $linkSrc * @param string $linkName * @param mixed $styleFont - * @return PhpOffice\PhpWord\Section\Link + * @return \PhpOffice\PhpWord\Section\Link */ public function addLink($linkSrc, $linkName = null, $styleFont = null) { $link = new Link($linkSrc, $linkName, $styleFont); - $rID = PhpOffice\PhpWord\Footnote::addFootnoteLinkElement($linkSrc); + $rID = \PhpOffice\PhpWord\Footnote::addFootnoteLinkElement($linkSrc); $link->setRelationId($rID); $this->_elementCollection[] = $link; @@ -120,9 +118,7 @@ class Footnote } /** - * Get Paragraph style - * - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function getParagraphStyle() { diff --git a/src/Section/Header.php b/src/Section/Header.php index 6067945b..d9d3eed1 100644 --- a/src/Section/Header.php +++ b/src/Section/Header.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Section; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Media; use PhpOffice\PhpWord\Section\Footer\PreserveText; use PhpOffice\PhpWord\Shared\String; @@ -97,7 +96,7 @@ class Header * @param string $text * @param mixed $styleFont * @param mixed $styleParagraph - * @return PhpOffice\PhpWord\Section\Text + * @return \PhpOffice\PhpWord\Section\Text */ public function addText($text, $styleFont = null, $styleParagraph = null) { @@ -113,8 +112,8 @@ class Header * Add TextBreak * * @param int $count - * @param null|string|array|PhpOffice\PhpWord\Style\Font $fontStyle - * @param null|string|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle + * @param null|string|array|\PhpOffice\PhpWord\Style\Font $fontStyle + * @param null|string|array|\PhpOffice\PhpWord\Style\Paragraph $paragraphStyle */ public function addTextBreak($count = 1, $fontStyle = null, $paragraphStyle = null) { @@ -126,7 +125,7 @@ class Header /** * Create a new TextRun * - * @return PhpOffice\PhpWord\Section\TextRun + * @return \PhpOffice\PhpWord\Section\TextRun */ public function createTextRun($styleParagraph = null) { @@ -139,7 +138,7 @@ class Header * Add a Table Element * * @param mixed $style - * @return PhpOffice\PhpWord\Section\Table + * @return \PhpOffice\PhpWord\Section\Table */ public function addTable($style = null) { @@ -153,7 +152,7 @@ class Header * * @param string $src * @param mixed $style - * @return PhpOffice\PhpWord\Section\Image + * @return \PhpOffice\PhpWord\Section\Image */ public function addImage($src, $style = null) { @@ -175,7 +174,7 @@ class Header * * @param string $link * @param mixed $style - * @return PhpOffice\PhpWord\Section\MemoryImage + * @return \PhpOffice\PhpWord\Section\MemoryImage */ public function addMemoryImage($link, $style = null) { @@ -197,7 +196,7 @@ class Header * @param string $text * @param mixed $styleFont * @param mixed $styleParagraph - * @return PhpOffice\PhpWord\Section\Footer\PreserveText + * @return \PhpOffice\PhpWord\Section\Footer\PreserveText */ public function addPreserveText($text, $styleFont = null, $styleParagraph = null) { @@ -214,7 +213,7 @@ class Header * * @param string $src * @param mixed $style - * @return PhpOffice\PhpWord\Section\Image + * @return \PhpOffice\PhpWord\Section\Image */ public function addWatermark($src, $style = null) { diff --git a/src/Section/Image.php b/src/Section/Image.php index 8762e8ca..2c041253 100644 --- a/src/Section/Image.php +++ b/src/Section/Image.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -42,7 +40,7 @@ class Image /** * Image Style * - * @var PhpOffice\PhpWord\Style\Image + * @var \PhpOffice\PhpWord\Style\Image */ private $_style; @@ -67,11 +65,12 @@ class Image * @param string $src * @param mixed $style * @param bool $isWatermark - * @throws InvalidImageException|UnsupportedImageTypeException + * @throws \PhpOffice\PhpWord\Exceptions\InvalidImageException + * @throws \PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException */ public function __construct($src, $style = null, $isWatermark = false) { - $supportedImageTypes = array(IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM); + $supportedImageTypes = array(\IMAGETYPE_JPEG, \IMAGETYPE_GIF, \IMAGETYPE_PNG, \IMAGETYPE_BMP, \IMAGETYPE_TIFF_II, \IMAGETYPE_TIFF_MM); if (!file_exists($src)) { throw new InvalidImageException; @@ -83,7 +82,7 @@ class Image $this->_src = $src; $this->_isWatermark = $isWatermark; - $this->_style = new PhpOffice\PhpWord\Style\Image(); + $this->_style = new \PhpOffice\PhpWord\Style\Image(); if (!is_null($style) && is_array($style)) { foreach ($style as $key => $value) { @@ -108,7 +107,7 @@ class Image /** * Get Image style * - * @return PhpOffice\PhpWord\Style\Image + * @return \PhpOffice\PhpWord\Style\Image */ public function getStyle() { diff --git a/src/Section/Link.php b/src/Section/Link.php index 5c3cc9fe..c3c14466 100644 --- a/src/Section/Link.php +++ b/src/Section/Link.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -56,14 +54,14 @@ class Link /** * Link style * - * @var PhpOffice\PhpWord\Style\Font + * @var \PhpOffice\PhpWord\Style\Font */ private $_styleFont; /** * Paragraph style * - * @var PhpOffice\PhpWord\Style\Paragraph + * @var \PhpOffice\PhpWord\Style\Paragraph */ private $_styleParagraph; @@ -155,7 +153,7 @@ class Link /** * Get Text style * - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function getFontStyle() { @@ -165,7 +163,7 @@ class Link /** * Get Paragraph style * - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function getParagraphStyle() { diff --git a/src/Section/ListItem.php b/src/Section/ListItem.php index 2aaf4c34..7760e87d 100644 --- a/src/Section/ListItem.php +++ b/src/Section/ListItem.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -32,14 +30,14 @@ class ListItem /** * ListItem Style * - * @var PhpOffice\PhpWord\Style\ListItem + * @var \PhpOffice\PhpWord\Style\ListItem */ private $_style; /** * Textrun * - * @var PhpOffice\PhpWord\Section\Text + * @var \PhpOffice\PhpWord\Section\Text */ private $_textObject; @@ -61,7 +59,7 @@ class ListItem */ public function __construct($text, $depth = 0, $styleFont = null, $styleList = null, $styleParagraph = null) { - $this->_style = new PhpOffice\PhpWord\Style\ListItem(); + $this->_style = new \PhpOffice\PhpWord\Style\ListItem(); $this->_textObject = new Text($text, $styleFont, $styleParagraph); $this->_depth = $depth; diff --git a/src/Section/MemoryImage.php b/src/Section/MemoryImage.php index 4d81ee87..62de8317 100644 --- a/src/Section/MemoryImage.php +++ b/src/Section/MemoryImage.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -41,7 +39,7 @@ class MemoryImage /** * Image Style * - * @var PhpOffice\PhpWord\Style\Image + * @var \PhpOffice\PhpWord\Style\Image */ private $_style; @@ -144,7 +142,7 @@ class MemoryImage /** * Get Image style * - * @return PhpOffice\PhpWord\Style\Image + * @return \PhpOffice\PhpWord\Style\Image */ public function getStyle() { diff --git a/src/Section/Object.php b/src/Section/Object.php index 2569478a..a7cbdfc1 100644 --- a/src/Section/Object.php +++ b/src/Section/Object.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -41,7 +39,7 @@ class Object /** * Image Style * - * @var PhpOffice\PhpWord\Style\Image + * @var \PhpOffice\PhpWord\Style\Image */ private $_style; @@ -100,7 +98,7 @@ class Object /** * Get Image style * - * @return PhpOffice\PhpWord\Style\Image + * @return \PhpOffice\PhpWord\Style\Image */ public function getStyle() { diff --git a/src/Section/PageBreak.php b/src/Section/PageBreak.php index ebf7f31f..a164b328 100644 --- a/src/Section/PageBreak.php +++ b/src/Section/PageBreak.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -29,9 +27,6 @@ namespace PhpOffice\PhpWord\Section; class PageBreak { - /** - * Create a new PageBreak Element - */ public function __construct() { } diff --git a/src/Section/Settings.php b/src/Section/Settings.php index 9563a444..b2c65e4a 100644 --- a/src/Section/Settings.php +++ b/src/Section/Settings.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/Section/Table.php b/src/Section/Table.php index a06b41ac..51b33252 100644 --- a/src/Section/Table.php +++ b/src/Section/Table.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -34,7 +32,7 @@ class Table /** * Table style * - * @var PhpOffice\PhpWord\Style\Table + * @var \PhpOffice\PhpWord\Style\Table */ private $_style; @@ -81,7 +79,7 @@ class Table if (!is_null($style)) { if (is_array($style)) { - $this->_style = new PhpOffice\PhpWord\Style\Table(); + $this->_style = new \PhpOffice\PhpWord\Style\Table(); foreach ($style as $key => $value) { if (substr($key, 0, 1) != '_') { @@ -112,7 +110,7 @@ class Table * * @param int $width * @param mixed $style - * @return PhpOffice\PhpWord\Section\Table\Cell + * @return \PhpOffice\PhpWord\Section\Table\Cell */ public function addCell($width = null, $style = null) { @@ -134,7 +132,7 @@ class Table /** * Get table style * - * @return PhpOffice\PhpWord\Style\Table + * @return \PhpOffice\PhpWord\Style\Table */ public function getStyle() { diff --git a/src/Section/Table/Cell.php b/src/Section/Table/Cell.php index 0088ceb0..21ae054f 100644 --- a/src/Section/Table/Cell.php +++ b/src/Section/Table/Cell.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Section\Table; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Media; use PhpOffice\PhpWord\Section\Footer\PreserveText; use PhpOffice\PhpWord\Section\Image; @@ -51,7 +50,7 @@ class Cell /** * Cell Style * - * @var PhpOffice\PhpWord\Style\Cell + * @var \PhpOffice\PhpWord\Style\Cell */ private $_style; @@ -90,7 +89,7 @@ class Cell $this->_insideOf = $insideOf; $this->_pCount = $pCount; $this->_width = $width; - $this->_style = new PhpOffice\PhpWord\Style\Cell(); + $this->_style = new \PhpOffice\PhpWord\Style\Cell(); if (!is_null($style)) { if (is_array($style)) { @@ -111,7 +110,7 @@ class Cell * * @param string $text * @param mixed $style - * @return PhpOffice\PhpWord\Section\Text + * @return \PhpOffice\PhpWord\Section\Text */ public function addText($text, $styleFont = null, $styleParagraph = null) { @@ -129,7 +128,7 @@ class Cell * @param string $linkSrc * @param string $linkName * @param mixed $style - * @return PhpOffice\PhpWord\Section\Link + * @return \PhpOffice\PhpWord\Section\Link */ public function addLink($linkSrc, $linkName = null, $style = null) { @@ -159,8 +158,8 @@ class Cell * Add TextBreak * * @param int $count - * @param null|string|array|PhpOffice\PhpWord\Style\Font $fontStyle - * @param null|string|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle + * @param null|string|array|\PhpOffice\PhpWord\Style\Font $fontStyle + * @param null|string|array|\PhpOffice\PhpWord\Style\Paragraph $paragraphStyle */ public function addTextBreak($count = 1, $fontStyle = null, $paragraphStyle = null) { @@ -176,7 +175,7 @@ class Cell * @param int $depth * @param mixed $styleText * @param mixed $styleList - * @return PhpOffice\PhpWord\Section\ListItem + * @return \PhpOffice\PhpWord\Section\ListItem */ public function addListItem($text, $depth = 0, $styleText = null, $styleList = null) { @@ -193,7 +192,7 @@ class Cell * * @param string $src * @param mixed $style - * @return PhpOffice\PhpWord\Section\Image + * @return \PhpOffice\PhpWord\Section\Image */ public function addImage($src, $style = null) { @@ -221,7 +220,7 @@ class Cell * * @param string $link * @param mixed $style - * @return PhpOffice\PhpWord\Section\MemoryImage + * @return \PhpOffice\PhpWord\Section\MemoryImage */ public function addMemoryImage($link, $style = null) { @@ -248,7 +247,7 @@ class Cell * * @param string $src * @param mixed $style - * @return PhpOffice\PhpWord\Section\Object + * @return \PhpOffice\PhpWord\Section\Object */ public function addObject($src, $style = null) { @@ -290,7 +289,7 @@ class Cell * @param string $text * @param mixed $styleFont * @param mixed $styleParagraph - * @return PhpOffice\PhpWord\Section\Footer\PreserveText + * @return \PhpOffice\PhpWord\Section\Footer\PreserveText */ public function addPreserveText($text, $styleFont = null, $styleParagraph = null) { @@ -309,7 +308,7 @@ class Cell /** * Create a new TextRun * - * @return PhpOffice\PhpWord\Section\TextRun + * @return \PhpOffice\PhpWord\Section\TextRun */ public function createTextRun($styleParagraph = null) { @@ -331,7 +330,7 @@ class Cell /** * Get Cell Style * - * @return PhpOffice\PhpWord\Style\Cell + * @return \PhpOffice\PhpWord\Style\Cell */ public function getStyle() { diff --git a/src/Section/Table/Row.php b/src/Section/Table/Row.php index de9822b3..b9092295 100644 --- a/src/Section/Table/Row.php +++ b/src/Section/Table/Row.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2013 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -39,7 +37,7 @@ class Row /** * Row style * - * @var PhpOffice\PhpWord\Style\Row + * @var \PhpOffice\PhpWord\Style\Row */ private $_style; @@ -78,7 +76,7 @@ class Row $this->_insideOf = $insideOf; $this->_pCount = $pCount; $this->_height = $height; - $this->_style = new PhpOffice\PhpWord\Style\Row(); + $this->_style = new \PhpOffice\PhpWord\Style\Row(); if (!is_null($style)) { if (is_array($style)) { @@ -98,7 +96,7 @@ class Row * * @param int $width * @param mixed $style - * @return PhpOffice\PhpWord\Section\Table\Cell + * @return \PhpOffice\PhpWord\Section\Table\Cell */ public function addCell($width = null, $style = null) { @@ -120,7 +118,7 @@ class Row /** * Get row style * - * @return PhpOffice\PhpWord\Style\Row + * @return \PhpOffice\PhpWord\Style\Row */ public function getStyle() { diff --git a/src/Section/Text.php b/src/Section/Text.php index 3e51bc86..50dfdc89 100644 --- a/src/Section/Text.php +++ b/src/Section/Text.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -42,14 +40,14 @@ class Text /** * Text style * - * @var PhpOffice\PhpWord\Style\Font + * @var \PhpOffice\PhpWord\Style\Font */ private $fontStyle; /** * Paragraph style * - * @var PhpOffice\PhpWord\Style\Paragraph + * @var \PhpOffice\PhpWord\Style\Paragraph */ private $paragraphStyle; @@ -57,8 +55,8 @@ class Text * Create a new Text Element * * @param string $text - * @param null|array|PhpOffice\PhpWord\Style\Font $fontStyle - * @param null|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle + * @param null|array|\PhpOffice\PhpWord\Style\Font $fontStyle + * @param null|array|\PhpOffice\PhpWord\Style\Paragraph $paragraphStyle */ public function __construct($text = null, $fontStyle = null, $paragraphStyle = null) { @@ -70,9 +68,9 @@ class Text /** * Set Text style * - * @param null|array|PhpOffice\PhpWord\Style\Font $style - * @param null|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle - * @return PhpOffice\PhpWord\Style\Font + * @param null|array|\PhpOffice\PhpWord\Style\Font $style + * @param null|array|\PhpOffice\PhpWord\Style\Paragraph $paragraphStyle + * @return \PhpOffice\PhpWord\Style\Font */ public function setFontStyle($style = null, $paragraphStyle = null) { @@ -94,7 +92,7 @@ class Text /** * Get Text style * - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function getFontStyle() { @@ -104,8 +102,8 @@ class Text /** * Set Paragraph style * - * @param null|array|PhpOffice\PhpWord\Style\Paragraph $style - * @return null|PhpOffice\PhpWord\Style\Paragraph + * @param null|array|\PhpOffice\PhpWord\Style\Paragraph $style + * @return null|\PhpOffice\PhpWord\Style\Paragraph */ public function setParagraphStyle($style = null) { @@ -125,7 +123,7 @@ class Text /** * Get Paragraph style * - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function getParagraphStyle() { diff --git a/src/Section/TextBreak.php b/src/Section/TextBreak.php index cd296c74..938f66c2 100644 --- a/src/Section/TextBreak.php +++ b/src/Section/TextBreak.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -35,14 +33,14 @@ class TextBreak /** * Paragraph style * - * @var PhpOffice\PhpWord\Style\Pagaraph + * @var \PhpOffice\PhpWord\Style\Pagaraph */ private $paragraphStyle = null; /** * Text style * - * @var PhpOffice\PhpWord\Style\Font + * @var \PhpOffice\PhpWord\Style\Font */ private $fontStyle = null; @@ -62,9 +60,9 @@ class TextBreak /** * Set Text style * - * @param null|array|PhpOffice\PhpWord\Style\Font $style - * @param null|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle - * @return PhpOffice\PhpWord\Style\Font + * @param null|array|\PhpOffice\PhpWord\Style\Font $style + * @param null|array|\PhpOffice\PhpWord\Style\Paragraph $paragraphStyle + * @return \PhpOffice\PhpWord\Style\Font */ public function setFontStyle($style = null, $paragraphStyle = null) { @@ -84,7 +82,7 @@ class TextBreak /** * Get Text style * - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function getFontStyle() { @@ -94,8 +92,8 @@ class TextBreak /** * Set Paragraph style * - * @param null|array|PhpOffice\PhpWord\Style\Paragraph $style - * @return null|PhpOffice\PhpWord\Style\Paragraph + * @param null|array|\PhpOffice\PhpWord\Style\Paragraph $style + * @return null|\PhpOffice\PhpWord\Style\Paragraph */ public function setParagraphStyle($style = null) { @@ -113,7 +111,7 @@ class TextBreak /** * Get Paragraph style * - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function getParagraphStyle() { diff --git a/src/Section/TextRun.php b/src/Section/TextRun.php index 4cee06d6..0911b5dc 100644 --- a/src/Section/TextRun.php +++ b/src/Section/TextRun.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Section; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Media; use PhpOffice\PhpWord\Shared\String; use PhpOffice\PhpWord\Style\Paragraph; @@ -36,7 +35,7 @@ class TextRun /** * Paragraph style * - * @var PhpOffice\PhpWord\Style\Paragraph + * @var \PhpOffice\PhpWord\Style\Paragraph */ private $_styleParagraph; @@ -76,7 +75,7 @@ class TextRun * * @var string $text * @var mixed $styleFont - * @return PhpOffice\PhpWord\Section\Text + * @return \PhpOffice\PhpWord\Section\Text */ public function addText($text = null, $styleFont = null) { @@ -94,7 +93,7 @@ class TextRun * @param string $linkSrc * @param string $linkName * @param mixed $styleFont - * @return PhpOffice\PhpWord\Section\Link + * @return \PhpOffice\PhpWord\Section\Link */ public function addLink($linkSrc, $linkName = null, $styleFont = null) { @@ -116,7 +115,7 @@ class TextRun * * @param string $imageSrc * @param mixed $styleFont - * @return PhpOffice\PhpWord\Section\Image + * @return \PhpOffice\PhpWord\Section\Image */ public function addImage($imageSrc, $style = null) { @@ -137,8 +136,8 @@ class TextRun * Add TextBreak * * @param int $count - * @param null|string|array|PhpOffice\PhpWord\Style\Font $fontStyle - * @param null|string|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle + * @param null|string|array|\PhpOffice\PhpWord\Style\Font $fontStyle + * @param null|string|array|\PhpOffice\PhpWord\Style\Paragraph $paragraphStyle */ public function addTextBreak($count = 1, $fontStyle = null, $paragraphStyle = null) { @@ -151,12 +150,12 @@ class TextRun * Create a new Footnote Element * * @param string $text - * @return PhpOffice\PhpWord\Section\Footnote + * @return \PhpOffice\PhpWord\Section\Footnote */ public function createFootnote($styleParagraph = null) { - $footnote = new PhpOffice\PhpWord\Section\Footnote($styleParagraph); - $refID = PhpOffice\PhpWord\Footnote::addFootnoteElement($footnote); + $footnote = new \PhpOffice\PhpWord\Section\Footnote($styleParagraph); + $refID = \PhpOffice\PhpWord\Footnote::addFootnoteElement($footnote); $footnote->setReferenceId($refID); $this->_elementCollection[] = $footnote; return $footnote; @@ -175,7 +174,7 @@ class TextRun /** * Get Paragraph style * - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function getParagraphStyle() { diff --git a/src/Section/Title.php b/src/Section/Title.php index fdc31ac8..1c3546ae 100644 --- a/src/Section/Title.php +++ b/src/Section/Title.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/Settings.php b/src/Settings.php index 8eb3a60f..b93fa94e 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/Shared/Drawing.php b/src/Shared/Drawing.php index e7289a8a..16a363ac 100644 --- a/src/Shared/Drawing.php +++ b/src/Shared/Drawing.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/Shared/File.php b/src/Shared/File.php index f2d4f3be..e7385241 100644 --- a/src/Shared/File.php +++ b/src/Shared/File.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -32,7 +30,7 @@ class File /** * Verify if a file exists * - * @param string $pFilename Filename + * @param string $pFilename Filename * @return bool */ public static function file_exists($pFilename) diff --git a/src/Shared/Font.php b/src/Shared/Font.php index adee50ad..8b9c7d09 100644 --- a/src/Shared/Font.php +++ b/src/Shared/Font.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/Shared/String.php b/src/Shared/String.php index d7d66a47..63bfe148 100644 --- a/src/Shared/String.php +++ b/src/Shared/String.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/Shared/XMLWriter.php b/src/Shared/XMLWriter.php index 2334997f..b0c6906d 100644 --- a/src/Shared/XMLWriter.php +++ b/src/Shared/XMLWriter.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -47,7 +45,7 @@ class XMLWriter /** * Internal XMLWriter * - * @var XMLWriter + * @var \XMLWriter */ private $_xmlWriter; @@ -59,15 +57,13 @@ class XMLWriter private $_tempFileName = ''; /** - * Create a new XMLWriter instance - * * @param int $pTemporaryStorage Temporary storage location * @param string $pTemporaryStorageFolder Temporary storage folder */ public function __construct($pTemporaryStorage = self::STORAGE_MEMORY, $pTemporaryStorageFolder = './') { // Create internal XMLWriter - $this->_xmlWriter = new XMLWriter(); + $this->_xmlWriter = new \XMLWriter(); // Open temporary storage if ($pTemporaryStorage == self::STORAGE_MEMORY) { @@ -133,7 +129,7 @@ class XMLWriter { try { @call_user_func_array(array($this->_xmlWriter, $function), $args); - } catch (Exception $ex) { + } catch (\Exception $ex) { // Do nothing! } } diff --git a/src/Shared/ZipStreamWrapper.php b/src/Shared/ZipStreamWrapper.php index 2676ac55..55b2fec6 100644 --- a/src/Shared/ZipStreamWrapper.php +++ b/src/Shared/ZipStreamWrapper.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,8 @@ namespace PhpOffice\PhpWord\Shared; +use PhpOffice\PhpWord\Exceptions\Exception; + /** * @codeCoverageIgnore Legacy from PHPExcel */ @@ -35,7 +35,7 @@ class ZipStreamWrapper /** * Internal ZipAcrhive * - * @var ZipAcrhive + * @var \ZipAcrhive */ private $_archive; @@ -149,7 +149,7 @@ class ZipStreamWrapper public function stream_seek($offset, $whence) { switch ($whence) { - case SEEK_SET: + case \SEEK_SET: if ($offset < strlen($this->_data) && $offset >= 0) { $this->_position = $offset; return true; @@ -158,7 +158,7 @@ class ZipStreamWrapper } break; - case SEEK_CUR: + case \SEEK_CUR: if ($offset >= 0) { $this->_position += $offset; return true; @@ -167,7 +167,7 @@ class ZipStreamWrapper } break; - case SEEK_END: + case \SEEK_END: if (strlen($this->_data) + $offset >= 0) { $this->_position = strlen($this->_data) + $offset; return true; diff --git a/src/Style.php b/src/Style.php index 387dc468..d765db69 100644 --- a/src/Style.php +++ b/src/Style.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -140,7 +138,7 @@ class Style /** * Get all styles * - * @return PhpOffice\PhpWord\Style\Font[] + * @return \PhpOffice\PhpWord\Style\Font[] */ public static function getStyles() { diff --git a/src/Style/Cell.php b/src/Style/Cell.php index 23cd0c07..99b7e8c5 100644 --- a/src/Style/Cell.php +++ b/src/Style/Cell.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/Style/Font.php b/src/Style/Font.php index 7551200b..137d6964 100644 --- a/src/Style/Font.php +++ b/src/Style/Font.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -74,9 +72,7 @@ class Font private $_type; /** - * Paragraph Style - * - * @var PhpOffice\PhpWord\Style\Paragraph + * @var \PhpOffice\PhpWord\Style\Paragraph */ private $_paragraphStyle; @@ -95,43 +91,31 @@ class Font private $_size = PhpWord::DEFAULT_FONT_SIZE; /** - * Bold - * * @var bool */ private $_bold = false; /** - * Italics - * * @var bool */ private $_italic = false; /** - * Superscript - * * @var bool */ private $_superScript = false; /** - * Subscript - * * @var bool */ private $_subScript = false; /** - * Underline mode - * * @var string */ private $_underline = self::UNDERLINE_NONE; /** - * Strikethrough - * * @var bool */ private $_strikethrough = false; @@ -165,8 +149,6 @@ class Font private $_hint = PhpWord::DEFAULT_FONT_CONTENT_TYPE; /** - * New font style - * * @param string $type Type of font * @param array $paragraphStyle Paragraph styles definition */ @@ -204,10 +186,8 @@ class Font } /** - * Set style value - * - * @param string $key - * @param mixed $value + * @param string $key + * @param mixed $value */ public function setStyleValue($key, $value) { @@ -220,7 +200,7 @@ class Font /** * Get font name * - * @return bool + * @return bool */ public function getName() { @@ -231,7 +211,7 @@ class Font * Set font name * * @param string $pValue - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function setName($pValue = PhpWord::DEFAULT_FONT_NAME) { @@ -257,7 +237,7 @@ class Font * Set font size * * @param int|float $pValue - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function setSize($pValue = PhpWord::DEFAULT_FONT_SIZE) { @@ -269,9 +249,7 @@ class Font } /** - * Get bold - * - * @return bool + * @return bool */ public function getBold() { @@ -279,10 +257,8 @@ class Font } /** - * Set bold - * * @param bool $pValue - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function setBold($pValue = false) { @@ -294,9 +270,7 @@ class Font } /** - * Get italics - * - * @return bool + * @return bool */ public function getItalic() { @@ -304,10 +278,8 @@ class Font } /** - * Set italics - * * @param bool $pValue - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function setItalic($pValue = false) { @@ -319,9 +291,7 @@ class Font } /** - * Get superscript - * - * @return bool + * @return bool */ public function getSuperScript() { @@ -329,10 +299,8 @@ class Font } /** - * Set superscript - * * @param bool $pValue - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function setSuperScript($pValue = false) { @@ -345,9 +313,7 @@ class Font } /** - * Get superscript - * - * @return bool + * @return bool */ public function getSubScript() { @@ -355,10 +321,8 @@ class Font } /** - * Set subscript - * * @param bool $pValue - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function setSubScript($pValue = false) { @@ -371,9 +335,7 @@ class Font } /** - * Get underline - * - * @return string + * @return string */ public function getUnderline() { @@ -381,10 +343,8 @@ class Font } /** - * Set underline - * * @param string $pValue - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function setUnderline($pValue = self::UNDERLINE_NONE) { @@ -396,9 +356,7 @@ class Font } /** - * Get strikethrough - * - * @return bool + * @return bool */ public function getStrikethrough() { @@ -406,10 +364,8 @@ class Font } /** - * Set strikethrough - * * @param bool $pValue - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function setStrikethrough($pValue = false) { @@ -423,7 +379,7 @@ class Font /** * Get font color * - * @return string + * @return string */ public function getColor() { @@ -431,10 +387,8 @@ class Font } /** - * Set font color - * * @param string $pValue - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function setColor($pValue = PhpWord::DEFAULT_FONT_COLOR) { @@ -448,7 +402,7 @@ class Font /** * Get foreground/highlight color * - * @return bool + * @return bool */ public function getFgColor() { @@ -459,7 +413,7 @@ class Font * Set foreground/highlight color * * @param string $pValue - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function setFgColor($pValue = null) { @@ -468,8 +422,6 @@ class Font } /** - * Get style type - * * @return string */ public function getStyleType() @@ -478,9 +430,7 @@ class Font } /** - * Get paragraph style - * - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function getParagraphStyle() { @@ -488,11 +438,9 @@ class Font } /** - * Set the line height - * - * @param int|float|string $lineHeight + * @param int|float|string $lineHeight * @return $this - * @throws InvalidStyleException + * @throws \PhpOffice\PhpWord\Exceptions\InvalidStyleException */ public function setLineHeight($lineHeight) { @@ -531,7 +479,7 @@ class Font * Set Font Content Type * * @param string $pValue - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public function setHint($pValue = PhpWord::DEFAULT_FONT_CONTENT_TYPE) { @@ -541,4 +489,4 @@ class Font $this->_hint = $pValue; return $this; } -} +} \ No newline at end of file diff --git a/src/Style/Image.php b/src/Style/Image.php index fbc074be..a2390126 100644 --- a/src/Style/Image.php +++ b/src/Style/Image.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -145,7 +143,7 @@ class Image /** * @param string $wrappingStyle - * @throws InvalidArgumentException + * @throws \InvalidArgumentException * @return $this */ public function setWrappingStyle($wrappingStyle) @@ -159,7 +157,7 @@ class Image $this->wrappingStyle = $wrappingStyle; break; default: - throw new InvalidArgumentException('Wrapping style does not exists'); + throw new \InvalidArgumentException('Wrapping style does not exists'); break; } return $this; diff --git a/src/Style/ListItem.php b/src/Style/ListItem.php index 458e08e8..d0d6c750 100644 --- a/src/Style/ListItem.php +++ b/src/Style/ListItem.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/Style/Paragraph.php b/src/Style/Paragraph.php index 87827448..b4d9006f 100644 --- a/src/Style/Paragraph.php +++ b/src/Style/Paragraph.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -186,7 +184,7 @@ class Paragraph * Set Paragraph Alignment * * @param string $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setAlign($pValue = null) { @@ -212,7 +210,7 @@ class Paragraph * Set Space before Paragraph * * @param int $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setSpaceBefore($pValue = null) { @@ -234,7 +232,7 @@ class Paragraph * Set Space after Paragraph * * @param int $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setSpaceAfter($pValue = null) { @@ -256,7 +254,7 @@ class Paragraph * Set Spacing between breaks * * @param int $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setSpacing($pValue = null) { @@ -278,7 +276,7 @@ class Paragraph * Set indentation * * @param int $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setIndent($pValue = null) { @@ -300,7 +298,7 @@ class Paragraph * Set hanging * * @param int $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setHanging($pValue = null) { @@ -311,7 +309,7 @@ class Paragraph /** * Get tabs * - * @return PhpOffice\PhpWord\Style\Tabs + * @return \PhpOffice\PhpWord\Style\Tabs */ public function getTabs() { @@ -322,7 +320,7 @@ class Paragraph * Set tabs * * @param array $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setTabs($pValue = null) { @@ -346,7 +344,7 @@ class Paragraph * Set parent style ID * * @param string $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setBasedOn($pValue = 'Normal') { @@ -368,7 +366,7 @@ class Paragraph * Set style for next paragraph * * @param string $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setNext($pValue = null) { @@ -390,7 +388,7 @@ class Paragraph * Set keep paragraph with next paragraph setting * * @param bool $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setWidowControl($pValue = true) { @@ -415,7 +413,7 @@ class Paragraph * Set keep paragraph with next paragraph setting * * @param bool $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setKeepNext($pValue = false) { @@ -440,7 +438,7 @@ class Paragraph * Set keep all lines on one page setting * * @param bool $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setKeepLines($pValue = false) { @@ -465,7 +463,7 @@ class Paragraph * Set start paragraph on next page setting * * @param bool $pValue - * @return PhpOffice\PhpWord\Style\Paragraph + * @return \PhpOffice\PhpWord\Style\Paragraph */ public function setPageBreakBefore($pValue = false) { @@ -481,7 +479,7 @@ class Paragraph * * @param int|float|string $lineHeight * @return $this - * @throws InvalidStyleException + * @throws \PhpOffice\PhpWord\Exceptions\InvalidStyleException */ public function setLineHeight($lineHeight) { diff --git a/src/Style/Row.php b/src/Style/Row.php index 5431dd20..237241e5 100644 --- a/src/Style/Row.php +++ b/src/Style/Row.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2013 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/Style/TOC.php b/src/Style/TOC.php index b7da1059..dac60b40 100644 --- a/src/Style/TOC.php +++ b/src/Style/TOC.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/Style/Tab.php b/src/Style/Tab.php index b9d949e9..d55e914a 100644 --- a/src/Style/Tab.php +++ b/src/Style/Tab.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -107,7 +105,7 @@ class Tab /** * Creates the XML DOM for the instance of Tab. * - * @param PhpOffice\PhpWord\Shared\XMLWriter &$xmlWriter + * @param \PhpOffice\PhpWord\Shared\XMLWriter &$xmlWriter */ public function toXml(XMLWriter &$xmlWriter = null) { diff --git a/src/Style/Table.php b/src/Style/Table.php index 4de56605..15c766d2 100644 --- a/src/Style/Table.php +++ b/src/Style/Table.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/Style/TableFull.php b/src/Style/TableFull.php index 5ca7561b..f2b41b37 100644 --- a/src/Style/TableFull.php +++ b/src/Style/TableFull.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -32,7 +30,7 @@ class TableFull /** * Style for first row * - * @var PhpOffice\PhpWord\Style\TableFull + * @var \PhpOffice\PhpWord\Style\TableFull */ private $_firstRow = null; @@ -174,7 +172,7 @@ class TableFull /** * Get First Row Style * - * @return PhpOffice\PhpWord\Style\TableFull + * @return \PhpOffice\PhpWord\Style\TableFull */ public function getFirstRow() { @@ -184,7 +182,7 @@ class TableFull /** * Get Last Row Style * - * @return PhpOffice\PhpWord\Style\TableFull + * @return \PhpOffice\PhpWord\Style\TableFull */ public function getLastRow() { diff --git a/src/Style/Tabs.php b/src/Style/Tabs.php index 45fdb568..f836532f 100644 --- a/src/Style/Tabs.php +++ b/src/Style/Tabs.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -48,7 +46,7 @@ class Tabs } /** - * @param PhpOffice\PhpWord\Shared\XMLWriter &$xmlWriter + * @param \PhpOffice\PhpWord\Shared\XMLWriter &$xmlWriter */ public function toXml(XMLWriter &$xmlWriter = null) { diff --git a/src/TOC.php b/src/TOC.php index 932e54be..17df13b1 100644 --- a/src/TOC.php +++ b/src/TOC.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -75,7 +73,7 @@ class TOC */ public function __construct($styleFont = null, $styleTOC = null) { - self::$_styleTOC = new PhpOffice\PhpWord\Style\TOC(); + self::$_styleTOC = new \PhpOffice\PhpWord\Style\TOC(); if (!is_null($styleTOC) && is_array($styleTOC)) { foreach ($styleTOC as $key => $value) { @@ -136,7 +134,7 @@ class TOC /** * Get TOC Style * - * @return PhpOffice\PhpWord\Style\TOC + * @return \PhpOffice\PhpWord\Style\TOC */ public static function getStyleTOC() { @@ -146,7 +144,7 @@ class TOC /** * Get Font Style * - * @return PhpOffice\PhpWord\Style\Font + * @return \PhpOffice\PhpWord\Style\Font */ public static function getStyleFont() { diff --git a/src/Template.php b/src/Template.php index a248de7f..65d0c989 100644 --- a/src/Template.php +++ b/src/Template.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -33,22 +31,16 @@ use PhpOffice\PhpWord\Shared\String; class Template { /** - * ZipArchive - * * @var \ZipArchive */ private $_objZip; /** - * Temporary Filename - * * @var string */ private $_tempFileName; /** - * Document XML - * * @var string */ private $_documentXML; @@ -58,7 +50,7 @@ class Template * Create a new Template Object * * @param string $strFilename - * @throws Exception + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function __construct($strFilename) { @@ -81,14 +73,14 @@ class Template /** * Applies XSL style sheet to template's parts * - * @param DOMDocument $xslDOMDocument + * @param \DOMDocument $xslDOMDocument * @param array $xslOptions * @param string $xslOptionsURI - * @throws Exception + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function applyXslStyleSheet(&$xslDOMDocument, $xslOptions = array(), $xslOptionsURI = '') { - $processor = new XSLTProcessor(); + $processor = new \XSLTProcessor(); $processor->importStylesheet($xslDOMDocument); @@ -96,7 +88,7 @@ class Template throw new Exception('Could not set values for the given XSL style sheet parameters.'); } - $xmlDOMDocument = new DOMDocument(); + $xmlDOMDocument = new \DOMDocument(); if ($xmlDOMDocument->loadXML($this->_documentXML) === false) { throw new Exception('Could not load XML from the given template.'); } @@ -160,7 +152,7 @@ class Template * * @param int $offset * @return int - * @throws Exception + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ private function _findRowStart($offset) { @@ -206,7 +198,7 @@ class Template * * @param string $search * @param int $numberOfClones - * @throws Exception + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function cloneRow($search, $numberOfClones) { @@ -257,10 +249,8 @@ class Template } /** - * Save Template - * * @return string - * @throws Exception + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function save() { @@ -275,8 +265,6 @@ class Template } /** - * Save Template As... - * * @param string $strFilename */ public function saveAs($strFilename) diff --git a/src/Writer/IWriter.php b/src/Writer/IWriter.php index 98c15704..697aaa9e 100644 --- a/src/Writer/IWriter.php +++ b/src/Writer/IWriter.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -33,7 +31,6 @@ interface IWriter * Save PhpWord to file * * @param string $pFileName - * @throws \Exception */ public function save($pFilename = null); } \ No newline at end of file diff --git a/src/Writer/ODText.php b/src/Writer/ODText.php index c8a2c75a..1b12e650 100644 --- a/src/Writer/ODText.php +++ b/src/Writer/ODText.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Writer; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\HashTable; use PhpOffice\PhpWord\Writer\ODText\Content; @@ -38,19 +37,19 @@ use PhpOffice\PhpWord\Writer\ODText\Styles; class ODText implements IWriter { /** - * @var PhpOffice\PhpWord + * @var \PhpOffice\PhpWord\PhpWord */ private $_document; /** - * @var PhpOffice\PhpWord\Writer\ODText\WriterPart[] + * @var \PhpOffice\PhpWord\Writer\ODText\WriterPart[] */ private $_writerParts; /** * Private unique PHPWord_Worksheet_BaseDrawing HashTable * - * @var PhpOffice\PhpWord\HashTable + * @var \PhpOffice\PhpWord\HashTable */ private $_drawingHashTable; @@ -67,7 +66,7 @@ class ODText implements IWriter private $_diskCachingDirectory; /** - * @param PhpOffice\PhpWord $phpWord + * @param \PhpOffice\PhpWord\PhpWord $phpWord */ public function __construct(PhpWord $phpWord = null) { @@ -98,7 +97,7 @@ class ODText implements IWriter * Save PhpWord to file * * @param string $pFileName - * @throws \Exception + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function save($pFilename = null) { @@ -120,7 +119,7 @@ class ODText implements IWriter // Try opening the ZIP file if ($objZip->open($pFilename, \ZipArchive::OVERWRITE) !== true) { if ($objZip->open($pFilename, \ZipArchive::CREATE) !== true) { - throw new \Exception("Could not open " . $pFilename . " for writing."); + throw new Exception("Could not open " . $pFilename . " for writing."); } } @@ -177,38 +176,38 @@ class ODText implements IWriter // Close file if ($objZip->close() === false) { - throw new \Exception("Could not close zip file $pFilename."); + throw new Exception("Could not close zip file $pFilename."); } // If a temporary file was used, copy it to the correct file stream if ($originalFilename != $pFilename) { if (copy($pFilename, $originalFilename) === false) { - throw new \Exception("Could not copy temporary zip file $pFilename to $originalFilename."); + throw new Exception("Could not copy temporary zip file $pFilename to $originalFilename."); } @unlink($pFilename); } } else { - throw new \Exception("PhpWord object unassigned."); + throw new Exception("PhpWord object unassigned."); } } /** - * @return PhpOffice\PhpWord - * @throws \Exception + * @return \PhpOffice\PhpWord\PhpWord + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function getPhpWord() { if (!is_null($this->_document)) { return $this->_document; } else { - throw new \Exception("No PhpWord assigned."); + throw new Exception("No PhpWord assigned."); } } /** - * @param PhpOffice\PhpWord $phpWord - * @return PhpOffice\PhpWord\Writer\ODText + * @param \PhpOffice\PhpWord\PhpWord $phpWord + * @return \PhpOffice\PhpWord\Writer\ODText */ public function setPhpWord(PhpWord $phpWord = null) { @@ -219,7 +218,7 @@ class ODText implements IWriter /** * Get PHPWord_Worksheet_BaseDrawing HashTable * - * @return PhpOffice\PhpWord\HashTable + * @return \PhpOffice\PhpWord\HashTable */ public function getDrawingHashTable() { @@ -228,7 +227,7 @@ class ODText implements IWriter /** * @param string $pPartName Writer part name - * @return PhpOffice\PhpWord\Writer\ODText\WriterPart + * @return \PhpOffice\PhpWord\Writer\ODText\WriterPart */ public function getWriterPart($pPartName = '') { @@ -254,8 +253,8 @@ class ODText implements IWriter * * @param boolean $pValue * @param string $pDirectory Disk caching directory - * @throws \Exception Exception when directory does not exist - * @return PhpOffice\PhpWord\Writer\ODText + * @throws \PhpOffice\PhpWord\Exceptions\Exception Exception when directory does not exist + * @return \PhpOffice\PhpWord\Writer\ODText */ public function setUseDiskCaching($pValue = false, $pDirectory = null) { @@ -265,7 +264,7 @@ class ODText implements IWriter if (is_dir($pDirectory)) { $this->_diskCachingDirectory = $pDirectory; } else { - throw new \Exception("Directory does not exist: $pDirectory"); + throw new Exception("Directory does not exist: $pDirectory"); } } diff --git a/src/Writer/ODText/Content.php b/src/Writer/ODText/Content.php index c809708f..c73c6cf8 100644 --- a/src/Writer/ODText/Content.php +++ b/src/Writer/ODText/Content.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -51,9 +49,8 @@ class Content extends WriterPart /** * Write content file to XML format * - * @param PhpOffice\PhpWord $phpWord + * @param \PhpOffice\PhpWord\PhpWord $phpWord * @return string XML Output - * @throws Exception */ public function writeContent(PhpWord $phpWord = null) { @@ -125,7 +122,7 @@ class Content extends WriterPart $arrStyle = array( 'color' => $fStyle->getColor(), - 'name' => $fStyle->getName() + 'name' => $fStyle->getName() ); $phpWord->addFontStyle('T' . $numFStyles, $arrStyle); $element->setFontStyle('T' . $numFStyles); @@ -311,8 +308,8 @@ class Content extends WriterPart /** * Write text * - * @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter - * @param PhpOffice\PhpWord\Section\Text $text + * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Section\Text $text * @param bool $withoutP */ protected function _writeText(XMLWriter $xmlWriter = null, Text $text, $withoutP = false) @@ -359,8 +356,8 @@ class Content extends WriterPart /** * Write TextRun section * - * @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter - * @param PhpOffice\PhpWord\Section\TextRun $textrun + * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Section\TextRun $textrun * @todo Enable all other section types */ protected function _writeTextRun(XMLWriter $xmlWriter = null, TextRun $textrun) @@ -400,7 +397,7 @@ class Content extends WriterPart /** * Write unsupported element * - * @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter * @param string $element */ private function writeUnsupportedElement($xmlWriter, $element) diff --git a/src/Writer/ODText/Manifest.php b/src/Writer/ODText/Manifest.php index f27f1350..48b230e9 100644 --- a/src/Writer/ODText/Manifest.php +++ b/src/Writer/ODText/Manifest.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Writer\ODText; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Shared\File; use PhpOffice\PhpWord\Shared\XMLWriter; @@ -36,9 +35,8 @@ class Manifest extends WriterPart /** * Write Manifest file to XML format * - * @param PhpOffice\PhpWord $phpWord + * @param \PhpOffice\PhpWord\PhpWord $phpWord * @return string XML Output - * @throws Exception */ public function writeManifest(PhpWord $phpWord = null) { @@ -116,9 +114,9 @@ class Manifest extends WriterPart /** * Get image mime type * - * @param string $pFile Filename - * @return string Mime Type - * @throws Exception + * @param string $pFile Filename + * @return string Mime Type + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ private function _getImageMimeType($pFile = '') { @@ -129,4 +127,4 @@ class Manifest extends WriterPart throw new Exception("File $pFile does not exist"); } } -} +} \ No newline at end of file diff --git a/src/Writer/ODText/Meta.php b/src/Writer/ODText/Meta.php index 1b30efa3..16814cb3 100644 --- a/src/Writer/ODText/Meta.php +++ b/src/Writer/ODText/Meta.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -35,9 +33,8 @@ class Meta extends WriterPart /** * Write Meta file to XML format * - * @param PhpOffice\PhpWord $phpWord + * @param \PhpOffice\PhpWord\PhpWord $phpWord * @return string XML Output - * @throws Exception */ public function writeMeta(PhpWord $phpWord = null) { diff --git a/src/Writer/ODText/Mimetype.php b/src/Writer/ODText/Mimetype.php index 59386d5a..6e0638de 100644 --- a/src/Writer/ODText/Mimetype.php +++ b/src/Writer/ODText/Mimetype.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -34,13 +32,11 @@ class Mimetype extends WriterPart /** * Write Mimetype to Text format * - * @param PhpOffice\PhpWord $phpWord + * @param \PhpOffice\PhpWord\PhpWord $phpWord * @return string Text Output - * @throws Exception */ public function writeMimetype(PhpWord $phpWord = null) { - return 'application/vnd.oasis.opendocument.text'; } -} +} \ No newline at end of file diff --git a/src/Writer/ODText/Styles.php b/src/Writer/ODText/Styles.php index 721a6b60..e5a53172 100644 --- a/src/Writer/ODText/Styles.php +++ b/src/Writer/ODText/Styles.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -39,9 +37,8 @@ class Styles extends WriterPart /** * Write Styles file to XML format * - * @param PhpOffice\PhpWord $phpWord + * @param \PhpOffice\PhpWord\PhpWord $phpWord * @return string XML Output - * @throws Exception */ public function writeStyles(PhpWord $phpWord = null) { diff --git a/src/Writer/ODText/WriterPart.php b/src/Writer/ODText/WriterPart.php index 06e4a404..a08b25c2 100644 --- a/src/Writer/ODText/WriterPart.php +++ b/src/Writer/ODText/WriterPart.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Writer\ODText; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Writer\IWriter; abstract class WriterPart @@ -34,15 +33,14 @@ abstract class WriterPart /** * Parent IWriter object * - * @var PhpOffice\PhpWord\Writer\IWriter + * @var \PhpOffice\PhpWord\Writer\IWriter */ private $_parentWriter; /** * Set parent IWriter object * - * @param PhpOffice\PhpWord\Writer\IWriter $pWriter - * @throws Exception + * @param \PhpOffice\PhpWord\Writer\IWriter $pWriter */ public function setParentWriter(IWriter $pWriter = null) { @@ -52,8 +50,8 @@ abstract class WriterPart /** * Get parent IWriter object * - * @return PhpOffice\PhpWord\Writer\IWriter - * @throws Exception + * @return \PhpOffice\PhpWord\Writer\IWriter + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function getParentWriter() { @@ -63,4 +61,4 @@ abstract class WriterPart throw new Exception("No parent IWriter assigned."); } } -} +} \ No newline at end of file diff --git a/src/Writer/RTF.php b/src/Writer/RTF.php index 57c17fdb..263dce0e 100644 --- a/src/Writer/RTF.php +++ b/src/Writer/RTF.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Writer; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\HashTable; use PhpOffice\PhpWord\Section\Image; @@ -51,14 +50,14 @@ class RTF implements IWriter /** * Private PhpWord * - * @var PhpOffice\PhpWord + * @var \PhpOffice\PhpWord\PhpWord */ private $_document; /** * Private unique PHPWord_Worksheet_BaseDrawing HashTable * - * @var PhpOffice\PhpWord\HashTable + * @var \PhpOffice\PhpWord\HashTable */ private $_drawingHashTable; @@ -67,7 +66,7 @@ class RTF implements IWriter private $_lastParagraphStyle; /** - * @param PhpOffice\PhpWord $phpWord + * @param \PhpOffice\PhpWord\PhpWord $phpWord */ public function __construct(PhpWord $phpWord = null) { @@ -82,7 +81,7 @@ class RTF implements IWriter * Save PhpWord to file * * @param string $pFileName - * @throws \Exception + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function save($pFilename = null) { @@ -103,33 +102,32 @@ class RTF implements IWriter // If a temporary file was used, copy it to the correct file stream if ($originalFilename != $pFilename) { if (copy($pFilename, $originalFilename) === false) { - throw new \Exception("Could not copy temporary zip file $pFilename to $originalFilename."); + throw new Exception("Could not copy temporary zip file $pFilename to $originalFilename."); } @unlink($pFilename); } } else { - throw new \Exception("PhpWord object unassigned."); + throw new Exception("PhpWord object unassigned."); } } /** - * @return PhpOffice\PhpWord - * @throws \Exception + * @return \PhpOffice\PhpWord\PhpWord + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ public function getPhpWord() { if (!is_null($this->_document)) { return $this->_document; } else { - throw new \Exception("No PhpWord assigned."); + throw new Exception("No PhpWord assigned."); } } /** - * @param PhpOffice\PhpWord $phpWord - * @throws \Exception - * @return PhpOffice\PhpWord\Writer\RTF + * @param \PhpOffice\PhpWord\PhpWord $phpWord + * @return \PhpOffice\PhpWord\Writer\RTF */ public function setPhpWord(PhpWord $phpWord = null) { @@ -140,7 +138,7 @@ class RTF implements IWriter /** * Get PHPWord_Worksheet_BaseDrawing HashTable * - * @return PhpOffice\PhpWord\HashTable + * @return \PhpOffice\PhpWord\HashTable */ public function getDrawingHashTable() { @@ -160,22 +158,22 @@ class RTF implements IWriter $sRTFContent .= '\deff0'; // Set the default tab size (720 twips) $sRTFContent .= '\deftab720'; - $sRTFContent .= PHP_EOL; + $sRTFContent .= \PHP_EOL; // Set the font tbl group $sRTFContent .= '{\fonttbl'; foreach ($this->_fontTable as $idx => $font) { $sRTFContent .= '{\f' . $idx . '\fnil\fcharset0 ' . $font . ';}'; } - $sRTFContent .= '}' . PHP_EOL; + $sRTFContent .= '}' . \PHP_EOL; // Set the color tbl group $sRTFContent .= '{\colortbl '; foreach ($this->_colorTable as $idx => $color) { $arrColor = Drawing::htmlToRGB($color); $sRTFContent .= ';\red' . $arrColor[0] . '\green' . $arrColor[1] . '\blue' . $arrColor[2] . ''; } - $sRTFContent .= ';}' . PHP_EOL; + $sRTFContent .= ';}' . \PHP_EOL; // Set the generator - $sRTFContent .= '{\*\generator PhpWord;}' . PHP_EOL; + $sRTFContent .= '{\*\generator PhpWord;}' . \PHP_EOL; // Set the view mode of the document $sRTFContent .= '\viewkind4'; // Set the numberof bytes that follows a unicode character @@ -190,7 +188,7 @@ class RTF implements IWriter $sRTFContent .= '\kerning1'; // Set the font size in half-points $sRTFContent .= '\fs' . (PhpWord::DEFAULT_FONT_SIZE * 2); - $sRTFContent .= PHP_EOL; + $sRTFContent .= \PHP_EOL; // Body $sRTFContent .= $this->getDataContent(); @@ -435,7 +433,7 @@ class RTF implements IWriter } if (!$withoutP) { - $sRTFText .= '\par' . PHP_EOL; + $sRTFText .= '\par' . \PHP_EOL; } return $sRTFText; } @@ -445,15 +443,15 @@ class RTF implements IWriter $sRTFText = ''; $elements = $textrun->getElements(); if (count($elements) > 0) { - $sRTFText .= '\pard\nowidctlpar' . PHP_EOL; + $sRTFText .= '\pard\nowidctlpar' . \PHP_EOL; foreach ($elements as $element) { if ($element instanceof Text) { $sRTFText .= '{'; $sRTFText .= $this->getDataContentText($element, true); - $sRTFText .= '}' . PHP_EOL; + $sRTFText .= '}' . \PHP_EOL; } } - $sRTFText .= '\par' . PHP_EOL; + $sRTFText .= '\par' . \PHP_EOL; } return $sRTFText; } @@ -462,7 +460,7 @@ class RTF implements IWriter { $this->_lastParagraphStyle = ''; - return '\par' . PHP_EOL; + return '\par' . \PHP_EOL; } /** @@ -473,9 +471,9 @@ class RTF implements IWriter private function getDataContentUnsupportedElement($element) { $sRTFText = ''; - $sRTFText .= '\pard\nowidctlpar' . PHP_EOL; + $sRTFText .= '\pard\nowidctlpar' . \PHP_EOL; $sRTFText .= "{$element}"; - $sRTFText .= '\par' . PHP_EOL; + $sRTFText .= '\par' . \PHP_EOL; return $sRTFText; } diff --git a/src/Writer/Word2007.php b/src/Writer/Word2007.php index de31e71e..a8c2dacc 100644 --- a/src/Writer/Word2007.php +++ b/src/Writer/Word2007.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Writer; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Footnote; use PhpOffice\PhpWord\Media; @@ -222,15 +221,15 @@ class Word2007 implements IWriter $extension = 'php'; } else { $imageType = exif_imagetype($src); - if ($imageType === IMAGETYPE_JPEG) { + if ($imageType === \IMAGETYPE_JPEG) { $extension = 'jpg'; - } elseif ($imageType === IMAGETYPE_GIF) { + } elseif ($imageType === \IMAGETYPE_GIF) { $extension = 'gif'; - } elseif ($imageType === IMAGETYPE_PNG) { + } elseif ($imageType === \IMAGETYPE_PNG) { $extension = 'png'; - } elseif ($imageType === IMAGETYPE_BMP) { + } elseif ($imageType === \IMAGETYPE_BMP) { $extension = 'bmp'; - } elseif ($imageType === IMAGETYPE_TIFF_II || $imageType === IMAGETYPE_TIFF_MM) { + } elseif ($imageType === \IMAGETYPE_TIFF_II || $imageType === \IMAGETYPE_TIFF_MM) { $extension = 'tif'; } } diff --git a/src/Writer/Word2007/Base.php b/src/Writer/Word2007/Base.php index f0029fc4..a7090d1e 100644 --- a/src/Writer/Word2007/Base.php +++ b/src/Writer/Word2007/Base.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -137,8 +135,8 @@ class Base extends WriterPart } /** - * @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter - * @param PhpOffice\PhpWord\Style\Paragraph $style + * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Style\Paragraph $style * @param bool $withoutPPR * @return void */ @@ -475,8 +473,8 @@ class Base extends WriterPart } /** - * @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter - * @param PhpOffice\PhpWord\Section\TextBreak $element + * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Section\TextBreak $element */ protected function _writeTextBreak($xmlWriter, $element = null) { @@ -632,7 +630,7 @@ class Base extends WriterPart protected function _writeTableStyle( XMLWriter $xmlWriter = null, - PhpOffice\PhpWord\Style\Table $style = null + \PhpOffice\PhpWord\Style\Table $style = null ) { $margins = $style->getCellMargin(); $mTop = (!is_null($margins[0])) ? true : false; @@ -781,8 +779,8 @@ class Base extends WriterPart } /** - * @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter - * @param PhpOffice\PhpWord\Section\Image|PhpOffice\PhpWord\Section\MemoryImage $image + * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter + * @param \PhpOffice\PhpWord\Section\Image|\PhpOffice\PhpWord\Section\MemoryImage $image */ protected function _writeImage(XMLWriter $xmlWriter = null, $image, $withoutP = false) { @@ -830,16 +828,16 @@ class Base extends WriterPart } switch ($wrappingStyle) { - case PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_BEHIND: + case \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_BEHIND: $imgStyle .= 'position:absolute;z-index:-251658752;'; break; - case PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_SQUARE: + case \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_SQUARE: $imgStyle .= 'position:absolute;z-index:251659264;mso-position-horizontal:absolute;mso-position-vertical:absolute;'; break; - case PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_TIGHT: + case \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_TIGHT: $imgStyle .= 'position:absolute;z-index:251659264;mso-wrap-edited:f;mso-position-horizontal:absolute;mso-position-vertical:absolute'; break; - case PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_INFRONT: + case \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_INFRONT: $imgStyle .= 'position:absolute;zz-index:251659264;mso-position-horizontal:absolute;mso-position-vertical:absolute;'; break; } diff --git a/src/Writer/Word2007/ContentTypes.php b/src/Writer/Word2007/ContentTypes.php index 2d84070d..787eb5ad 100644 --- a/src/Writer/Word2007/ContentTypes.php +++ b/src/Writer/Word2007/ContentTypes.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Shared\File; use PhpOffice\PhpWord\Shared\XMLWriter; @@ -174,9 +173,9 @@ class ContentTypes extends WriterPart /** * Get image mime type * - * @param string $pFile Filename - * @return string Mime Type - * @throws Exception + * @param string $pFile Filename + * @return string Mime Type + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ private function _getImageMimeType($pFile = '') { @@ -189,10 +188,10 @@ class ContentTypes extends WriterPart } /** - * @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter XML Writer - * @param string $pPartname Part name - * @param string $pContentType Content type - * @throws Exception + * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter XML Writer + * @param string $pPartname Part name + * @param string $pContentType Content type + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ private function _writeDefaultContentType(XMLWriter $xmlWriter = null, $pPartname = '', $pContentType = '') { @@ -208,10 +207,10 @@ class ContentTypes extends WriterPart } /** - * @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter - * @param string $pPartname Part name - * @param string $pContentType Content type - * @throws Exception + * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter + * @param string $pPartname Part name + * @param string $pContentType Content type + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ private function _writeOverrideContentType(XMLWriter $xmlWriter = null, $pPartname = '', $pContentType = '') { @@ -225,4 +224,4 @@ class ContentTypes extends WriterPart throw new Exception("Invalid parameters passed."); } } -} +} \ No newline at end of file diff --git a/src/Writer/Word2007/DocProps.php b/src/Writer/Word2007/DocProps.php index 98a5abb8..bbfc6523 100644 --- a/src/Writer/Word2007/DocProps.php +++ b/src/Writer/Word2007/DocProps.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 diff --git a/src/Writer/Word2007/Document.php b/src/Writer/Word2007/Document.php index f865c41c..142fa252 100644 --- a/src/Writer/Word2007/Document.php +++ b/src/Writer/Word2007/Document.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -28,6 +26,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007; use PhpOffice\PhpWord\PhpWord; +use PhpOffice\PhpWord\Section; use PhpOffice\PhpWord\Section\Footnote; use PhpOffice\PhpWord\Section\Image; use PhpOffice\PhpWord\Section\Link; diff --git a/src/Writer/Word2007/DocumentRels.php b/src/Writer/Word2007/DocumentRels.php index 176dd055..02071666 100644 --- a/src/Writer/Word2007/DocumentRels.php +++ b/src/Writer/Word2007/DocumentRels.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Shared\XMLWriter; class DocumentRels extends WriterPart @@ -179,4 +178,4 @@ class DocumentRels extends WriterPart throw new Exception("Invalid parameters passed."); } } -} +} \ No newline at end of file diff --git a/src/Writer/Word2007/Footer.php b/src/Writer/Word2007/Footer.php index f3ef2a1f..e10a7eff 100644 --- a/src/Writer/Word2007/Footer.php +++ b/src/Writer/Word2007/Footer.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -38,7 +36,7 @@ use PhpOffice\PhpWord\Shared\XMLWriter; class Footer extends Base { - public function writeFooter(PhpOffice\PhpWord\Section\Footer $footer) + public function writeFooter(\PhpOffice\PhpWord\Section\Footer $footer) { // Create XML writer $xmlWriter = null; diff --git a/src/Writer/Word2007/Footnotes.php b/src/Writer/Word2007/Footnotes.php index d467859f..fa048c46 100644 --- a/src/Writer/Word2007/Footnotes.php +++ b/src/Writer/Word2007/Footnotes.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -72,7 +70,6 @@ class Footnotes extends Base $xmlWriter->endElement(); // w:p $xmlWriter->endElement(); // w:footnote - foreach ($allFootnotesCollection as $footnote) { if ($footnote instanceof Footnote) { $this->_writeFootnote($xmlWriter, $footnote); diff --git a/src/Writer/Word2007/FootnotesRels.php b/src/Writer/Word2007/FootnotesRels.php index b1819876..6b2b5602 100644 --- a/src/Writer/Word2007/FootnotesRels.php +++ b/src/Writer/Word2007/FootnotesRels.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Shared\XMLWriter; class FootnotesRels extends WriterPart @@ -86,4 +85,4 @@ class FootnotesRels extends WriterPart throw new Exception("Invalid parameters passed."); } } -} +} \ No newline at end of file diff --git a/src/Writer/Word2007/Header.php b/src/Writer/Word2007/Header.php index aef2c38a..b5695f88 100644 --- a/src/Writer/Word2007/Header.php +++ b/src/Writer/Word2007/Header.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -38,7 +36,7 @@ use PhpOffice\PhpWord\Shared\XMLWriter; class Header extends Base { - public function writeHeader(PhpOffice\PhpWord\Section\Header $header) + public function writeHeader(\PhpOffice\PhpWord\Section\Header $header) { // Create XML writer if ($this->getParentWriter()->getUseDiskCaching()) { diff --git a/src/Writer/Word2007/Rels.php b/src/Writer/Word2007/Rels.php index 09de0e63..db817f9c 100644 --- a/src/Writer/Word2007/Rels.php +++ b/src/Writer/Word2007/Rels.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\Shared\XMLWriter; @@ -83,12 +82,12 @@ class Rels extends WriterPart /** * Write Override content type * - * @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter - * @param int $pId Relationship ID. rId will be prepended! - * @param string $pType Relationship type - * @param string $pTarget Relationship target - * @param string $pTargetMode Relationship target mode - * @throws Exception + * @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter + * @param int $pId Relationship ID. rId will be prepended! + * @param string $pType Relationship type + * @param string $pTarget Relationship target + * @param string $pTargetMode Relationship target mode + * @throws \PhpOffice\PhpWord\Exceptions\Exception */ private function _writeRelationship(XMLWriter $xmlWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '') { @@ -112,4 +111,4 @@ class Rels extends WriterPart throw new Exception("Invalid parameters passed."); } } -} +} \ No newline at end of file diff --git a/src/Writer/Word2007/Styles.php b/src/Writer/Word2007/Styles.php index 81ee36ef..b90f4eb3 100644 --- a/src/Writer/Word2007/Styles.php +++ b/src/Writer/Word2007/Styles.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -299,7 +297,6 @@ class Styles extends Base $xmlWriter->endElement(); } - // First Row $firstRow = $style->getFirstRow(); if (!is_null($firstRow)) { @@ -396,4 +393,4 @@ class Styles extends Base $xmlWriter->endElement(); $xmlWriter->endElement(); } -} +} \ No newline at end of file diff --git a/src/Writer/Word2007/WriterPart.php b/src/Writer/Word2007/WriterPart.php index bb8fefc3..38bead77 100644 --- a/src/Writer/Word2007/WriterPart.php +++ b/src/Writer/Word2007/WriterPart.php @@ -18,8 +18,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category PhpWord - * @package PhpWord * @copyright Copyright (c) 2014 PhpWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.8.0 @@ -27,6 +25,7 @@ namespace PhpOffice\PhpWord\Writer\Word2007; +use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Writer\IWriter; abstract class WriterPart @@ -46,4 +45,4 @@ abstract class WriterPart throw new Exception("No parent IWriter assigned."); } } -} +} \ No newline at end of file