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 Extension.class.php
Documentation is available at
Extension.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 Server Report - Extension
*
*
@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 Server Report - Extension
*
@version
0.0.1
*/
gumbo_load
(
"Interface_Debug_Server_Report"
)
;
class
Gumbo_Debug_Server_Extension
implements
Gumbo_Interface_Debug_Server_Report
{
/**
@var
string
$_ext
Extension Name (if null, returns all) */
private
$_ext
;
/**
@var
bool
$_display_func
if to display Extension functions */
private
$_display_func
=
false
;
/**
* Constructor
*
@param
string
$ext
Extension Name
*
@param
bool
$func
display Extension functions
*/
public
function
__construct
(
$ext
=
null
,
$func
=
false
)
{
if
(
!
is_null
(
$ext
))
{
$this
->
setExtension
(
$ext
)
;
}
$this
->
setDisplayFunctions
(
$func
)
;
}
/** ACTION METHODS **/
/**
* Runs the Report
*
@return
string
*/
public
function
run
(
)
{
$txt
=
"<div class=\"debug\">\n"
;
if
(
$this
->
getExtension
(
))
{
$txt
.=
"\t<ul>Extension: "
.
$this
->
getExtension
(
)
.
"\n"
;
foreach
(
get_extension_funcs
(
$this
->
getExtension
(
))
as
$func
)
{
$txt
.=
"
\t\t<
li
>{
$func
}
</
li
>\n
"
;
}
}
else
{
$txt
.=
"\t<ul>Loaded Extensions\n"
;
foreach
(
get_loaded_extensions
(
)
as
$val
)
{
$txt
.=
"
\t\t<
li
>{
$val
}
"
;
if
(
$this
->
getDisplayFunctions
(
))
{
$txt
.=
"\n\t\t\t<ul>\n"
;
foreach
(
get_extension_funcs
(
$val
)
as
$func
)
{
$txt
.=
"
\t\t\t\t<
li
>{
$func
}
</
li
>\n
"
;
}
$txt
.=
"\t\t\t</ul>"
;
}
$txt
.=
"</li>\n"
;
}
}
$txt
.=
"\t</ul>\n"
;
$txt
.=
"</div>\n\n"
;
return
$txt
;
}
/**
* Resets the Report
*
@postcondition
!getExtension()
*
@postcondition
!getDisplayFunctions()
*/
public
function
reset
(
)
{
$this
->
_ext
=
null
;
$this
->
_display_func
=
false
;
}
/** MUTATOR METHODS **/
/**
* Sets the Extension
*
@precondition
extension_loaded()
*
@postcondition
getDisplayFunctions()
*
@param
string
$ext
*
@throws
Gumbo_Exception
*/
public
function
setExtension
(
$ext
)
{
try
{
// verify precondition
if
(
!
is_string
(
$ext
))
{
throw
new
Gumbo_Exception
(
"
Invalid
Argument
'
ext
:
str
' => {
$ext
}
:
"
.
gettype
(
$ext
))
;
}
if
(
!
extension_loaded
(
$ext
))
{
throw
new
Gumbo_Exception
(
"
Extension
Not
Loaded
: {
$ext
}
"
)
;
}
$this
->
_ext
=
$ext
;
$this
->
setDisplayFunctions
(
true
)
;
}
catch
(
Gumbo_Exception
$e
)
{
$e
->
setFunction
(
__METHOD__
)
;
gumbo_trigger
(
$e
)
;
}
}
/**
* Sets to display Extension Functions
*
@param
bool
$disp
*
@throws
Gumbo_Exception
*/
public
function
setDisplayFunctions
(
$disp
)
{
try
{
// verify precondition
if
(
!
is_bool
(
$disp
))
{
throw
new
Gumbo_Exception
(
"
Invalid
Argument
'
disp
:
bool
' => {
$disp
}
:
"
.
gettype
(
$disp
))
;
}
$this
->
_display_func
=
$disp
;
}
catch
(
Gumbo_Exception
$e
)
{
$e
->
setFunction
(
__METHOD__
)
;
gumbo_trigger
(
$e
)
;
}
}
/** ACCESSOR METHODS **/
/**
* Returns the Extension Name
*
@return
string
*/
public
function
getExtension
(
)
{
return
$this
->
_ext
;
}
/**
* Returns if displaying Extension functions
*
@return
bool
*/
public
function
getDisplayFunctions
(
)
{
return
$this
->
_display_func
;
}
}
?>