| Server IP : 108.167.142.43 / Your IP : 216.73.217.58 Web Server : Apache System : Linux gator4174.hostgator.com 5.14.0-687.39.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Aug 18 06:09:16 EDT 2026 x86_64 User : delarice ( 2406) PHP Version : 8.3.36 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home2/delarice/www/wp-content/plugins/google-site-kit/includes/Core/Intents/ |
Upload File : |
<?php
/**
* Class Google\Site_Kit\Core\Intents\Intents
*
* @package Google\Site_Kit\Core\Intents
* @copyright 2026 Google LLC
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://sitekit.withgoogle.com
*/
namespace Google\Site_Kit\Core\Intents;
/**
* Class for collecting the intents Site Kit can be asked to handle.
*
* @since 1.188.0
* @access private
* @ignore
*/
class Intents {
/**
* Registered intents keyed by intent ID.
*
* @since 1.188.0
* @var array<string, Intent>
*/
private $intents = array();
/**
* Collects the intents to handle.
*
* @since 1.188.0
*/
public function register() {
/**
* Fires when intents are collected.
*
* @since 1.188.0
*
* @param Intents $intents Intents registry to register intents on.
*/
do_action( 'googlesitekit_intents_register', $this );
}
/**
* Registers an intent.
*
* The intent registered first for an ID stays; a later one with the same ID is ignored.
*
* @since 1.188.0
*
* @param Intent $intent Intent to register.
*/
public function register_intent( Intent $intent ) {
$id = $intent->get_id();
if ( isset( $this->intents[ $id ] ) ) {
return;
}
$this->intents[ $id ] = $intent;
}
/**
* Gets the intent registered for an ID, if it can currently be handled.
*
* @since 1.188.0
*
* @param string $id Intent ID.
* @return Intent|null Intent instance, or null if no intent is registered for the ID or the registered one is unavailable.
*/
public function get_intent( $id ) {
if ( ! isset( $this->intents[ $id ] ) ) {
return null;
}
$intent = $this->intents[ $id ];
return $intent->is_available() ? $intent : null;
}
}