3 namespace RedBeanPHP\Util;
5 use RedBeanPHP\OODB as OODB;
6 use RedBeanPHP\OODBBean as OODBBean;
11 * This code was originally part of the facade, however it has
12 * been decided to remove unique features to service classes like
13 * this to make them available to developers not using the facade class.
15 * Dumps the contents of a bean in an array for
18 * @file RedBeanPHP/Util/Dump.php
19 * @author Gabor de Mooij and the RedBeanPHP Community
23 * copyright (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community
24 * This source file is subject to the BSD/GPLv2 License that is bundled
25 * with this source code in the file license.txt.
30 * Simple but effective debug function.
31 * Given a one or more beans this method will
32 * return an array containing first part of the string
33 * representation of each item in the array.
35 * @param OODBBean|array $data either a bean or an array of beans
39 public static function dump( $data )
43 if ( $data instanceof OODBBean ) {
44 $str = strval( $data );
45 if (strlen($str) > 35) {
46 $beanStr = substr( $str, 0, 35 ).'... ';
53 if ( is_array( $data ) ) {
54 foreach( $data as $key => $item ) {
55 $array[$key] = self::dump( $item );