File tree 3 files changed +29
-3
lines changed
3 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,17 @@ class Linter
65
65
*/
66
66
protected $ comment = false ;
67
67
68
+ /**
69
+ * Constructor
70
+ * @param \CssLint\Properties $oProperties (optional) an instance of the "\CssLint\Properties" helper
71
+ */
72
+ public function __construct (\CssLint \Properties $ oProperties = null )
73
+ {
74
+ if ($ oProperties ) {
75
+ $ this ->setCssLintProperties ($ oProperties );
76
+ }
77
+ }
78
+
68
79
/**
69
80
* Performs lint on a given string
70
81
* @param string $sString
@@ -666,11 +677,19 @@ protected function setComment(bool $bComment): void
666
677
* Return an instance of the "\CssLint\Properties" helper, initialize a new one if not define already
667
678
* @return \CssLint\Properties
668
679
*/
669
- public function getCssLintProperties (): Properties
680
+ public function getCssLintProperties (): \ CssLint \ Properties
670
681
{
671
682
if (!$ this ->cssLintProperties ) {
672
- $ this ->cssLintProperties = new \CssLint \Properties ();
683
+ $ this ->setCssLintProperties ( new \CssLint \Properties () );
673
684
}
674
685
return $ this ->cssLintProperties ;
675
686
}
687
+
688
+ /**
689
+ * Set an instance of the "\CssLint\Properties" helper
690
+ */
691
+ public function setCssLintProperties (\CssLint \Properties $ oCssLintProperties ): void
692
+ {
693
+ $ this ->cssLintProperties = $ oCssLintProperties ;
694
+ }
676
695
}
Original file line number Diff line number Diff line change 1
- C:37:"PHPUnit\Runner\DefaultTestResultCache":1210:{a:2:{s:7:"defects";a:3:{s:54:"TestSuite\LinterTest::testLintStringWithWrongTypeParam";i:3;s:52:"TestSuite\LinterTest::testLintFileWithWrongTypeParam";i:3;s:57:"TestSuite\LinterTest::testLintFileWithUnkownFilePathParam";i:6;}s:5:"times";a:14:{s:41:"TestSuite\LinterTest::testLintValidString";d:0.016;s:44:"TestSuite\LinterTest::testLintNotValidString";d:0.002;s:59:"TestSuite\LinterTest::testLintStringWithUnterminatedContext";d:0;s:64:"TestSuite\LinterTest::testLintStringWithWrongSelectorDoubleComma";d:0;s:63:"TestSuite\LinterTest::testLintStringWithWrongSelectorDoubleHash";d:0;s:72:"TestSuite\LinterTest::testLintStringWithWrongPropertyNameUnexpectedToken";d:0.001;s:68:"TestSuite\LinterTest::testLintStringWithWrongSelectorUnexpectedToken";d:0;s:54:"TestSuite\LinterTest::testLintStringWithWrongTypeParam";d:0.001;s:52:"TestSuite\LinterTest::testLintFileWithWrongTypeParam";d:0;s:57:"TestSuite\LinterTest::testLintFileWithUnkownFilePathParam";d:0;s:46:"TestSuite\LinterTest::testLintBootstrapCssFile";d:2.773;s:47:"TestSuite\LinterTest::testLintFoundationCssFile";d:2.293;s:45:"TestSuite\LinterTest::testLintNotValidCssFile";d:0.012;s:58:"TestSuite\LinterTest::testLintFileWithUnknownFilePathParam";d:0;}}}
1
+ C:37:"PHPUnit\Runner\DefaultTestResultCache":1362:{a:2:{s:7:"defects";a:4:{s:54:"TestSuite\LinterTest::testLintStringWithWrongTypeParam";i:3;s:52:"TestSuite\LinterTest::testLintFileWithWrongTypeParam";i:3;s:57:"TestSuite\LinterTest::testLintFileWithUnkownFilePathParam";i:6;s:62:"TestSuite\LinterTest::testConstructWithCustomCssLintProperties";i:3;}s:5:"times";a:15:{s:41:"TestSuite\LinterTest::testLintValidString";d:0.009;s:44:"TestSuite\LinterTest::testLintNotValidString";d:0.002;s:59:"TestSuite\LinterTest::testLintStringWithUnterminatedContext";d:0;s:64:"TestSuite\LinterTest::testLintStringWithWrongSelectorDoubleComma";d:0;s:63:"TestSuite\LinterTest::testLintStringWithWrongSelectorDoubleHash";d:0;s:72:"TestSuite\LinterTest::testLintStringWithWrongPropertyNameUnexpectedToken";d:0.001;s:68:"TestSuite\LinterTest::testLintStringWithWrongSelectorUnexpectedToken";d:0;s:54:"TestSuite\LinterTest::testLintStringWithWrongTypeParam";d:0.001;s:52:"TestSuite\LinterTest::testLintFileWithWrongTypeParam";d:0;s:57:"TestSuite\LinterTest::testLintFileWithUnkownFilePathParam";d:0;s:46:"TestSuite\LinterTest::testLintBootstrapCssFile";d:2.749;s:47:"TestSuite\LinterTest::testLintFoundationCssFile";d:2.171;s:45:"TestSuite\LinterTest::testLintNotValidCssFile";d:0.008;s:58:"TestSuite\LinterTest::testLintFileWithUnknownFilePathParam";d:0;s:62:"TestSuite\LinterTest::testConstructWithCustomCssLintProperties";d:0.006;}}}
Original file line number Diff line number Diff line change @@ -15,6 +15,13 @@ protected function setUp() : void
15
15
$ this ->linter = new \CssLint \Linter ();
16
16
}
17
17
18
+ public function testConstructWithCustomCssLintProperties ()
19
+ {
20
+ $ oProperties = new \CssLint \Properties ();
21
+ $ oLinter = new \CssLint \Linter ($ oProperties );
22
+ $ this ->assertSame ($ oProperties , $ oLinter ->getCssLintProperties ());
23
+ }
24
+
18
25
public function testLintValidString ()
19
26
{
20
27
$ this ->assertTrue ($ this ->linter ->lintString ('.button.dropdown::after {
You can’t perform that action at this time.
0 commit comments