HEX
Server: Apache/2.4.65 (Debian)
System: Linux kubikelcreative 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User: www-data (33)
PHP: 8.4.13
Disabled: NONE
Upload Files
File: /var/www/Gosurya/WP2/wp-content/themes/my-listing/includes/extensions/stats/stat-group.php
<?php

namespace MyListing\Ext\Stats;

if ( ! defined('ABSPATH') ) {
	exit;
}

class Stat_Group {

	public $stats = [];

	public function __construct( $stats ) {
		$this->stats = $stats;
	}

	/**
	 * Get a value from the stats array. Nested values can be
	 * accessed using dots, e.g. `$stats->get('visits.browsers')`.
	 *
	 * @since 2.0
	 */
	public function get( $stat ) {
		$parts = explode( '.', $stat );
		$stats = $this->stats;

		foreach ( $parts as $part ) {
			if ( empty( $stats[ $part ] ) ) {
				return false;
			}

			$stats = $stats[ $part ];
		}

		return $stats;
	}

	public function all() {
		return $this->stats;
	}
}