* Dependencies API: _WP_Dependency class
* @subpackage Dependencies
* Helper class to register a handle and associated data.
* An array of handle dependencies.
* Used for cache-busting.
* Additional arguments for the handle.
public $args = null; // Custom property, such as $in_footer or $media.
* Extra data to supply to the handle.
* Translation textdomain set for this dependency.
* Translation path set for this dependency.
public $translations_path;
* @since 5.3.0 Formalized the existing `...$args` parameter by adding it
* to the function signature.
* @param mixed ...$args Dependency information.
public function __construct( ...$args ) {
list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = $args;
if ( ! is_array( $this->deps ) ) {
* @param string $name The data key to add.
* @param mixed $data The data value to add.
* @return bool False if not scalar, true otherwise.
public function add_data( $name, $data ) {
if ( ! is_scalar( $name ) ) {
$this->extra[ $name ] = $data;
* Sets the translation domain for this dependency.
* @param string $domain The translation textdomain.
* @param string $path Optional. The full file path to the directory containing translation files.
* @return bool False if $domain is not a string, true otherwise.
public function set_translations( $domain, $path = null ) {
if ( ! is_string( $domain ) ) {
$this->textdomain = $domain;
$this->translations_path = $path;