Skip to content

Commit 92cfa12

Browse files
committed
Code formatting for PSR1 & PSR2 - Part 3
1 parent 46a0768 commit 92cfa12

16 files changed

+138
-134
lines changed

Classes/PHPWord/Exceptions/InvalidImageException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
*/
1313
class InvalidImageException extends Exception
1414
{
15-
}
15+
}

Classes/PHPWord/Exceptions/UnsupportedImageTypeException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
*/
1313
class UnsupportedImageTypeException extends Exception
1414
{
15-
}
15+
}

Tests/PHPWord/AutoloaderTest.php

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,35 @@ public function testRegister()
1616

1717
public function testAutoloadLegacy()
1818
{
19-
$this->assertNull(PHPWord_Autoloader::load('Foo'), 'PHPWord_Autoloader::load() is trying to load classes outside of the PHPWord namespace');
20-
$this->assertTrue(PHPWord_Autoloader::load('PHPWord'), 'PHPWord_Autoloader::load() failed to autoload the PHPWord class');
19+
$this->assertNull(
20+
PHPWord_Autoloader::load('Foo'),
21+
'PHPWord_Autoloader::load() is trying to load classes outside of the PHPWord namespace'
22+
);
23+
$this->assertTrue(
24+
PHPWord_Autoloader::load('PHPWord'),
25+
'PHPWord_Autoloader::load() failed to autoload the PHPWord class'
26+
);
2127
}
2228

2329
public function testAutoload()
2430
{
2531
$declared = get_declared_classes();
2632
$declaredCount = count($declared);
2733
Autoloader::autoload('Foo');
28-
$this->assertEquals($declaredCount, count(get_declared_classes()), 'PhpOffice\\PhpWord\\Autoloader::autoload() is trying to load classes outside of the PhpOffice\\PhpWord namespace');
29-
Autoloader::autoload('PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException'); // TODO change this class to the main PHPWord class when it is namespaced
30-
$this->assertTrue(in_array('PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException', get_declared_classes()), 'PhpOffice\\PhpWord\\Autoloader::autoload() failed to autoload the PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException class');
34+
$this->assertEquals(
35+
$declaredCount,
36+
count(get_declared_classes()),
37+
'PhpOffice\\PhpWord\\Autoloader::autoload() is trying to load classes ' .
38+
'outside of the PhpOffice\\PhpWord namespace'
39+
);
40+
// TODO change this class to the main PHPWord class when it is namespaced
41+
Autoloader::autoload(
42+
'PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException'
43+
);
44+
$this->assertTrue(
45+
in_array('PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException', get_declared_classes()),
46+
'PhpOffice\\PhpWord\\Autoloader::autoload() failed to autoload the ' .
47+
'PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException class'
48+
);
3149
}
3250
}

Tests/PHPWord/IOFactoryTest.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ class IOFactoryTest extends \PHPUnit_Framework_TestCase
1616
{
1717
public function testGetSearchLocations()
1818
{
19-
$this->assertAttributeEquals(PHPWord_IOFactory::getSearchLocations(), '_searchLocations', 'PHPWord_IOFactory');
19+
$this->assertAttributeEquals(
20+
PHPWord_IOFactory::getSearchLocations(),
21+
'_searchLocations',
22+
'PHPWord_IOFactory'
23+
);
2024
}
2125

2226
public function testSetSearchLocationsWithArray()
@@ -38,7 +42,11 @@ public function testAddSearchLocation()
3842
{
3943
PHPWord_IOFactory::setSearchLocations(array());
4044
PHPWord_IOFactory::addSearchLocation('type', 'location', 'classname');
41-
$this->assertAttributeEquals(array(array('type' => 'type', 'path' => 'location', 'class' => 'classname')), '_searchLocations', 'PHPWord_IOFactory');
45+
$this->assertAttributeEquals(
46+
array(array('type' => 'type', 'path' => 'location', 'class' => 'classname')),
47+
'_searchLocations',
48+
'PHPWord_IOFactory'
49+
);
4250
}
4351

4452
/**
@@ -57,6 +65,9 @@ public function testCreateWriter()
5765
{
5866
$oPHPWord = new PHPWord();
5967

60-
$this->assertEquals(PHPWord_IOFactory::createWriter($oPHPWord, 'Word2007'), new PHPWord_Writer_Word2007($oPHPWord));
68+
$this->assertEquals(
69+
PHPWord_IOFactory::createWriter($oPHPWord, 'Word2007'),
70+
new PHPWord_Writer_Word2007($oPHPWord)
71+
);
6172
}
6273
}

Tests/PHPWord/Section/Footer/PreserveTextTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ public function testConstructWithString()
2626

2727
public function testConstructWithArray()
2828
{
29-
$oPreserveText = new PHPWord_Section_Footer_PreserveText('text', array('align' => 'center'), array('marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600));
29+
$oPreserveText = new PHPWord_Section_Footer_PreserveText(
30+
'text',
31+
array('align' => 'center'),
32+
array('marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600)
33+
);
3034
$this->assertInstanceOf('PHPWord_Style_Font', $oPreserveText->getFontStyle());
3135
$this->assertInstanceOf('PHPWord_Style_Paragraph', $oPreserveText->getParagraphStyle());
3236
}

Tests/PHPWord/Section/FooterTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ public function testAddImage()
8787
public function testAddMemoryImage()
8888
{
8989
$oFooter = new PHPWord_Section_Footer(1);
90-
$element = $oFooter->addMemoryImage('https://assets.mozillalabs.com/Brands-Logos/Thunderbird/logo-only/thunderbird_logo-only_RGB.png');
90+
$element = $oFooter->addMemoryImage(
91+
'https://assets.mozillalabs.com/Brands-Logos/Thunderbird/logo-only/thunderbird_logo-only_RGB.png'
92+
);
9193

9294
$this->assertCount(1, $oFooter->getElements());
9395
$this->assertInstanceOf('PHPWord_Section_MemoryImage', $element);

Tests/PHPWord/Section/HeaderTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ public function testAddImage()
8383
public function testAddMemoryImage()
8484
{
8585
$oHeader = new PHPWord_Section_Header(1);
86-
$element = $oHeader->addMemoryImage('https://assets.mozillalabs.com/Brands-Logos/Thunderbird/logo-only/thunderbird_logo-only_RGB.png');
86+
$element = $oHeader->addMemoryImage(
87+
'https://assets.mozillalabs.com/Brands-Logos/Thunderbird/logo-only/thunderbird_logo-only_RGB.png'
88+
);
8789

8890
$this->assertCount(1, $oHeader->getElements());
8991
$this->assertInstanceOf('PHPWord_Section_MemoryImage', $element);

Tests/PHPWord/Section/ImageTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ public function testConstructWithStyle()
2828
\DIRECTORY_SEPARATOR,
2929
array(\PHPWORD_TESTS_DIR_ROOT, '_files', 'images', 'firefox.png')
3030
);
31-
$oImage = new PHPWord_Section_Image($src, array('width' => 210, 'height' => 210, 'align' => 'center', 'wrappingStyle' => \PHPWord_Style_Image::WRAPPING_STYLE_BEHIND));
31+
$oImage = new PHPWord_Section_Image(
32+
$src,
33+
array('width' => 210, 'height' => 210, 'align' => 'center',
34+
'wrappingStyle' => \PHPWord_Style_Image::WRAPPING_STYLE_BEHIND)
35+
);
3236

3337
$this->assertInstanceOf('PHPWord_Style_Image', $oImage->getStyle());
3438
}

Tests/PHPWord/Section/LinkTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ public function testConstructDefault()
2020

2121
public function testConstructWithParamsArray()
2222
{
23-
$oLink = new PHPWord_Section_Link('http://www.google.com', 'Search Engine', array('color' => '0000FF', 'underline' => PHPWord_Style_Font::UNDERLINE_SINGLE), array('marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600));
23+
$oLink = new PHPWord_Section_Link(
24+
'http://www.google.com',
25+
'Search Engine',
26+
array('color' => '0000FF', 'underline' => PHPWord_Style_Font::UNDERLINE_SINGLE),
27+
array('marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600)
28+
);
2429

2530
$this->assertInstanceOf('PHPWord_Section_Link', $oLink);
2631
$this->assertEquals($oLink->getLinkSrc(), 'http://www.google.com');

Tests/PHPWord/Section/ListItemTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ public function testText()
1616

1717
public function testStyle()
1818
{
19-
$oListItem = new PHPWord_Section_ListItem('text', 1, null, array('listType' => PHPWord_Style_ListItem::TYPE_NUMBER));
19+
$oListItem = new PHPWord_Section_ListItem(
20+
'text',
21+
1,
22+
null,
23+
array('listType' => PHPWord_Style_ListItem::TYPE_NUMBER)
24+
);
2025

2126
$this->assertInstanceOf('PHPWord_Style_ListItem', $oListItem->getStyle());
2227
$this->assertEquals($oListItem->getStyle()->getListType(), PHPWord_Style_ListItem::TYPE_NUMBER);

0 commit comments

Comments
 (0)