HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/hcv/wp-content/plugins/wordpress-seo-premium/src/presenters/icons/icon-presenter.php
<?php

namespace Yoast\WP\SEO\Premium\Presenters\Icons;

use Yoast\WP\SEO\Presenters\Abstract_Presenter;

/**
 * Presents an icon.
 */
abstract class Icon_Presenter extends Abstract_Presenter {

	/**
	 * The start tag of an SVG element.
	 */
	const SVG_START_TAG = "<svg xmlns='http://www.w3.org/2000/svg' fill='none' style='fill:none' viewBox='0 0 24 24' stroke='currentColor' height='%SIZE%' width='%SIZE%' >";

	/**
	 * The default height and width of an icon in pixels.
	 */
	const SIZE_DEFAULT = 24;

	/**
	 * The size of the icon in pixels.
	 *
	 * @var int
	 */
	protected $size;

	/**
	 * Creates a new icon.
	 *
	 * @codeCoverageIgnore
	 *
	 * @param int $size The size of the icon.
	 */
	public function __construct( $size ) {
		$this->size = $size;
	}

	/**
	 * Generates the SVG based on the given path.
	 *
	 * @param string $path     The path to generate SVG icon for.
	 * @param int    $svg_size The height and width of the SVG icon.
	 *
	 * @return string The generated icon svg.
	 */
	private static function svg( $path, $svg_size = self::SIZE_DEFAULT ) {
		$start = \str_replace( '%SIZE%', $svg_size, self::SVG_START_TAG );
		return $start . $path . '</svg>';
	}

	/**
	 * Returns the icon as a string.
	 *
	 * @return string The icon.
	 */
	public function present() {
		return self::svg( $this->get_path(), $this->get_size() );
	}

	/**
	 * Returns the size of the icon.
	 *
	 * @return int The size of the icon.
	 */
	public function get_size() {
		return $this->size;
	}

	/**
	 * Returns the path of the icon.
	 *
	 * @return string The path of the icon.
	 */
	abstract public function get_path();
}