Gumbo PHP Library API Documentation
Debug
[
class tree
] [
index
] [
all elements
]
Todo List
Packages:
Buffer
Collection
Composite
Config
Converter
Curl
Date
DB
Debug
Encryption
Error
Factory
Filter
Flyweight
Http
Input
Iterator
List
Load
Lockable
Log
Map
Number
Observer
Output
Query
Record
Router
Session
Setting
Singleton
Template
Timer
Utility
Valid
Source for file Email.class.php
Documentation is available at
Email.class.php
<?php
/**
* Gumbo Library Framework
*
* LICENSE
* This library is being released under the terms of the New BSD License. A
* copy of the license is packaged with the software (LICENSE.txt). If no
* copy is found, a copy of the license template can be found at:
* http://www.opensource.org/licenses/bsd-license.php
*
*
@category
Gumbo
*
@package
Debug
*
@copyright
Copyright (c) 2007, iBayou, Michael Luster
*
@license
http://www.opensource.org/licenses/bsd-license.php New BSD License
*
@author
Michael Luster <mluster79@yahoo.com>
*
@link
http://sourceforge.net/projects/phpgumbo
*
@version
0.0.1
*/
/**
* Debug Email Report Class
*
*
@category
Gumbo
*
@package
Debug
*
@copyright
Copyright (c) 2007, iBayou, Michael Luster
*
@license
http://www.opensource.org/licenses/bsd-license.php New BSD License
*
@author
Michael Luster <mluster79@yahoo.com>
*
@link
http://sourceforge.net/projects/phpgumbo
*
@desc
Debug Email Report Class
*
@version
0.0.1
*/
gumbo_load
(
"Debug_Report"
)
;
gumbo_load
(
"Date"
)
;
gumbo_load
(
"Valid_Web"
)
;
class
Gumbo_Debug_Report_Email
extends
Gumbo_Debug_Report
{
/**
@var
string
$_email
address to send Debug Report */
private
$_email
;
/**
* Constructor
*
@param
string
$email
*/
public
function
__construct
(
$email
=
null
)
{
if
(
defined
(
"GUMBO_DEBUG_EMAIL"
))
{
$this
->
setEmail
(
GUMBO_DEBUG_EMAIL
)
;
}
if
(
!
is_null
(
$email
))
{
$this
->
setEmail
(
$email
)
;
}
}
/** ACTION METHODS **/
/**
* Runs the Report
*
@param
num
$start_time
initial start time of script debugger
*
@throws
Gumbo_Exception
*
@uses
Gumbo_Date
*/
public
function
run
(
$start_time
=
null
)
{
try
{
// verify precondition
if
(
!
$this
->
getEmail
(
))
{
throw
new
Gumbo_Exception
(
"Debug Email Undefined"
)
;
}
$txt
=
null
;
foreach
(
$this
->
getMessages
(
)
as
$mess
)
{
$mess
->
setSeconds
(
$start_time
)
;
$txt
.=
$mess
->
getSeconds
(
)
.
"||"
.
$mess
->
getMessage
(
)
.
"||"
;
$txt
.=
$mess
->
getFile
(
)
.
"||"
.
$mess
->
getLine
(
)
.
"||"
;
$txt
.=
$mess
->
getFunction
(
)
.
"||"
.
$mess
->
getClass
(
)
.
"\n"
;
$start_time
=
$mess
->
getTime
(
)
;
}
$date
=
new
Gumbo_Date
(
)
;
@
mail
(
$this
->
getEmail
(
)
,
"Debug Report: "
.
$date
->
get
(
)
,
$txt
)
;
}
catch
(
Gumbo_Exception
$e
)
{
$e
->
setFunction
(
__METHOD__
)
;
gumbo_trigger
(
$e
)
;
}
}
/** MUTATOR METHODS **/
/**
* Sets the Debug Email Address
*
@param
string
$email
*
@throws
Gumbo_Exception
*
@uses
Gumbo_Valid_Web
*/
public
function
setEmail
(
$email
)
{
try
{
// verify precondition
if
(
!
is_string
(
$email
))
{
throw
new
Gumbo_Exception
(
"
Invalid
Argument
'
email
:
str
' => {
$email
}
:
"
.
gettype
(
$email
))
;
}
$valid
=
new
Gumbo_Valid_Web
(
)
;
if
(
!
$valid
->
isEmail
(
$email
))
{
throw
new
Gumbo_Exception
(
"
Invalid
Email
Address
: {
$email
}
"
)
;
}
$this
->
_email
=
$email
;
}
catch
(
Gumbo_Exception
$e
)
{
$e
->
setFunction
(
__METHOD__
)
;
gumbo_trigger
(
$e
)
;
}
}
/** ACCESSOR METHODS **/
/**
* Returns the Debug Email
*
@return
string
*/
public
function
getEmail
(
)
{
return
$this
->
_email
;
}
}
?>