PHP Classes

File: vendor/jackbooted/util/ObjectUtil.php

Recommend this page to a friend!
  Packages of Brett Dutton   JackBooted PHP Framework   vendor/jackbooted/util/ObjectUtil.php   Download  
File: vendor/jackbooted/util/ObjectUtil.php
Role: Class source
Content type: text/plain
Description: Class source
Class: JackBooted PHP Framework
Web application framework using simplified MVC
Author: By
Last change:
Date: 10 years ago
Size: 874 bytes
 

 

Contents

Class file image Download
<?php
namespace Jackbooted\Util;

/**
 * @copyright Confidential and copyright (c) 2016 Jackbooted Software. All rights reserved.
 *
 * Written by Brett Dutton of Jackbooted Software
 * brett at brettdutton dot com
 *
 * This software is written and distributed under the GNU General Public
 * License which means that its source code is freely-distributed and
 * available to the general public.
 */

class ObjectUtil {
    public static function toArray ( $d ) {
        if ( is_object( $d ) ) {
            // Gets the properties of the given object with get_object_vars function
            $d = get_object_vars( $d );
        }

        if ( is_array( $d ) ) {
            // Return array converted to object for recursive call
            return array_map( __METHOD__, $d );
        }
        else {
            // Return array
            return $d;
        }
    }
}