: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Represents a WPSEO asset
class WPSEO_Admin_Asset {
* Constant used to identify file type as a JS file.
public const TYPE_JS = 'js';
* Constant used to identify file type as a CSS file.
public const TYPE_CSS = 'css';
* The name option identifier.
public const NAME = 'name';
* The source option identifier.
public const SRC = 'src';
* The dependencies option identifier.
public const DEPS = 'deps';
* The version option identifier.
public const VERSION = 'version';
* The media option identifier.
public const MEDIA = 'media';
* The rtl option identifier.
public const RTL = 'rtl';
* The "in footer" option identifier.
public const IN_FOOTER = 'in_footer';
* For CSS Assets. The type of media for which this stylesheet has been defined.
* See https://www.w3.org/TR/CSS2/media.html#media-types.
* For JS Assets. Whether or not the script should be loaded in the footer.
* For CSS Assets. Whether this stylesheet is a right-to-left stylesheet.
* Default asset arguments.
* Constructs an instance of the WPSEO_Admin_Asset class.
* @param array $args The arguments for this asset.
* @throws InvalidArgumentException Throws when no name or src has been provided.
public function __construct( array $args ) {
if ( ! isset( $args['name'] ) ) {
throw new InvalidArgumentException( 'name is a required argument' );
if ( ! isset( $args['src'] ) ) {
throw new InvalidArgumentException( 'src is a required argument' );
$args = array_merge( $this->defaults, $args );
$this->name = $args['name'];
$this->src = $args['src'];
$this->deps = $args['deps'];
$this->version = $args['version'];
$this->media = $args['media'];
$this->in_footer = $args['in_footer'];
$this->rtl = $args['rtl'];
$this->suffix = $args['suffix'];
* Returns the asset identifier.
public function get_name() {
* Returns the path to the asset.
public function get_src() {
* Returns the asset dependencies.
public function get_deps() {
* Returns the asset version.
public function get_version() {
if ( ! empty( $this->version ) ) {
* Returns the media type for CSS assets.
public function get_media() {
* Returns whether a script asset should be loaded in the footer of the page.
public function is_in_footer() {
* Returns whether this CSS has a RTL counterpart.
public function has_rtl() {
* Returns the file suffix.
public function get_suffix() {