protected function convertObjectToArray($object)
    {
        if (method_exists($object, 'toArray')) {
            return $object->toArray();
        }

        return json_decode(json_encode($object, true), true);
    }
protected function convertObjectToArray($object)
    {
        if (method_exists($object, 'toArray')) {
            return $object->toArray();
        }

        return json_decode(json_encode($object, true), true);
    }
protected function convertObjectToArray ( $ object ) { if ( method_exists ( $ object , 'toArray' ) ) { return $ object -> toArray ( ) ; } return json_decode ( json_encode ( $ object , true ) , true ) ; }
Convert an object to array.

@param  mixed  $object
@return array
Convert an object to array .