summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2015-01-20 19:23:42 +0100
committerFabio Bas <ctrlaltca@gmail.com>2015-01-20 19:23:42 +0100
commit103578448db0ce03ea231a10e8234b2d8cb27e34 (patch)
treed903ab3b16949fa3b75ec96718cf7c4547401932 /framework
parent169950e09cad0e69a7dcbcdabe7ef86086766483 (diff)
One class per file: framework/Exceptions/
Diffstat (limited to 'framework')
-rw-r--r--framework/Exceptions/TApplicationException.php23
-rw-r--r--framework/Exceptions/TConfigurationException.php24
-rw-r--r--framework/Exceptions/TDbConnectionException.php23
-rw-r--r--framework/Exceptions/TDbException.php23
-rw-r--r--framework/Exceptions/TException.php286
-rw-r--r--framework/Exceptions/THttpException.php58
-rw-r--r--framework/Exceptions/TIOException.php23
-rw-r--r--framework/Exceptions/TInvalidDataTypeException.php23
-rw-r--r--framework/Exceptions/TInvalidDataValueException.php23
-rw-r--r--framework/Exceptions/TInvalidOperationException.php23
-rw-r--r--framework/Exceptions/TNotSupportedException.php23
-rw-r--r--framework/Exceptions/TPhpErrorException.php50
-rw-r--r--framework/Exceptions/TSystemException.php23
-rw-r--r--framework/Exceptions/TTemplateException.php74
14 files changed, 414 insertions, 285 deletions
diff --git a/framework/Exceptions/TApplicationException.php b/framework/Exceptions/TApplicationException.php
new file mode 100644
index 00000000..9de434e0
--- /dev/null
+++ b/framework/Exceptions/TApplicationException.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+/**
+ * TApplicationException class
+ *
+ * TApplicationException is the base class for all user application-level exceptions.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.0
+ */
+class TApplicationException extends TException
+{
+} \ No newline at end of file
diff --git a/framework/Exceptions/TConfigurationException.php b/framework/Exceptions/TConfigurationException.php
new file mode 100644
index 00000000..e2506472
--- /dev/null
+++ b/framework/Exceptions/TConfigurationException.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+/**
+ * TConfigurationException class
+ *
+ * TConfigurationException represents an exception caused by invalid configurations,
+ * such as error in an application configuration file or control template file.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.0
+ */
+class TConfigurationException extends TSystemException
+{
+} \ No newline at end of file
diff --git a/framework/Exceptions/TDbConnectionException.php b/framework/Exceptions/TDbConnectionException.php
new file mode 100644
index 00000000..c39c6d8a
--- /dev/null
+++ b/framework/Exceptions/TDbConnectionException.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+/**
+ * TDbConnectionException class
+ *
+ * TDbConnectionException represents an exception caused by DB connection failure.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.0
+ */
+class TDbConnectionException extends TDbException
+{
+} \ No newline at end of file
diff --git a/framework/Exceptions/TDbException.php b/framework/Exceptions/TDbException.php
new file mode 100644
index 00000000..fe1d24f4
--- /dev/null
+++ b/framework/Exceptions/TDbException.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+/**
+ * TDbException class
+ *
+ * TDbException represents an exception related with DB operations.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.0
+ */
+class TDbException extends TSystemException
+{
+} \ No newline at end of file
diff --git a/framework/Exceptions/TException.php b/framework/Exceptions/TException.php
index 24dbdb0f..80dd01f1 100644
--- a/framework/Exceptions/TException.php
+++ b/framework/Exceptions/TException.php
@@ -122,288 +122,4 @@ class TException extends Exception
{
$this->message=$message;
}
-}
-
-/**
- * TSystemException class
- *
- * TSystemException is the base class for all framework-level exceptions.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.0
- */
-class TSystemException extends TException
-{
-}
-
-/**
- * TApplicationException class
- *
- * TApplicationException is the base class for all user application-level exceptions.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.0
- */
-class TApplicationException extends TException
-{
-}
-
-/**
- * TInvalidOperationException class
- *
- * TInvalidOperationException represents an exception caused by invalid operations.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.0
- */
-class TInvalidOperationException extends TSystemException
-{
-}
-
-/**
- * TInvalidDataTypeException class
- *
- * TInvalidDataTypeException represents an exception caused by invalid data type.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.0
- */
-class TInvalidDataTypeException extends TSystemException
-{
-}
-
-/**
- * TInvalidDataValueException class
- *
- * TInvalidDataValueException represents an exception caused by invalid data value.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.0
- */
-class TInvalidDataValueException extends TSystemException
-{
-}
-
-/**
- * TConfigurationException class
- *
- * TConfigurationException represents an exception caused by invalid configurations,
- * such as error in an application configuration file or control template file.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.0
- */
-class TConfigurationException extends TSystemException
-{
-}
-
-/**
- * TTemplateException class
- *
- * TTemplateException represents an exception caused by invalid template syntax.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.1
- */
-class TTemplateException extends TConfigurationException
-{
- private $_template='';
- private $_lineNumber=0;
- private $_fileName='';
-
- /**
- * @return string the template source code that causes the exception. This is empty if {@link getTemplateFile TemplateFile} is not empty.
- */
- public function getTemplateSource()
- {
- return $this->_template;
- }
-
- /**
- * @param string the template source code that causes the exception
- */
- public function setTemplateSource($value)
- {
- $this->_template=$value;
- }
-
- /**
- * @return string the template file that causes the exception. This could be empty if the template is an embedded template. In this case, use {@link getTemplateSource TemplateSource} to obtain the actual template content.
- */
- public function getTemplateFile()
- {
- return $this->_fileName;
- }
-
- /**
- * @param string the template file that causes the exception
- */
- public function setTemplateFile($value)
- {
- $this->_fileName=$value;
- }
-
- /**
- * @return integer the line number at which the template has error
- */
- public function getLineNumber()
- {
- return $this->_lineNumber;
- }
-
- /**
- * @param integer the line number at which the template has error
- */
- public function setLineNumber($value)
- {
- $this->_lineNumber=TPropertyValue::ensureInteger($value);
- }
-}
-
-/**
- * TIOException class
- *
- * TIOException represents an exception related with improper IO operations.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.0
- */
-class TIOException extends TSystemException
-{
-}
-
-/**
- * TDbException class
- *
- * TDbException represents an exception related with DB operations.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.0
- */
-class TDbException extends TSystemException
-{
-}
-
-/**
- * TDbConnectionException class
- *
- * TDbConnectionException represents an exception caused by DB connection failure.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.0
- */
-class TDbConnectionException extends TDbException
-{
-}
-
-/**
- * TNotSupportedException class
- *
- * TNotSupportedException represents an exception caused by using an unsupported PRADO feature.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.0
- */
-class TNotSupportedException extends TSystemException
-{
-}
-
-/**
- * TPhpErrorException class
- *
- * TPhpErrorException represents an exception caused by a PHP error.
- * This exception is mainly thrown within a PHP error handler.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.0
- */
-class TPhpErrorException extends TSystemException
-{
- /**
- * Constructor.
- * @param integer error number
- * @param string error string
- * @param string error file
- * @param integer error line number
- */
- public function __construct($errno,$errstr,$errfile,$errline)
- {
- static $errorTypes=array(
- E_ERROR => "Error",
- E_WARNING => "Warning",
- E_PARSE => "Parsing Error",
- E_NOTICE => "Notice",
- E_CORE_ERROR => "Core Error",
- E_CORE_WARNING => "Core Warning",
- E_COMPILE_ERROR => "Compile Error",
- E_COMPILE_WARNING => "Compile Warning",
- E_USER_ERROR => "User Error",
- E_USER_WARNING => "User Warning",
- E_USER_NOTICE => "User Notice",
- E_STRICT => "Runtime Notice"
- );
- $errorType=isset($errorTypes[$errno])?$errorTypes[$errno]:'Unknown Error';
- parent::__construct("[$errorType] $errstr (@line $errline in file $errfile).");
- }
-}
-
-
-/**
- * THttpException class
- *
- * THttpException represents an exception that is caused by invalid operations
- * of end-users. The {@link getStatusCode StatusCode} gives the type of HTTP error.
- * It is used by {@link TErrorHandler} to provide different error output to users.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Exceptions
- * @since 3.0
- */
-class THttpException extends TSystemException
-{
- private $_statusCode;
-
- /**
- * Constructor.
- * @param integer HTTP status code, such as 404, 500, etc.
- * @param string error message. This can be a string that is listed
- * in the message file. If so, the message in the preferred language
- * will be used as the error message. Any rest parameters will be used
- * to replace placeholders ({0}, {1}, {2}, etc.) in the message.
- */
- public function __construct($statusCode,$errorMessage)
- {
- $this->_statusCode=$statusCode;
- $this->setErrorCode($errorMessage);
- $errorMessage=$this->translateErrorMessage($errorMessage);
- $args=func_get_args();
- array_shift($args);
- array_shift($args);
- $n=count($args);
- $tokens=array();
- for($i=0;$i<$n;++$i)
- $tokens['{'.$i.'}']=TPropertyValue::ensureString($args[$i]);
- parent::__construct(strtr($errorMessage,$tokens));
- }
-
- /**
- * @return integer HTTP status code, such as 404, 500, etc.
- */
- public function getStatusCode()
- {
- return $this->_statusCode;
- }
-}
-
+} \ No newline at end of file
diff --git a/framework/Exceptions/THttpException.php b/framework/Exceptions/THttpException.php
new file mode 100644
index 00000000..f151138b
--- /dev/null
+++ b/framework/Exceptions/THttpException.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+
+/**
+ * THttpException class
+ *
+ * THttpException represents an exception that is caused by invalid operations
+ * of end-users. The {@link getStatusCode StatusCode} gives the type of HTTP error.
+ * It is used by {@link TErrorHandler} to provide different error output to users.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.0
+ */
+class THttpException extends TSystemException
+{
+ private $_statusCode;
+
+ /**
+ * Constructor.
+ * @param integer HTTP status code, such as 404, 500, etc.
+ * @param string error message. This can be a string that is listed
+ * in the message file. If so, the message in the preferred language
+ * will be used as the error message. Any rest parameters will be used
+ * to replace placeholders ({0}, {1}, {2}, etc.) in the message.
+ */
+ public function __construct($statusCode,$errorMessage)
+ {
+ $this->_statusCode=$statusCode;
+ $this->setErrorCode($errorMessage);
+ $errorMessage=$this->translateErrorMessage($errorMessage);
+ $args=func_get_args();
+ array_shift($args);
+ array_shift($args);
+ $n=count($args);
+ $tokens=array();
+ for($i=0;$i<$n;++$i)
+ $tokens['{'.$i.'}']=TPropertyValue::ensureString($args[$i]);
+ parent::__construct(strtr($errorMessage,$tokens));
+ }
+
+ /**
+ * @return integer HTTP status code, such as 404, 500, etc.
+ */
+ public function getStatusCode()
+ {
+ return $this->_statusCode;
+ }
+} \ No newline at end of file
diff --git a/framework/Exceptions/TIOException.php b/framework/Exceptions/TIOException.php
new file mode 100644
index 00000000..42231284
--- /dev/null
+++ b/framework/Exceptions/TIOException.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+/**
+ * TIOException class
+ *
+ * TIOException represents an exception related with improper IO operations.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.0
+ */
+class TIOException extends TSystemException
+{
+} \ No newline at end of file
diff --git a/framework/Exceptions/TInvalidDataTypeException.php b/framework/Exceptions/TInvalidDataTypeException.php
new file mode 100644
index 00000000..03f94985
--- /dev/null
+++ b/framework/Exceptions/TInvalidDataTypeException.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+/**
+ * TInvalidDataTypeException class
+ *
+ * TInvalidDataTypeException represents an exception caused by invalid data type.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.0
+ */
+class TInvalidDataTypeException extends TSystemException
+{
+} \ No newline at end of file
diff --git a/framework/Exceptions/TInvalidDataValueException.php b/framework/Exceptions/TInvalidDataValueException.php
new file mode 100644
index 00000000..075bb871
--- /dev/null
+++ b/framework/Exceptions/TInvalidDataValueException.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+/**
+ * TInvalidDataValueException class
+ *
+ * TInvalidDataValueException represents an exception caused by invalid data value.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.0
+ */
+class TInvalidDataValueException extends TSystemException
+{
+} \ No newline at end of file
diff --git a/framework/Exceptions/TInvalidOperationException.php b/framework/Exceptions/TInvalidOperationException.php
new file mode 100644
index 00000000..4366e5f0
--- /dev/null
+++ b/framework/Exceptions/TInvalidOperationException.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+/**
+ * TInvalidOperationException class
+ *
+ * TInvalidOperationException represents an exception caused by invalid operations.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.0
+ */
+class TInvalidOperationException extends TSystemException
+{
+} \ No newline at end of file
diff --git a/framework/Exceptions/TNotSupportedException.php b/framework/Exceptions/TNotSupportedException.php
new file mode 100644
index 00000000..b793dbbe
--- /dev/null
+++ b/framework/Exceptions/TNotSupportedException.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+/**
+ * TNotSupportedException class
+ *
+ * TNotSupportedException represents an exception caused by using an unsupported PRADO feature.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.0
+ */
+class TNotSupportedException extends TSystemException
+{
+} \ No newline at end of file
diff --git a/framework/Exceptions/TPhpErrorException.php b/framework/Exceptions/TPhpErrorException.php
new file mode 100644
index 00000000..75218c44
--- /dev/null
+++ b/framework/Exceptions/TPhpErrorException.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+/**
+ * TPhpErrorException class
+ *
+ * TPhpErrorException represents an exception caused by a PHP error.
+ * This exception is mainly thrown within a PHP error handler.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.0
+ */
+class TPhpErrorException extends TSystemException
+{
+ /**
+ * Constructor.
+ * @param integer error number
+ * @param string error string
+ * @param string error file
+ * @param integer error line number
+ */
+ public function __construct($errno,$errstr,$errfile,$errline)
+ {
+ static $errorTypes=array(
+ E_ERROR => "Error",
+ E_WARNING => "Warning",
+ E_PARSE => "Parsing Error",
+ E_NOTICE => "Notice",
+ E_CORE_ERROR => "Core Error",
+ E_CORE_WARNING => "Core Warning",
+ E_COMPILE_ERROR => "Compile Error",
+ E_COMPILE_WARNING => "Compile Warning",
+ E_USER_ERROR => "User Error",
+ E_USER_WARNING => "User Warning",
+ E_USER_NOTICE => "User Notice",
+ E_STRICT => "Runtime Notice"
+ );
+ $errorType=isset($errorTypes[$errno])?$errorTypes[$errno]:'Unknown Error';
+ parent::__construct("[$errorType] $errstr (@line $errline in file $errfile).");
+ }
+} \ No newline at end of file
diff --git a/framework/Exceptions/TSystemException.php b/framework/Exceptions/TSystemException.php
new file mode 100644
index 00000000..5d5c7d8e
--- /dev/null
+++ b/framework/Exceptions/TSystemException.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+/**
+ * TSystemException class
+ *
+ * TSystemException is the base class for all framework-level exceptions.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.0
+ */
+class TSystemException extends TException
+{
+} \ No newline at end of file
diff --git a/framework/Exceptions/TTemplateException.php b/framework/Exceptions/TTemplateException.php
new file mode 100644
index 00000000..7deb6ed0
--- /dev/null
+++ b/framework/Exceptions/TTemplateException.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Exception classes file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @package System.Exceptions
+ */
+
+/**
+ * TTemplateException class
+ *
+ * TTemplateException represents an exception caused by invalid template syntax.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @package System.Exceptions
+ * @since 3.1
+ */
+class TTemplateException extends TConfigurationException
+{
+ private $_template='';
+ private $_lineNumber=0;
+ private $_fileName='';
+
+ /**
+ * @return string the template source code that causes the exception. This is empty if {@link getTemplateFile TemplateFile} is not empty.
+ */
+ public function getTemplateSource()
+ {
+ return $this->_template;
+ }
+
+ /**
+ * @param string the template source code that causes the exception
+ */
+ public function setTemplateSource($value)
+ {
+ $this->_template=$value;
+ }
+
+ /**
+ * @return string the template file that causes the exception. This could be empty if the template is an embedded template. In this case, use {@link getTemplateSource TemplateSource} to obtain the actual template content.
+ */
+ public function getTemplateFile()
+ {
+ return $this->_fileName;
+ }
+
+ /**
+ * @param string the template file that causes the exception
+ */
+ public function setTemplateFile($value)
+ {
+ $this->_fileName=$value;
+ }
+
+ /**
+ * @return integer the line number at which the template has error
+ */
+ public function getLineNumber()
+ {
+ return $this->_lineNumber;
+ }
+
+ /**
+ * @param integer the line number at which the template has error
+ */
+ public function setLineNumber($value)
+ {
+ $this->_lineNumber=TPropertyValue::ensureInteger($value);
+ }
+} \ No newline at end of file