set_vars( $args ); } /** * Set class variables from arguments. * * @param array $args * * @since 3.0 */ protected function set_vars( $args = array() ) { // Bail if empty or not an array if ( empty( $args ) ) { return; } // Cast to an array if ( ! is_array( $args ) ) { $args = (array) $args; } // Set all properties foreach ( $args as $key => $value ) { if ( '0000-00-00 00:00:00' === $value ) { $value = null; } $this->{$key} = $value; } } /** * Get all object properties as an array * * @since 3.4 * @return array */ public function export_vars() { return get_object_vars( $this ); } }