Source for file ABSTObject.class.php
Documentation is available at ABSTObject.class.php
* @package data_structures
function clone( $object )
* Class to inspect objects that are an extension of this class.
* @package data_structures
* @author Daniel Plücken <daniel@debakel.net>
* @license http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
* @copyright Copyright (C) 2007 Daniel Plücken <daniel@debakel.net>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
* Prints out the primitive data by the given arrays.
* @author Daniel Plücken <daniel.pluecken@wfp2.com>
count( $primitive_types_arr )
+ count( $primitive_array_arr ) > 0
echo "<h2>Primitive Data:</h2>\r\n";
foreach ( $primitive_types_arr as $nam => $value )
echo "<b>{$nam}</b>: {$value}<br />\r\n";
echo "<b>{$nam}</b>: ". substr( $value, 0, 255 )
foreach ( $primitive_array_arr as $nam => $value )
echo "</blockquote>\r\n";
* Prints out the more complex data by the given array.
* @param array $multidimensional_arr
* @param array $depth_arr
* @param string $exept_reg_exp
* @author Daniel Plücken <daniel.pluecken@wfp2.com>
$dig_deeper_arr = array();
$handled_object_arr = array();
$unhandled_object_arr = array();
foreach ( $multidimensional_arr as $key => $val )
&& !method_exists ( $multidimensional_arr[$key], "printStructure" )
$unhandled_object_arr[$key] = & $multidimensional_arr[$key];
if ( is_object( $multidimensional_arr[$key] ) )
$handled_object_arr[$key] = & $multidimensional_arr[$key];
if ( is_array( $multidimensional_arr[$key] ) )
$dig_deeper_arr[$key] = & $multidimensional_arr[$key];
$mem_depth_arr = $depth_arr;
if ( count( $depth_arr ) > 1 )
$nam_prefix .= "[". implode( "][", $depth_arr ). "]";
foreach ( $unhandled_object_arr as $nam => $value )
echo "<b>{$nam_prefix}[{$nam}]</b>: *Object ";
echo get_class( $unhandled_object_arr[$nam] );
echo " (unhandled)<br />\r\n";
foreach ( $handled_object_arr as $nam => $value )
echo "<b>{$nam_prefix}[{$nam}]</b>:\r\n";
echo $handled_object_arr[$nam]->printStructure( $exept_reg_exp );
$depth_arr = $mem_depth_arr;
foreach ( $dig_deeper_arr as $nam => $value )
$depth_arr = $mem_depth_arr;
* Compares two references whether they points to the same object
$a_obj->____bool_same_checker = true;
$bool_out = !empty( $b_obj->____bool_same_checker );
unset ( $a_obj->____bool_same_checker );
* Checks whether the passed object reference points to this object.
if ( !is_a( $obj, "ABSTObject" ) )
* Prints out the Structure of this Object.
* @param string $exept_reg_exp No Fieldnames that match this regular
* expression will print out.
$handled_object_arr = array();
$primitive_types_arr = array();
$primitive_array_arr = array();
$multidimensional_arr = array();
$unhandled_object_arr = array();
foreach ( $this as $key => $val )
{ $handled_object_arr[$key] = & $this->$key; }
{ $unhandled_object_arr[$key] = & $this->$key; }
{ $primitive_types_arr[$key] = & $this->$key; }
foreach ( $this->$key as $kval )
$multidimensional_arr[$key] = & $this->$key;
$primitive_array_arr[$key] = & $this->$key;
echo "<h1>Object: ". get_class( $this ). "</h1>";
if ( count( $multidimensional_arr ) > 0 )
echo "<h2>Complex Data <font size=\"1\">["
echo "{Some multidimensional arrays without references to "
. "objects (I think not neccessary to display!)}";
echo "</blockquote>\r\n";
if ( count( $unhandled_object_arr ) > 0 )
echo "<h2>Unhandled Objects <font size=\"1\">["
foreach ( $unhandled_object_arr as $nam => $value )
echo "<b>{$nam}</b>: *Object "
echo "</blockquote>\r\n";
if ( count( $handled_object_arr ) > 0 )
echo "<h2>Handled Objects <font size=\"1\">["
foreach ( $handled_object_arr as $nam => $value )
echo "<b>{$nam}</b>:\r\n";
echo $handled_object_arr[$nam]->printStructure($exept_reg_exp);
echo "</blockquote>\r\n";
echo "</blockquote>\r\n";
} // End of class ABSTObject
|