updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -11,7 +11,8 @@ class Processor
* Get the rules from a given CSS-string
*
* @param string $css
* @param array $existingRules
* @param Rule[] $existingRules
*
* @return Rule[]
*/
public function getRules($css, $existingRules = array())
@@ -27,6 +28,7 @@ class Processor
* Get the CSS from the style-tags in the given HTML-string
*
* @param string $html
*
* @return string
*/
public function getCssFromStyleTags($html)
@@ -47,6 +49,7 @@ class Processor
/**
* @param string $css
*
* @return string
*/
private function doCleanup($css)

View File

@@ -7,10 +7,11 @@ use Symfony\Component\CssSelector\Node\Specificity;
class Processor
{
/**
* Split a string into seperate properties
* Split a string into separate properties
*
* @param string $propertiesString
* @return array
*
* @return string[]
*/
public function splitIntoSeparateProperties($propertiesString)
{
@@ -40,8 +41,9 @@ class Processor
}
/**
* @param $string
* @return mixed|string
* @param string $string
*
* @return string
*/
private function cleanup($string)
{
@@ -58,9 +60,10 @@ class Processor
}
/**
* Convert a property-string into an object
* Converts a property-string into an object
*
* @param string $property
*
* @return Property|null
*/
public function convertToObject($property, Specificity $specificity = null)
@@ -82,9 +85,10 @@ class Processor
}
/**
* Convert an array of property-strings into objects
* Converts an array of property-strings into objects
*
* @param string[] $properties
*
* @param array $properties
* @return Property[]
*/
public function convertArrayToObjects(array $properties, Specificity $specificity = null)
@@ -106,7 +110,8 @@ class Processor
/**
* Build the property-string for multiple properties
*
* @param array $properties
* @param Property[] $properties
*
* @return string
*/
public function buildPropertiesString(array $properties)

View File

@@ -23,8 +23,8 @@ final class Property
/**
* Property constructor.
* @param $name
* @param $value
* @param string $name
* @param string $value
* @param Specificity|null $specificity
*/
public function __construct($name, $value, Specificity $specificity = null)

View File

@@ -8,10 +8,11 @@ use \TijsVerkoyen\CssToInlineStyles\Css\Property\Processor as PropertyProcessor;
class Processor
{
/**
* Split a string into seperate rules
* Splits a string into separate rules
*
* @param string $rulesString
* @return array
*
* @return string[]
*/
public function splitIntoSeparateRules($rulesString)
{
@@ -22,6 +23,7 @@ class Processor
/**
* @param string $string
*
* @return string
*/
private function cleanup($string)
@@ -39,11 +41,12 @@ class Processor
}
/**
* Convert a rule-string into an object
* Converts a rule-string into an object
*
* @param string $rule
* @param int $originalOrder
* @return array
*
* @return Rule[]
*/
public function convertToObjects($rule, $originalOrder)
{
@@ -74,11 +77,13 @@ class Processor
}
/**
* Calculate the specificity based on a CSS Selector string,
* Calculates 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 Specificity
*/
public function calculateSpecificityBasedOnASelector($selector)
@@ -118,7 +123,9 @@ class Processor
}
/**
* @param array $rules
* @param string[] $rules
* @param Rule[] $objects
*
* @return Rule[]
*/
public function convertArrayToObjects(array $rules, array $objects = array())
@@ -133,12 +140,13 @@ class Processor
}
/**
* Sort an array on the specificity element in an ascending way
* Sorts an array on the specificity element in an ascending way
* Lower specificity will be sorted to the beginning of the array
*
* @param Rule $e1 The first element.
* @param Rule $e2 The second element.
*
* @return int
* @param Rule $e1 The first element.
* @param Rule $e2 The second element.
*/
public static function sortOnSpecificity(Rule $e1, Rule $e2)
{

View File

@@ -3,6 +3,7 @@
namespace TijsVerkoyen\CssToInlineStyles\Css\Rule;
use Symfony\Component\CssSelector\Node\Specificity;
use TijsVerkoyen\CssToInlineStyles\Css\Property\Property;
final class Rule
{
@@ -12,7 +13,7 @@ final class Rule
private $selector;
/**
* @var array
* @var Property[]
*/
private $properties;
@@ -55,7 +56,7 @@ final class Rule
/**
* Get properties
*
* @return array
* @return Property[]
*/
public function getProperties()
{

View File

@@ -8,7 +8,6 @@ use Symfony\Component\CssSelector\Exception\ExceptionInterface;
use TijsVerkoyen\CssToInlineStyles\Css\Processor;
use TijsVerkoyen\CssToInlineStyles\Css\Property\Processor as PropertyProcessor;
use TijsVerkoyen\CssToInlineStyles\Css\Rule\Processor as RuleProcessor;
use TijsVerkoyen\CssToInlineStyles\Css\Rule\Rule;
class CssToInlineStyles
{
@@ -29,6 +28,7 @@ class CssToInlineStyles
*
* @param string $html
* @param string $css
*
* @return string
*/
public function convert($html, $css = null)
@@ -55,6 +55,7 @@ class CssToInlineStyles
*
* @param \DOMElement $element
* @param Css\Property\Property[] $properties
*
* @return \DOMElement
*/
public function inlineCssOnElement(\DOMElement $element, array $properties)
@@ -89,6 +90,7 @@ class CssToInlineStyles
* Get the current inline styles for a given DOMElement
*
* @param \DOMElement $element
*
* @return Css\Property\Property[]
*/
public function getInlineStyles(\DOMElement $element)
@@ -104,13 +106,14 @@ class CssToInlineStyles
/**
* @param string $html
*
* @return \DOMDocument
*/
protected function createDomDocumentFromHtml($html)
{
$document = new \DOMDocument('1.0', 'UTF-8');
$internalErrors = libxml_use_internal_errors(true);
$document->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
$document->loadHTML(mb_encode_numericentity($html, [0x80, 0x10FFFF, 0, 0x1FFFFF], 'UTF-8'));
libxml_use_internal_errors($internalErrors);
$document->formatOutput = true;
@@ -119,6 +122,7 @@ class CssToInlineStyles
/**
* @param \DOMDocument $document
*
* @return string
*/
protected function getHtmlFromDocument(\DOMDocument $document)
@@ -145,6 +149,7 @@ class CssToInlineStyles
/**
* @param \DOMDocument $document
* @param Css\Rule\Rule[] $rules
*
* @return \DOMDocument
*/
protected function inline(\DOMDocument $document, array $rules)