HEX
Server: Apache
System: Linux d5123.usc1.stableserver.net 5.14.0-570.17.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Sat May 24 12:53:17 EDT 2025 x86_64
User: d5123 (1001)
PHP: 8.4.21
Disabled: NONE
Upload Files
File: /home/d5123/myboofola_com/wp-content/plugins/unsplash/php/class-api-response.php
<?php
/**
 * API Response class.
 *
 * @package Unsplash
 */

namespace Unsplash;

/**
 * Class Api_Response.
 */
class Api_Response {

	/**
	 * Is cached.
	 *
	 * @var bool
	 */
	protected $cached = false;

	/**
	 * Total pages.
	 *
	 * @var int
	 */
	protected $total_pages = 0;

	/**
	 * Total objects.
	 *
	 * @var int
	 */
	protected $total_objects = 0;

	/**
	 * Results.
	 *
	 * @var array
	 */
	protected $results = [];

	/**
	 * Api_Response constructor.
	 *
	 * @param array $results Array of results for API.
	 * @param int   $total_pages Total number of pages.
	 * @param int   $total_objects Total number of objects.
	 * @param bool  $cached Is cached.
	 */
	public function __construct( $results, $total_pages = 0, $total_objects = 0, $cached = false ) {
		// @todo handle bad/missing `$results` and add test coverage.
		$this->results       = $results;
		$this->total_pages   = $total_pages;
		$this->total_objects = $total_objects;
		$this->cached        = $cached;
	}

	/**
	 * Get cached value.
	 *
	 * @return mixed
	 */
	public function get_cached() {
		return $this->cached;
	}

	/**
	 * Get total objects.
	 *
	 * @return int
	 */
	public function get_total_object() {
		return $this->total_objects;
	}

	/**
	 * Get total pages.
	 *
	 * @return int
	 */
	public function get_total_pages() {
		return $this->total_pages;
	}

	/**
	 * Get results.
	 *
	 * @return array
	 */
	public function get_results() {
		return $this->results;
	}
}