Code formatting for PSR1 & PSR2 - Part 2

This commit is contained in:
Ivan Lanin 2014-03-11 21:44:54 +07:00
parent 4e3450e39f
commit d2a231799d
44 changed files with 81 additions and 99 deletions

View File

@ -69,7 +69,7 @@ class PHPWord_HashTable
// Check if an array was passed // Check if an array was passed
if ($pSource == null) { if ($pSource == null) {
return; return;
} else if (!is_array($pSource)) { } elseif (!is_array($pSource)) {
throw new Exception('Invalid array parameter passed.'); throw new Exception('Invalid array parameter passed.');
} }
@ -91,7 +91,7 @@ class PHPWord_HashTable
$hashIndex = $pSource->getHashIndex(); $hashIndex = $pSource->getHashIndex();
if (is_null($hashIndex)) { if (is_null($hashIndex)) {
$hashCode = $pSource->getHashCode(); $hashCode = $pSource->getHashCode();
} else if (isset ($this->_keyMap[$hashIndex])) { } elseif (isset ($this->_keyMap[$hashIndex])) {
$hashCode = $this->_keyMap[$hashIndex]; $hashCode = $this->_keyMap[$hashIndex];
} else { } else {
$hashCode = $pSource->getHashCode(); $hashCode = $pSource->getHashCode();

View File

@ -161,7 +161,7 @@ class PHPWord_Writer_ODText implements PHPWord_Writer_IWriter
} }
$objZip->addFromString('Pictures/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents); $objZip->addFromString('Pictures/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents);
} else if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPWord_Shape_MemoryDrawing) { } elseif ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPWord_Shape_MemoryDrawing) {
ob_start(); ob_start();
call_user_func( call_user_func(
$this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(), $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(),

View File

@ -86,7 +86,7 @@ class PHPWord_Writer_ODText_Manifest extends PHPWord_Writer_ODText_WriterPart
$objWriter->writeAttribute('manifest:media-type', $mimeType); $objWriter->writeAttribute('manifest:media-type', $mimeType);
$objWriter->writeAttribute('manifest:full-path', 'Pictures/' . str_replace(' ', '_', $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getIndexedFilename())); $objWriter->writeAttribute('manifest:full-path', 'Pictures/' . str_replace(' ', '_', $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()));
$objWriter->endElement(); $objWriter->endElement();
} else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPWord_Shape_MemoryDrawing) { } elseif ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPWord_Shape_MemoryDrawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType()); $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType());
$extension = explode('/', $extension); $extension = explode('/', $extension);
$extension = $extension[1]; $extension = $extension[1];

View File

@ -29,4 +29,4 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase
Autoloader::autoload('PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException'); // TODO change this class to the main PHPWord class when it is namespaced Autoloader::autoload('PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException'); // TODO change this class to the main PHPWord class when it is namespaced
$this->assertTrue(in_array('PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException', get_declared_classes()), 'PhpOffice\\PhpWord\\Autoloader::autoload() failed to autoload the PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException class'); $this->assertTrue(in_array('PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException', get_declared_classes()), 'PhpOffice\\PhpWord\\Autoloader::autoload() failed to autoload the PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException class');
} }
} }

View File

@ -59,4 +59,4 @@ class IOFactoryTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(PHPWord_IOFactory::createWriter($oPHPWord, 'Word2007'), new PHPWord_Writer_Word2007($oPHPWord)); $this->assertEquals(PHPWord_IOFactory::createWriter($oPHPWord, 'Word2007'), new PHPWord_Writer_Word2007($oPHPWord));
} }
} }

View File

@ -25,4 +25,4 @@ class MediaTest extends \PHPUnit_Framework_TestCase
{ {
$this->assertAttributeEquals(PHPWord_Media::getFooterMediaElements(), '_footerMedia', 'PHPWord_Media'); $this->assertAttributeEquals(PHPWord_Media::getFooterMediaElements(), '_footerMedia', 'PHPWord_Media');
} }
} }

View File

@ -30,4 +30,4 @@ class PreserveTextTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('PHPWord_Style_Font', $oPreserveText->getFontStyle()); $this->assertInstanceOf('PHPWord_Style_Font', $oPreserveText->getFontStyle());
$this->assertInstanceOf('PHPWord_Style_Paragraph', $oPreserveText->getParagraphStyle()); $this->assertInstanceOf('PHPWord_Style_Paragraph', $oPreserveText->getParagraphStyle());
} }
} }

View File

@ -118,4 +118,4 @@ class FooterTest extends \PHPUnit_Framework_TestCase
$this->assertInternalType('array', $oFooter->getElements()); $this->assertInternalType('array', $oFooter->getElements());
} }
} }

View File

@ -61,4 +61,4 @@ class FootnoteTest extends \PHPUnit_Framework_TestCase
$oFootnote = new PHPWord_Section_Footnote(); $oFootnote = new PHPWord_Section_Footnote();
$this->assertInternalType('array', $oFootnote->getElements()); $this->assertInternalType('array', $oFootnote->getElements());
} }
} }

View File

@ -161,4 +161,4 @@ class HeaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($oHeader->getType(), PHPWord_Section_Header::EVEN); $this->assertEquals($oHeader->getType(), PHPWord_Section_Header::EVEN);
} }
} }

View File

@ -65,4 +65,4 @@ class ImageTest extends \PHPUnit_Framework_TestCase
$oImage->setIsWatermark(true); $oImage->setIsWatermark(true);
$this->assertEquals($oImage->getIsWatermark(), true); $this->assertEquals($oImage->getIsWatermark(), true);
} }
} }

View File

@ -45,4 +45,4 @@ class LinkTest extends \PHPUnit_Framework_TestCase
$oLink->setRelationId($iVal); $oLink->setRelationId($iVal);
$this->assertEquals($oLink->getRelationId(), $iVal); $this->assertEquals($oLink->getRelationId(), $iVal);
} }
} }

View File

@ -29,4 +29,4 @@ class ListItemTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($oListItem->getDepth(), $iVal); $this->assertEquals($oListItem->getDepth(), $iVal);
} }
} }

View File

@ -92,4 +92,4 @@ class MemoryImageTest extends \PHPUnit_Framework_TestCase
$oMemoryImage->setRelationId($iVal); $oMemoryImage->setRelationId($iVal);
$this->assertEquals($oMemoryImage->getRelationId(), $iVal); $this->assertEquals($oMemoryImage->getRelationId(), $iVal);
} }
} }

View File

@ -83,4 +83,4 @@ class ObjectTest extends \PHPUnit_Framework_TestCase
$oObject->setObjectId($iVal); $oObject->setObjectId($iVal);
$this->assertEquals($oObject->getObjectId(), $iVal); $this->assertEquals($oObject->getObjectId(), $iVal);
} }
} }

View File

@ -16,4 +16,4 @@ class PageBreakTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('PHPWord_Section_PageBreak', $oPageBreak); $this->assertInstanceOf('PHPWord_Section_PageBreak', $oPageBreak);
} }
} }

View File

@ -233,4 +233,4 @@ class SettingsTest extends \PHPUnit_Framework_TestCase
$oSettings->setBreakType(); $oSettings->setBreakType();
$this->assertNull($oSettings->getBreakType()); $this->assertNull($oSettings->getBreakType());
} }
} }

View File

@ -201,4 +201,4 @@ class CellTest extends \PHPUnit_Framework_TestCase
$this->assertInternalType('array', $oCell->getElements()); $this->assertInternalType('array', $oCell->getElements());
} }
} }

View File

@ -36,4 +36,4 @@ class RowTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('PHPWord_Section_Table_Cell', $element); $this->assertInstanceOf('PHPWord_Section_Table_Cell', $element);
$this->assertCount(1, $oRow->getCells()); $this->assertCount(1, $oRow->getCells());
} }
} }

View File

@ -54,4 +54,4 @@ class TableTest extends \PHPUnit_Framework_TestCase
$element = $oTable->addCell(); $element = $oTable->addCell();
$this->assertInstanceOf('PHPWord_Section_Table_Cell', $element); $this->assertInstanceOf('PHPWord_Section_Table_Cell', $element);
} }
} }

View File

@ -16,4 +16,4 @@ class TextBreakTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('PHPWord_Section_TextBreak', $oTextBreak); $this->assertInstanceOf('PHPWord_Section_TextBreak', $oTextBreak);
} }
} }

View File

@ -95,4 +95,4 @@ class TextRunTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('PHPWord_Section_Footnote', $element); $this->assertInstanceOf('PHPWord_Section_Footnote', $element);
$this->assertCount(1, $oTextRun->getElements()); $this->assertCount(1, $oTextRun->getElements());
} }
} }

View File

@ -40,4 +40,4 @@ class TextTest extends \PHPUnit_Framework_TestCase
$oText->setParagraphStyle(array('align' => 'center', 'spaceAfter' => 100)); $oText->setParagraphStyle(array('align' => 'center', 'spaceAfter' => 100));
$this->assertInstanceOf('PHPWord_Style_Paragraph', $oText->getParagraphStyle()); $this->assertInstanceOf('PHPWord_Style_Paragraph', $oText->getParagraphStyle());
} }
} }

View File

@ -45,4 +45,4 @@ class TitleTest extends \PHPUnit_Framework_TestCase
$oTitle->setBookmarkId($iVal); $oTitle->setBookmarkId($iVal);
$this->assertEquals($oTitle->getBookmarkId(), $iVal); $this->assertEquals($oTitle->getBookmarkId(), $iVal);
} }
} }

View File

@ -35,4 +35,4 @@ class SectionTest extends \PHPUnit_Framework_TestCase
$oSection = new PHPWord_Section(0); $oSection = new PHPWord_Section(0);
$this->assertAttributeEquals($oSection->getElements(), '_elementCollection', new PHPWord_Section(0)); $this->assertAttributeEquals($oSection->getElements(), '_elementCollection', new PHPWord_Section(0));
} }
} }

View File

@ -12,7 +12,6 @@ use PHPWord_Shared_Drawing;
*/ */
class DrawingTest extends \PHPUnit_Framework_TestCase class DrawingTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* Test unit conversion functions with various numbers * Test unit conversion functions with various numbers
*/ */
@ -65,5 +64,4 @@ class DrawingTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($value[1], $result); $this->assertEquals($value[1], $result);
} }
} }
}
}

View File

@ -12,13 +12,13 @@ use PHPWord_Shared_File;
*/ */
class FileTest extends \PHPUnit_Framework_TestCase class FileTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* Test file_exists() * Test file_exists()
*/ */
public function testFile_exists() public function testFileExists()
{ {
$dir = join(DIRECTORY_SEPARATOR, $dir = join(
DIRECTORY_SEPARATOR,
array(PHPWORD_TESTS_DIR_ROOT, '_files', 'templates') array(PHPWORD_TESTS_DIR_ROOT, '_files', 'templates')
); );
chdir($dir); chdir($dir);
@ -30,12 +30,13 @@ class FileTest extends \PHPUnit_Framework_TestCase
*/ */
public function testRealpath() public function testRealpath()
{ {
$dir = join(DIRECTORY_SEPARATOR, $dir = join(
array(PHPWORD_TESTS_DIR_ROOT, '_files', 'templates')); DIRECTORY_SEPARATOR,
array(PHPWORD_TESTS_DIR_ROOT, '_files', 'templates')
);
chdir($dir); chdir($dir);
$file = 'blank.docx'; $file = 'blank.docx';
$expected = $dir . DIRECTORY_SEPARATOR . $file; $expected = $dir . DIRECTORY_SEPARATOR . $file;
$this->assertEquals($expected, PHPWord_Shared_File::realpath($file)); $this->assertEquals($expected, PHPWord_Shared_File::realpath($file));
} }
} }

View File

@ -43,4 +43,4 @@ class FontTest extends \PHPUnit_Framework_TestCase
$result = PHPWord_Shared_Font::pointSizeToTwips($original); $result = PHPWord_Shared_Font::pointSizeToTwips($original);
$this->assertEquals($original * 20, $result); $this->assertEquals($original * 20, $result);
} }
} }

View File

@ -12,7 +12,6 @@ use PHPWord_Shared_String;
*/ */
class StringTest extends \PHPUnit_Framework_TestCase class StringTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* Test getIsMbstringEnabled() and getIsIconvEnabled() * Test getIsMbstringEnabled() and getIsIconvEnabled()
*/ */
@ -41,5 +40,4 @@ class StringTest extends \PHPUnit_Framework_TestCase
$returned = PHPWord_Shared_String::FormatNumber('1022.1234'); $returned = PHPWord_Shared_String::FormatNumber('1022.1234');
$this->assertEquals($expected, $returned); $this->assertEquals($expected, $returned);
} }
} }

View File

@ -12,7 +12,6 @@ use PHPWord_Style_Cell;
*/ */
class CellTest extends \PHPUnit_Framework_TestCase class CellTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* Test setting style with normal value * Test setting style with normal value
*/ */
@ -75,4 +74,4 @@ class CellTest extends \PHPUnit_Framework_TestCase
$object->setStyleValue('_borderSize', $value); $object->setStyleValue('_borderSize', $value);
$this->assertEquals($expected, $object->getBorderSize()); $this->assertEquals($expected, $object->getBorderSize());
} }
} }

View File

@ -114,4 +114,4 @@ class FontTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(720, $lineHeight); $this->assertEquals(720, $lineHeight);
$this->assertEquals('auto', $lineRule); $this->assertEquals('auto', $lineRule);
} }
} }

View File

@ -12,7 +12,6 @@ use PHPWord_Style_Image;
*/ */
class ImageTest extends \PHPUnit_Framework_TestCase class ImageTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* Test setting style with normal value * Test setting style with normal value
*/ */
@ -67,5 +66,4 @@ class ImageTest extends \PHPUnit_Framework_TestCase
$object = new PHPWord_Style_Image(); $object = new PHPWord_Style_Image();
$object->setWrappingStyle('foo'); $object->setWrappingStyle('foo');
} }
}
}

View File

@ -12,7 +12,6 @@ use PHPWord_Style_ListItem;
*/ */
class ListItemTest extends \PHPUnit_Framework_TestCase class ListItemTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* Test construct * Test construct
*/ */
@ -47,5 +46,4 @@ class ListItemTest extends \PHPUnit_Framework_TestCase
$object->setListType($value); $object->setListType($value);
$this->assertEquals($value, $object->getListType()); $this->assertEquals($value, $object->getListType());
} }
}
}

View File

@ -133,5 +133,4 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase
$object->setLineHeight('12.5pt'); $object->setLineHeight('12.5pt');
$this->assertEquals(12.5, $object->getLineHeight()); $this->assertEquals(12.5, $object->getLineHeight());
} }
}
}

View File

@ -12,7 +12,6 @@ use PHPWord_Style_Row;
*/ */
class RowTest extends \PHPUnit_Framework_TestCase class RowTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* Test properties with normal value * Test properties with normal value
*/ */
@ -39,5 +38,4 @@ class RowTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $object->$get()); $this->assertEquals($expected, $object->$get());
} }
} }
} }

View File

@ -12,7 +12,6 @@ use PHPWord_Style_TOC;
*/ */
class TOCTest extends \PHPUnit_Framework_TestCase class TOCTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* Test properties with normal value * Test properties with normal value
*/ */
@ -37,5 +36,4 @@ class TOCTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(null, $object->$get()); $this->assertEquals(null, $object->$get());
} }
} }
} }

View File

@ -12,7 +12,6 @@ use PHPWord_Style_TableFull;
*/ */
class TableFullTest extends \PHPUnit_Framework_TestCase class TableFullTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* Test class construction * Test class construction
* *
@ -132,5 +131,4 @@ class TableFullTest extends \PHPUnit_Framework_TestCase
} }
$this->assertEquals($values, $object->getCellMargin()); $this->assertEquals($values, $object->getCellMargin());
} }
} }

View File

@ -12,7 +12,6 @@ use PHPWord_Style_Table;
*/ */
class TableTest extends \PHPUnit_Framework_TestCase class TableTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* Test set style value * Test set style value
*/ */
@ -50,5 +49,4 @@ class TableTest extends \PHPUnit_Framework_TestCase
} }
$this->assertEquals($values, $object->getCellMargin()); $this->assertEquals($values, $object->getCellMargin());
} }
} }

View File

@ -42,5 +42,4 @@ class TabsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(1440, $element->getAttribute('w:pos')); $this->assertEquals(1440, $element->getAttribute('w:pos'));
$this->assertEquals('dot', $element->getAttribute('w:leader')); $this->assertEquals('dot', $element->getAttribute('w:leader'));
} }
} }

View File

@ -115,4 +115,4 @@ class TemplateTest extends \PHPUnit_Framework_TestCase
*/ */
@$template->applyXslStyleSheet($xslDOMDocument); @$template->applyXslStyleSheet($xslDOMDocument);
} }
} }

View File

@ -20,7 +20,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase
TestHelperDOCX::clear(); TestHelperDOCX::clear();
} }
public function testWriteImage_Position() public function testWriteImagePosition()
{ {
$PHPWord = new PHPWord(); $PHPWord = new PHPWord();
$section = $PHPWord->createSection(); $section = $PHPWord->createSection();
@ -42,7 +42,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase
$this->assertRegExp('/position:absolute;/', $style); $this->assertRegExp('/position:absolute;/', $style);
} }
public function testWriteParagraphStyle_Align() public function testWriteParagraphStyleAlign()
{ {
$PHPWord = new PHPWord(); $PHPWord = new PHPWord();
$section = $PHPWord->createSection(); $section = $PHPWord->createSection();
@ -55,34 +55,10 @@ class BaseTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('right', $element->getAttribute('w:val')); $this->assertEquals('right', $element->getAttribute('w:val'));
} }
public function testWriteCellStyle_CellGridSpan()
{
$PHPWord = new PHPWord();
$section = $PHPWord->createSection();
$table = $section->addTable();
$table->addRow();
$cell = $table->addCell(200);
$cell->getStyle()->setGridSpan(5);
$table->addRow();
$table->addCell(40);
$table->addCell(40);
$table->addCell(40);
$table->addCell(40);
$table->addCell(40);
$doc = TestHelperDOCX::getDocument($PHPWord);
$element = $doc->getElement('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:gridSpan');
$this->assertEquals(5, $element->getAttribute('w:val'));
}
/** /**
* Test write paragraph pagination * Test write paragraph pagination
*/ */
public function testWriteParagraphStyle_Pagination() public function testWriteParagraphStylePagination()
{ {
// Create the doc // Create the doc
$PHPWord = new PHPWord(); $PHPWord = new PHPWord();
@ -108,4 +84,28 @@ class BaseTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $element->getAttribute('w:val')); $this->assertEquals($expected, $element->getAttribute('w:val'));
} }
} }
public function testWriteCellStyleCellGridSpan()
{
$PHPWord = new PHPWord();
$section = $PHPWord->createSection();
$table = $section->addTable();
$table->addRow();
$cell = $table->addCell(200);
$cell->getStyle()->setGridSpan(5);
$table->addRow();
$table->addCell(40);
$table->addCell(40);
$table->addCell(40);
$table->addCell(40);
$table->addCell(40);
$doc = TestHelperDOCX::getDocument($PHPWord);
$element = $doc->getElement('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:gridSpan');
$this->assertEquals(5, $element->getAttribute('w:val'));
}
} }

View File

@ -22,7 +22,7 @@ class DocumentTest extends \PHPUnit_Framework_TestCase
TestHelperDOCX::clear(); TestHelperDOCX::clear();
} }
public function testWriteEndSection_PageNumbering() public function testWriteEndSectionPageNumbering()
{ {
$PHPWord = new PHPWord(); $PHPWord = new PHPWord();
$section = $PHPWord->createSection(); $section = $PHPWord->createSection();
@ -33,4 +33,4 @@ class DocumentTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(2, $element->getAttribute('w:start')); $this->assertEquals(2, $element->getAttribute('w:start'));
} }
} }

View File

@ -51,4 +51,4 @@ class StylesTest extends \PHPUnit_Framework_TestCase
$element = $doc->getElement($path, $file); $element = $doc->getElement($path, $file);
$this->assertEquals('Normal', $element->getAttribute('w:val')); $this->assertEquals('Normal', $element->getAttribute('w:val'));
} }
} }

View File

@ -15,8 +15,8 @@ class TestHelperDOCX
public static function getDocument(PHPWord $PHPWord) public static function getDocument(PHPWord $PHPWord)
{ {
self::$file = tempnam(sys_get_temp_dir(), 'PHPWord'); self::$file = tempnam(sys_get_temp_dir(), 'PHPWord');
if(!is_dir(sys_get_temp_dir().'/PHPWord_Unit_Test/')){ if (!is_dir(sys_get_temp_dir() . '/PHPWord_Unit_Test/')) {
mkdir(sys_get_temp_dir().'/PHPWord_Unit_Test/'); mkdir(sys_get_temp_dir() . '/PHPWord_Unit_Test/');
} }
$objWriter = \PHPWord_IOFactory::createWriter($PHPWord, 'Word2007'); $objWriter = \PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
@ -29,16 +29,16 @@ class TestHelperDOCX
$zip->close(); $zip->close();
} }
return new Xml_Document(sys_get_temp_dir().'/PHPWord_Unit_Test/'); return new Xml_Document(sys_get_temp_dir() . '/PHPWord_Unit_Test/');
} }
public static function clear() public static function clear()
{ {
if(file_exists(self::$file)){ if (file_exists(self::$file)) {
unlink(self::$file); unlink(self::$file);
} }
if(is_dir(sys_get_temp_dir().'/PHPWord_Unit_Test/')){ if (is_dir(sys_get_temp_dir() . '/PHPWord_Unit_Test/')) {
self::deleteDir(sys_get_temp_dir().'/PHPWord_Unit_Test/'); self::deleteDir(sys_get_temp_dir() . '/PHPWord_Unit_Test/');
} }
} }
@ -94,9 +94,9 @@ class Xml_Document
} }
$this->xpath = null; $this->xpath = null;
$this->file = $file; $this->file = $file;
$file = $this->path . '/' . $file; $file = $this->path . '/' . $file;
$this->dom = new DOMDocument(); $this->dom = new DOMDocument();
$this->dom->load($file); $this->dom->load($file);
return $this->dom; return $this->dom;
@ -121,4 +121,4 @@ class Xml_Document
$elements = $this->xpath->query($path); $elements = $this->xpath->query($path);
return $elements->item(0); return $elements->item(0);
} }
} }