HEX
Server: Apache/2.4.61 (Ubuntu)
System: Linux hosting106 7.0.12-1-pve #1 SMP PREEMPT_DYNAMIC PMX 7.0.12-1 (2026-06-09T21:07Z) x86_64
User: clinicadentalargarate.com (1193)
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: /home/cursos.ril.es/vendor/tijsverkoyen/css-to-inline-styles/src/Specificity.php
<?php
namespace TijsVerkoyen\CssToInlineStyles;

/**
 * CSS to Inline Styles Specificity class.
 *
 * Compare specificity based on the CSS3 spec.
 *
 * @see http://www.w3.org/TR/selectors/#specificity
 *
 */
class Specificity
{

    /**
     * The number of ID selectors in the selector
     *
     * @var int
     */
    private $a;

    /**
     *
     * The number of class selectors, attributes selectors, and pseudo-classes in the selector
     *
     * @var int
     */
    private $b;

    /**
     * The number of type selectors and pseudo-elements in the selector
     *
     * @var int
     */
    private $c;

    /**
     * @param int $a The number of ID selectors in the selector
     * @param int $b The number of class selectors, attributes selectors, and pseudo-classes in the selector
     * @param int $c The number of type selectors and pseudo-elements in the selector
     */
    public function __construct($a = 0, $b = 0, $c = 0)
    {
        $this->a = $a;
        $this->b = $b;
        $this->c = $c;
    }

    /**
     * Increase the current specificity by adding the three values
     *
     * @param int $a The number of ID selectors in the selector
     * @param int $b The number of class selectors, attributes selectors, and pseudo-classes in the selector
     * @param int $c The number of type selectors and pseudo-elements in the selector
     */
    public function increase($a, $b, $c)
    {
        $this->a += $a;
        $this->b += $b;
        $this->c += $c;
    }

    /**
     * Get the specificity values as an array
     *
     * @return array
     */
    public function getValues()
    {
        return array($this->a, $this->b, $this->c);
    }

    /**
     * Calculate the specificity based on a CSS Selector string,
     * Based on the patterns from premailer/css_parser by Alex Dunae
     *
     * @see https://github.com/premailer/css_parser/blob/master/lib/css_parser/regexps.rb
     * @param string $selector
     * @return static
     */
    public static function fromSelector($selector)
    {
        $pattern_a = "  \#";
        $pattern_b = "  (\.[\w]+)                     # classes
                        |
                        \[(\w+)                       # attributes
                        |
                        (\:(                          # pseudo classes
                          link|visited|active
                          |hover|focus
                          |lang
                          |target
                          |enabled|disabled|checked|indeterminate
                          |root
                          |nth-child|nth-last-child|nth-of-type|nth-last-of-type
                          |first-child|last-child|first-of-type|last-of-type
                          |only-child|only-of-type
                          |empty|contains
                        ))";

        $pattern_c = "  ((^|[\s\+\>\~]+)[\w]+       # elements
                        |
                        \:{1,2}(                    # pseudo-elements
                          after|before
                          |first-letter|first-line
                          |selection
                        )
                      )";

        return new static(
            preg_match_all("/{$pattern_a}/ix", $selector, $matches),
            preg_match_all("/{$pattern_b}/ix", $selector, $matches),
            preg_match_all("/{$pattern_c}/ix", $selector, $matches)
        );
    }

    /**
     * Returns <0 when $specificity is greater, 0 when equal, >0 when smaller
     *
     * @param Specificity $specificity
     * @return int
     */
    public function compareTo(Specificity $specificity)
    {
        if ($this->a !== $specificity->a) {
            return $this->a - $specificity->a;
        } elseif ($this->b !== $specificity->b) {
            return $this->b - $specificity->b;
        } else {
            return $this->c - $specificity->c;
        }
    }
}