Skip to content

Commit 4e3450e

Browse files
committed
Code formatting for PSR1 & PSR2 - Part 1
1 parent ec514f3 commit 4e3450e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+541
-479
lines changed

Classes/PHPWord.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,4 +267,4 @@ public function loadTemplate($strFilename)
267267
trigger_error('Template file ' . $strFilename . ' not found.', E_USER_ERROR);
268268
}
269269
}
270-
}
270+
}

Classes/PHPWord/Autoloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ public static function autoload($class)
8282
}
8383
}
8484
}
85-
}
85+
}

Classes/PHPWord/DocumentProperties.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,4 +343,4 @@ public function setCompany($pValue = '')
343343
$this->_company = $pValue;
344344
return $this;
345345
}
346-
}
346+
}

Classes/PHPWord/Exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ public static function errorHandlerCallback($code, $string, $file, $line, $conte
4646
$e->file = $file;
4747
throw $e;
4848
}
49-
}
49+
}

Classes/PHPWord/Exceptions/InvalidStyleException.php

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

Classes/PHPWord/Footnote.php

Lines changed: 96 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -33,93 +33,99 @@
3333
* @package PHPWord
3434
* @copyright Copyright (c) 2011 PHPWord
3535
*/
36-
class PHPWord_Footnote {
37-
38-
/**
39-
* Footnote Elements
40-
*
41-
* @var array
42-
*/
43-
private static $_footnoteCollection = array();
44-
45-
/**
46-
* Footnote Link Elements
47-
*
48-
* @var array
49-
*/
50-
private static $_footnoteLink = array();
51-
52-
/**
53-
* Add new Footnote Element
54-
*
55-
* @param string $linkSrc
56-
* @param string $linkName
57-
*
58-
* @return mixed
59-
*/
60-
public static function addFootnoteElement(PHPWord_Section_Footnote $footnote) {
61-
$refID = self::countFootnoteElements() + 2;
62-
63-
self::$_footnoteCollection[] = $footnote;
64-
65-
return $refID;
66-
}
67-
68-
/**
69-
* Get Footnote Elements
70-
*
71-
* @return array
72-
*/
73-
public static function getFootnoteElements() {
74-
return self::$_footnoteCollection;
75-
}
76-
77-
/**
78-
* Get Footnote Elements Count
79-
*
80-
* @return int
81-
*/
82-
public static function countFootnoteElements() {
83-
return count(self::$_footnoteCollection);
84-
}
85-
86-
/**
87-
* Add new Footnote Link Element
88-
*
89-
* @param string $src
90-
* @param string $type
91-
*
92-
* @return mixed
93-
*/
94-
public static function addFootnoteLinkElement($linkSrc) {
95-
$rID = self::countFootnoteLinkElements() + 1;
96-
97-
$link = array();
98-
$link['target'] = $linkSrc;
99-
$link['rID'] = $rID;
100-
$link['type'] = 'hyperlink';
101-
102-
self::$_footnoteLink[] = $link;
103-
104-
return $rID;
105-
}
106-
107-
/**
108-
* Get Footnote Link Elements
109-
*
110-
* @return array
111-
*/
112-
public static function getFootnoteLinkElements() {
113-
return self::$_footnoteLink;
114-
}
115-
116-
/**
117-
* Get Footnote Link Elements Count
118-
*
119-
* @return int
120-
*/
121-
public static function countFootnoteLinkElements() {
122-
return count(self::$_footnoteLink);
123-
}
124-
125-
}
36+
class PHPWord_Footnote
37+
{
38+
39+
/**
40+
* Footnote Elements
41+
*
42+
* @var array
43+
*/
44+
private static $_footnoteCollection = array();
45+
46+
/**
47+
* Footnote Link Elements
48+
*
49+
* @var array
50+
*/
51+
private static $_footnoteLink = array();
52+
53+
/**
54+
* Add new Footnote Element
55+
*
56+
* @param string $linkSrc
57+
* @param string $linkName
58+
*
59+
* @return mixed
60+
*/
61+
public static function addFootnoteElement(PHPWord_Section_Footnote $footnote)
62+
{
63+
$refID = self::countFootnoteElements() + 2;
64+
65+
self::$_footnoteCollection[] = $footnote;
66+
67+
return $refID;
68+
}
69+
70+
/**
71+
* Get Footnote Elements
72+
*
73+
* @return array
74+
*/
75+
public static function getFootnoteElements()
76+
{
77+
return self::$_footnoteCollection;
78+
}
79+
80+
/**
81+
* Get Footnote Elements Count
82+
*
83+
* @return int
84+
*/
85+
public static function countFootnoteElements()
86+
{
87+
return count(self::$_footnoteCollection);
88+
}
89+
90+
/**
91+
* Add new Footnote Link Element
92+
*
93+
* @param string $src
94+
* @param string $type
95+
*
96+
* @return mixed
97+
*/
98+
public static function addFootnoteLinkElement($linkSrc)
99+
{
100+
$rID = self::countFootnoteLinkElements() + 1;
101+
102+
$link = array();
103+
$link['target'] = $linkSrc;
104+
$link['rID'] = $rID;
105+
$link['type'] = 'hyperlink';
106+
107+
self::$_footnoteLink[] = $link;
108+
109+
return $rID;
110+
}
111+
112+
/**
113+
* Get Footnote Link Elements
114+
*
115+
* @return array
116+
*/
117+
public static function getFootnoteLinkElements()
118+
{
119+
return self::$_footnoteLink;
120+
}
121+
122+
/**
123+
* Get Footnote Link Elements Count
124+
*
125+
* @return int
126+
*/
127+
public static function countFootnoteLinkElements()
128+
{
129+
return count(self::$_footnoteLink);
130+
}
131+
}

Classes/PHPWord/IOFactory.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,16 @@ public static function createWriter(PHPWord $PHPWord, $writerType = '')
126126
* @param string $readerType Example: Word2007
127127
* @return PHPWord_Reader_IReader
128128
*/
129-
public static function createReader($readerType = '') {
129+
public static function createReader($readerType = '')
130+
{
130131
$searchType = 'IReader';
131132

132133
foreach (self::$_searchLocations as $searchLocation) {
133134
if ($searchLocation['type'] == $searchType) {
134135
$className = str_replace('{0}', $readerType, $searchLocation['class']);
135136

136137
$instance = new $className();
137-
if ($instance !== NULL) {
138+
if ($instance !== null) {
138139
return $instance;
139140
}
140141
}
@@ -149,9 +150,9 @@ public static function createReader($readerType = '') {
149150
* @param string $pFilename The name of the file
150151
* @return PHPWord
151152
*/
152-
public static function load($pFilename, $readerType = 'Word2007') {
153+
public static function load($pFilename, $readerType = 'Word2007')
154+
{
153155
$reader = self::createReader($readerType);
154156
return $reader->load($pFilename);
155157
}
156-
157158
}

Classes/PHPWord/Media.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,4 +330,3 @@ public static function getFooterMediaElements()
330330
return self::$_footerMedia;
331331
}
332332
}
333-

Classes/PHPWord/Reader/Abstract.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,20 @@ abstract class PHPWord_Reader_Abstract implements PHPWord_Reader_IReader
3636
*
3737
* @var boolean
3838
*/
39-
protected $readDataOnly = TRUE;
39+
protected $readDataOnly = true;
4040

41-
protected $fileHandle = NULL;
41+
protected $fileHandle = true;
4242

4343

4444
/**
4545
* Read data only?
4646
*
4747
* @return boolean
4848
*/
49-
public function getReadDataOnly() {
49+
public function getReadDataOnly()
50+
{
5051
// return $this->readDataOnly;
51-
return TRUE;
52+
return true;
5253
}
5354

5455
/**
@@ -57,7 +58,8 @@ public function getReadDataOnly() {
5758
* @param boolean $pValue
5859
* @return PHPWord_Reader_IReader
5960
*/
60-
public function setReadDataOnly($pValue = TRUE) {
61+
public function setReadDataOnly($pValue = true)
62+
{
6163
$this->readDataOnly = $pValue;
6264
return $this;
6365
}
@@ -78,7 +80,7 @@ protected function openFile($pFilename)
7880

7981
// Open file
8082
$this->fileHandle = fopen($pFilename, 'r');
81-
if ($this->fileHandle === FALSE) {
83+
if ($this->fileHandle === false) {
8284
throw new PHPWord_Exception("Could not open file " . $pFilename . " for reading.");
8385
}
8486
}
@@ -96,10 +98,9 @@ public function canRead($pFilename)
9698
try {
9799
$this->openFile($pFilename);
98100
} catch (Exception $e) {
99-
return FALSE;
101+
return false;
100102
}
101-
fclose ($this->fileHandle);
103+
fclose($this->fileHandle);
102104
return $readable;
103105
}
104-
105106
}

0 commit comments

Comments
 (0)