From 0285c3e4280f88fa136f21f24ca251b0bbeb189e Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Thu, 2 Feb 2012 10:27:14 +0000 Subject: [PATCH] Inline documentation changes git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@85955 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Reader/Excel2003XML.php | 7 ++++--- Classes/PHPExcel/Reader/Excel2007.php | 19 ++++++++++--------- Classes/PHPExcel/Reader/Gnumeric.php | 17 +++++++++-------- Classes/PHPExcel/Reader/OOCalc.php | 17 +++++++++-------- Classes/PHPExcel/Reader/SYLK.php | 7 ++++--- 5 files changed, 36 insertions(+), 31 deletions(-) diff --git a/Classes/PHPExcel/Reader/Excel2003XML.php b/Classes/PHPExcel/Reader/Excel2003XML.php index 0f96c000..a25d0373 100644 --- a/Classes/PHPExcel/Reader/Excel2003XML.php +++ b/Classes/PHPExcel/Reader/Excel2003XML.php @@ -162,10 +162,11 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Can the current PHPExcel_Reader_IReader read the file? * - * @param string $pFileName - * @return boolean + * @param string $pFileName + * @return boolean + * @throws Exception */ public function canRead($pFilename) { diff --git a/Classes/PHPExcel/Reader/Excel2007.php b/Classes/PHPExcel/Reader/Excel2007.php index 07b9a853..061c22d0 100644 --- a/Classes/PHPExcel/Reader/Excel2007.php +++ b/Classes/PHPExcel/Reader/Excel2007.php @@ -177,30 +177,31 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Can the current PHPExcel_Reader_IReader read the file? * - * @param string $pFileName - * @return boolean + * @param string $pFileName + * @return boolean + * @throws Exception */ public function canRead($pFilename) { - // Check if zip class exists - if (!class_exists('ZipArchive')) { - return false; - } - // Check if file exists if (!file_exists($pFilename)) { throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); } + // Check if zip class exists + if (!class_exists('ZipArchive')) { + throw new Exception("ZipArchive library is not enabled"); + } + $xl = false; // Load file $zip = new ZipArchive; if ($zip->open($pFilename) === true) { // check if it is an OOXML archive $rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); - if ($rels) { + if ($rels !== false) { foreach ($rels->Relationship as $rel) { switch ($rel["Type"]) { case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument": diff --git a/Classes/PHPExcel/Reader/Gnumeric.php b/Classes/PHPExcel/Reader/Gnumeric.php index 7a946813..d151dcea 100644 --- a/Classes/PHPExcel/Reader/Gnumeric.php +++ b/Classes/PHPExcel/Reader/Gnumeric.php @@ -179,23 +179,24 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Can the current PHPExcel_Reader_IReader read the file? * - * @param string $pFileName - * @return boolean + * @param string $pFileName + * @return boolean + * @throws Exception */ public function canRead($pFilename) { - // Check if gzlib functions are available - if (!function_exists('gzread')) { - return false; - } - // Check if file exists if (!file_exists($pFilename)) { throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); } + // Check if gzlib functions are available + if (!function_exists('gzread')) { + throw new Exception("gzlib library is not enabled"); + } + // Read signature data (first 3 bytes) $fh = fopen($pFilename, 'r'); $data = fread($fh, 2); diff --git a/Classes/PHPExcel/Reader/OOCalc.php b/Classes/PHPExcel/Reader/OOCalc.php index 05657721..a3e193f0 100644 --- a/Classes/PHPExcel/Reader/OOCalc.php +++ b/Classes/PHPExcel/Reader/OOCalc.php @@ -169,23 +169,24 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Can the current PHPExcel_Reader_IReader read the file? * - * @param string $pFileName - * @return boolean + * @param string $pFileName + * @return boolean + * @throws Exception */ public function canRead($pFilename) { - // Check if zip class exists - if (!class_exists('ZipArchive')) { - return false; - } - // Check if file exists if (!file_exists($pFilename)) { throw new Exception("Could not open " . $pFilename . " for reading! File does not exist."); } + // Check if zip class exists + if (!class_exists('ZipArchive')) { + throw new Exception("ZipArchive library is not enabled"); + } + // Load file $zip = new ZipArchive; if ($zip->open($pFilename) === true) { diff --git a/Classes/PHPExcel/Reader/SYLK.php b/Classes/PHPExcel/Reader/SYLK.php index 97d98506..12a60168 100644 --- a/Classes/PHPExcel/Reader/SYLK.php +++ b/Classes/PHPExcel/Reader/SYLK.php @@ -87,10 +87,11 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader } /** - * Can the current PHPExcel_Reader_IReader read the file? + * Can the current PHPExcel_Reader_IReader read the file? * - * @param string $pFileName - * @return boolean + * @param string $pFileName + * @return boolean + * @throws Exception */ public function canRead($pFilename) {