Skip to content

Commit fa2878e

Browse files
committed
Cleaning up code
1 parent cf790b9 commit fa2878e

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Classes/PHPWord/IOFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class PHPWord_IOFactory
3838
*/
3939
private static $_searchLocations = array(
4040
array('type' => 'IWriter', 'path' => 'PHPWord/Writer/{0}.php', 'class' => 'PHPWord_Writer_{0}'),
41-
array( 'type' => 'IReader', 'path' => 'PHPWord/Reader/{0}.php', 'class' => 'PHPWord_Reader_{0}' ),
41+
array('type' => 'IReader', 'path' => 'PHPWord/Reader/{0}.php', 'class' => 'PHPWord_Reader_{0}' ),
4242
);
4343

4444
/**
@@ -140,7 +140,7 @@ public static function createReader($readerType = '') {
140140
}
141141
}
142142

143-
throw new PHPExcel_Reader_Exception("No $searchType found for type $readerType");
143+
throw new PHPWord_Exception("No $searchType found for type $readerType");
144144
}
145145

146146
/**

Classes/PHPWord/Reader/Word2007.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public function __construct() {
4848
* Can the current PHPWord_Reader_IReader read the file?
4949
*
5050
* @param string $pFilename
51-
* @return boolean
52-
* @throws PHPWord_Exception
51+
* @return bool
5352
*/
5453
public function canRead($pFilename)
5554
{
@@ -117,6 +116,7 @@ public function getFromZipArchive($archive, $fileName = '')
117116
* Loads PHPWord from file
118117
*
119118
* @param string $pFilename
119+
* @return PHPWord
120120
*/
121121
public function load($pFilename)
122122
{
@@ -189,7 +189,8 @@ public function load($pFilename)
189189
$archive = "$dir/_rels/" . basename($rel["Target"]) . ".rels";
190190
$relsDoc = simplexml_load_string($this->getFromZipArchive($zip, $archive));
191191
$relsDoc->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006//relationships");
192-
$xpath = self::array_item($relsDoc->xpath("rel:Relationship[@Type='" . "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
192+
$xpath = self::array_item($relsDoc->xpath("rel:Relationship[@Type='" .
193+
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
193194
$xmlDoc = simplexml_load_string($this->getFromZipArchive($zip, "{$rel['Target']}"));
194195
if ($xmlDoc->body) {
195196
$section = $word->createSection();
@@ -219,12 +220,18 @@ public function load($pFilename)
219220
break;
220221
}
221222
}
222-
223223
$zip->close();
224224

225225
return $word;
226226
}
227227

228+
/**
229+
* Get array item
230+
*
231+
* @param array $array
232+
* @param mixed $key
233+
* @return mixed|null
234+
*/
228235
private static function array_item($array, $key = 0) {
229236
return (isset($array[$key]) ? $array[$key] : null);
230237
}

0 commit comments

Comments
 (0)