From 2f0438ff15605c118e3c7edd537d3d041d386dc7 Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Thu, 13 Mar 2014 02:08:31 +0700 Subject: [PATCH] Change all remaining `trigger_error()` into `throw new Exception()` --- Classes/PHPWord/Section/Footer.php | 4 ++-- Classes/PHPWord/Section/Header.php | 6 +++--- Classes/PHPWord/Section/Table/Cell.php | 10 +++++----- Classes/PHPWord/Section/TextRun.php | 2 +- Classes/PHPWord/Template.php | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Classes/PHPWord/Section/Footer.php b/Classes/PHPWord/Section/Footer.php index 04d40f33..3455adc9 100755 --- a/Classes/PHPWord/Section/Footer.php +++ b/Classes/PHPWord/Section/Footer.php @@ -133,7 +133,7 @@ class PHPWord_Section_Footer $this->_elementCollection[] = $image; return $image; } else { - trigger_error('Src does not exist or invalid image type.', E_USER_ERROR); + throw new Exception('Src does not exist or invalid image type.'); } } @@ -154,7 +154,7 @@ class PHPWord_Section_Footer $this->_elementCollection[] = $memoryImage; return $memoryImage; } else { - trigger_error('Unsupported image type.'); + throw new Exception('Unsupported image type.'); } } diff --git a/Classes/PHPWord/Section/Header.php b/Classes/PHPWord/Section/Header.php index 6c624406..83c82c49 100755 --- a/Classes/PHPWord/Section/Header.php +++ b/Classes/PHPWord/Section/Header.php @@ -162,7 +162,7 @@ class PHPWord_Section_Header $this->_elementCollection[] = $image; return $image; } else { - trigger_error('Src does not exist or invalid image type.', E_USER_ERROR); + throw new Exception('Src does not exist or invalid image type.'); } } @@ -183,7 +183,7 @@ class PHPWord_Section_Header $this->_elementCollection[] = $memoryImage; return $memoryImage; } else { - trigger_error('Unsupported image type.'); + throw new Exception('Unsupported image type.'); } } @@ -223,7 +223,7 @@ class PHPWord_Section_Header $this->_elementCollection[] = $image; return $image; } else { - trigger_error('Src does not exist or invalid image type.', E_USER_ERROR); + throw new Exception('Src does not exist or invalid image type.'); } } diff --git a/Classes/PHPWord/Section/Table/Cell.php b/Classes/PHPWord/Section/Table/Cell.php index 4f8f78fe..898c6bf2 100755 --- a/Classes/PHPWord/Section/Table/Cell.php +++ b/Classes/PHPWord/Section/Table/Cell.php @@ -140,7 +140,7 @@ class PHPWord_Section_Table_Cell $this->_elementCollection[] = $link; return $link; } else { - trigger_error('Unsupported Link header / footer reference'); + throw new Exception('Unsupported Link header / footer reference'); return false; } } @@ -198,7 +198,7 @@ class PHPWord_Section_Table_Cell $this->_elementCollection[] = $image; return $image; } else { - trigger_error('Source does not exist or unsupported image type.'); + throw new Exception('Source does not exist or unsupported image type.'); } } @@ -225,7 +225,7 @@ class PHPWord_Section_Table_Cell $this->_elementCollection[] = $memoryImage; return $memoryImage; } else { - trigger_error('Unsupported image type.'); + throw new Exception('Unsupported image type.'); } } @@ -266,7 +266,7 @@ class PHPWord_Section_Table_Cell $this->_elementCollection[] = $object; return $object; } else { - trigger_error('Source does not exist or unsupported object type.'); + throw new Exception('Source does not exist or unsupported object type.'); } } @@ -288,7 +288,7 @@ class PHPWord_Section_Table_Cell $this->_elementCollection[] = $ptext; return $ptext; } else { - trigger_error('addPreserveText only supported in footer/header.'); + throw new Exception('addPreserveText only supported in footer/header.'); } } diff --git a/Classes/PHPWord/Section/TextRun.php b/Classes/PHPWord/Section/TextRun.php index c26b2ef6..eeb936a0 100755 --- a/Classes/PHPWord/Section/TextRun.php +++ b/Classes/PHPWord/Section/TextRun.php @@ -127,7 +127,7 @@ class PHPWord_Section_TextRun $this->_elementCollection[] = $image; return $image; } else { - trigger_error('Source does not exist or unsupported image type.'); + throw new Exception('Source does not exist or unsupported image type.'); } } diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index 4d356dd3..840d2295 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -164,7 +164,7 @@ class PHPWord_Template $rowStart = strrpos($this->_documentXML, "", ((strlen($this->_documentXML) - $offset) * -1)); } if (!$rowStart) { - trigger_error("Can not find the start position of the row to clone."); + throw new Exception("Can not find the start position of the row to clone."); return false; } return $rowStart; @@ -208,7 +208,7 @@ class PHPWord_Template $tagPos = strpos($this->_documentXML, $search); if (!$tagPos) { - trigger_error("Can not clone row, template variable not found or variable contains markup."); + throw new Exception("Can not clone row, template variable not found or variable contains markup."); return false; }