/home/websdxuk/dannymattinezllc.com/wp-content/plugins/elementor-pro/core/database/model-base.php
<?php
namespace ElementorPro\Core\Database;

use ElementorPro\Core\Utils\Collection;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

abstract class Model_Base implements \JsonSerializable {

	// Casting types.
	const TYPE_BOOLEAN = 'boolean';
	const TYPE_COLLECTION = 'collection';
	const TYPE_INTEGER = 'integer';
	const TYPE_STRING = 'string';
	const TYPE_JSON = 'json';
	const TYPE_DATETIME = 'datetime';
	const TYPE_DATETIME_GMT = 'datetime_gmt';

	/**
	 * Casts array.
	 * Used to automatically cast values from DB to the appropriate property type.
	 *
	 * @var array
	 */
	protected static $casts = [];

	/**
	 * Model_Base constructor.
	 *
	 * @param array $fields - Fields from the DB to fill.
	 *
	 * @return void
	 */
	public function __construct( array $fields ) {
		foreach ( $fields as $key => $value ) {
			if ( ! property_exists( $this, $key ) ) {
				continue;
			}

			$this->{$key} = ( empty( static::$casts[ $key ] ) )
				? $value
				: static::cast( $value, static::$casts[ $key ] );
		}
	}

	/**
	 * Get the model's table name.
	 * Throws an exception by default in order to require implementation,
	 * since abstract static functions are not allowed.
	 *
	 * @return string
	 */
	public static function get_table() {
		throw new \Exception( 'You must implement `get_table()` inside ' . static::class );
	}

	/**
	 * Create a Query Builder for the model's table.
	 *
	 * @param \wpdb|null $connection - MySQL connection to use.
	 *
	 * @return Query_Builder
	 */
	public static function query( \wpdb $connection = null ) {
		$builder = new Model_Query_Builder( static::class, $connection );

		return $builder->from( static::get_table() );
	}

	/**
	 * Cast value into specific type.
	 *
	 * @param $value - Value to cast.
	 * @param $type - Type to cast into.
	 *
	 * @return mixed
	 */
	protected static function cast( $value, $type ) {
		if ( null === $value ) {
			return null;
		}

		switch ( $type ) {
			case self::TYPE_BOOLEAN:
				return boolval( $value );

			case self::TYPE_COLLECTION:
				return new Collection( $value );

			case self::TYPE_INTEGER:
				return intval( $value );

			case self::TYPE_STRING:
				return strval( $value );

			case self::TYPE_JSON:
				return json_decode( $value, true );

			case self::TYPE_DATETIME:
				return new \DateTime( $value );

			case self::TYPE_DATETIME_GMT:
				return new \DateTime( $value, new \DateTimeZone( 'GMT' ) );
		}

		return $value;
	}

	/**
	 * Cast a model property value into a JSON compatible data type.
	 *
	 * @param $value - Value to cast.
	 * @param $type - Type to cast into.
	 * @param $property_name - The model property name.
	 *
	 * @return mixed
	 */
	protected static function json_serialize_property( $value, $type, $property_name ) {
		switch ( $type ) {
			case self::TYPE_DATETIME:
			case self::TYPE_DATETIME_GMT:
				/** @var \DateTime $value */
				return $value->format( 'c' );
		}

		/** @var mixed $value */
		return $value;
	}

	/**
	 * @return array
	 */
	#[\ReturnTypeWillChange]
	public function jsonSerialize() {
		return ( new Collection( (array) $this ) )
			->map( function ( $_, $key ) {
				$value = $this->{$key};

				$type = array_key_exists( $key, static::$casts )
					? static::$casts[ $key ]
					: null;

				if ( null === $value ) {
					return $value;
				}

				// Can be overridden by child model.
				$value = static::json_serialize_property( $value, $type, $key );

				if ( $value instanceof \JsonSerializable ) {
					return $value->jsonSerialize();
				}

				return $value;
			} )
			->all();
	}
}
My Blog – My WordPress Blog

Navigating Your Journey, Relocating Your World

Elevate Your Move, Experience Seamless Relocations.

A leading innovator in orchestrating top-notch Moving Solutions and Ensuring Seamless Relocations across the USA.

Booked Your Movement

Goods Packing Service

Goods Unpacking Service

Moving Goods Service

Goods Unloading Service

Service

Choose Your Movement Service

Start From 10 USD/Hour

Complete Goods Packing Service for House

All aspects of your software assets including purchasing, deployment & maintenance.

Start From 15 USD/Hour

Complete Goods Unpacking Service for House

All aspects of your software assets including purchasing, deployment & maintenance.

Start From 100 USD/Month

Complete Storage Solution For Your Goods

All aspects of your software assets including purchasing, deployment & maintenance.

Start From 100 USD/Month

Complete Unloading Solution For Your Goods

All aspects of your software assets including purchasing, deployment & maintenance.

Get 10% Discount For Every First of Order. 

View All Our Service Here

WHY CHOOSE US

Explore Why Our Company is Preferable

At [Your Company Name], we pride ourselves on delivering exceptional value, unparalleled service, and innovative solutions tailored to meet your needs.

No Hidden Price

Free Unloading

Clean No Trash

Warehouse

Fast Truck

About Us

Swift Your Transitions With Unmatched Service

At [Your Company Name], we are more than just a business—we are a team of passionate professionals dedicated to delivering excellence. With [X] years of experience in [your industry], we’ve built a reputation for [key strengths, e.g., innovation, reliability, customer-centric solutions].

Thinking insights, verified driven research, and metrics data help you make the right decisions!

Achievments

Moving You Forward By Moving with Care

At [Your Company Name], we take pride in our milestones and the impact we’ve made. Our journey is marked by dedication, innovation, and a relentless pursuit of excellence. Here’s a glimpse of what we’ve accomplished:

Every achievement reflects our commitment to excellence and the trust our clients and partners place in us. We’re not just celebrating the past—we’re building an even brighter future.

0 +

Clients

0 +

Miles

0 +

Movers

Study Case

Learn Our Successfull Study Cases

Urban, Relocations

From City to Suburbs: A Smooth Urban Relocation

Corporate, Precision

Corporate Precision: Streamlining Office Moves

Senior, Transitions

Senior Transitions: Compassionate Moves for Aging Loved Onesz

Cross, Country

Cross-Country Adventure: A Transcontinental Move

Booked Form

Don't Let Your Back Hurt, Let Us Move Your Things!

Our easy-to-use booking form ensures a seamless experience, allowing you to choose your preferred date, time, and options without any hassle.

Why book with us?
✓ Instant Confirmation – Receive immediate booking details via email/SMS.
✓ Flexible Scheduling – Pick a slot that fits your schedule.
✓ 100% Secure – Your information is safe with us.

Booked Your Movement

Booked Your Movement