Skip to content

Commit 2534780

Browse files
committed
Maintain coding standards
• I can’t stand it when spaces are used for tabs
1 parent 7675640 commit 2534780

20 files changed

+1990
-1990
lines changed

lib/Sabberworm/CSS/CSSList/CSSList.php

Lines changed: 106 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -15,121 +15,121 @@
1515
*/
1616
abstract class CSSList {
1717

18-
private $aContents;
18+
private $aContents;
1919

20-
public function __construct() {
21-
$this->aContents = array();
22-
}
20+
public function __construct() {
21+
$this->aContents = array();
22+
}
2323

24-
public function append($oItem) {
25-
$this->aContents[] = $oItem;
26-
}
24+
public function append($oItem) {
25+
$this->aContents[] = $oItem;
26+
}
2727

28-
/**
29-
* Removes an item from the CSS list.
30-
* @param RuleSet|Import|Charset|CSSList $oItemToRemove May be a RuleSet (most likely a DeclarationBlock), a Import, a Charset or another CSSList (most likely a MediaQuery)
31-
*/
32-
public function remove($oItemToRemove) {
33-
$iKey = array_search($oItemToRemove, $this->aContents, true);
34-
if ($iKey !== false) {
35-
unset($this->aContents[$iKey]);
36-
}
37-
}
28+
/**
29+
* Removes an item from the CSS list.
30+
* @param RuleSet|Import|Charset|CSSList $oItemToRemove May be a RuleSet (most likely a DeclarationBlock), a Import, a Charset or another CSSList (most likely a MediaQuery)
31+
*/
32+
public function remove($oItemToRemove) {
33+
$iKey = array_search($oItemToRemove, $this->aContents, true);
34+
if ($iKey !== false) {
35+
unset($this->aContents[$iKey]);
36+
}
37+
}
3838

39-
public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false) {
40-
if ($mSelector instanceof DeclarationBlock) {
41-
$mSelector = $mSelector->getSelectors();
42-
}
43-
if (!is_array($mSelector)) {
44-
$mSelector = explode(',', $mSelector);
45-
}
46-
foreach ($mSelector as $iKey => &$mSel) {
47-
if (!($mSel instanceof Selector)) {
48-
$mSel = new Selector($mSel);
49-
}
50-
}
51-
foreach ($this->aContents as $iKey => $mItem) {
52-
if (!($mItem instanceof DeclarationBlock)) {
53-
continue;
54-
}
55-
if ($mItem->getSelectors() == $mSelector) {
56-
unset($this->aContents[$iKey]);
57-
if (!$bRemoveAll) {
58-
return;
59-
}
60-
}
61-
}
62-
}
39+
public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false) {
40+
if ($mSelector instanceof DeclarationBlock) {
41+
$mSelector = $mSelector->getSelectors();
42+
}
43+
if (!is_array($mSelector)) {
44+
$mSelector = explode(',', $mSelector);
45+
}
46+
foreach ($mSelector as $iKey => &$mSel) {
47+
if (!($mSel instanceof Selector)) {
48+
$mSel = new Selector($mSel);
49+
}
50+
}
51+
foreach ($this->aContents as $iKey => $mItem) {
52+
if (!($mItem instanceof DeclarationBlock)) {
53+
continue;
54+
}
55+
if ($mItem->getSelectors() == $mSelector) {
56+
unset($this->aContents[$iKey]);
57+
if (!$bRemoveAll) {
58+
return;
59+
}
60+
}
61+
}
62+
}
6363

64-
public function __toString() {
65-
$sResult = '';
66-
foreach ($this->aContents as $oContent) {
67-
$sResult .= $oContent->__toString();
68-
}
69-
return $sResult;
70-
}
64+
public function __toString() {
65+
$sResult = '';
66+
foreach ($this->aContents as $oContent) {
67+
$sResult .= $oContent->__toString();
68+
}
69+
return $sResult;
70+
}
7171

72-
public function getContents() {
73-
return $this->aContents;
74-
}
72+
public function getContents() {
73+
return $this->aContents;
74+
}
7575

76-
protected function allDeclarationBlocks(&$aResult) {
77-
foreach ($this->aContents as $mContent) {
78-
if ($mContent instanceof DeclarationBlock) {
79-
$aResult[] = $mContent;
80-
} else if ($mContent instanceof CSSList) {
81-
$mContent->allDeclarationBlocks($aResult);
82-
}
83-
}
84-
}
76+
protected function allDeclarationBlocks(&$aResult) {
77+
foreach ($this->aContents as $mContent) {
78+
if ($mContent instanceof DeclarationBlock) {
79+
$aResult[] = $mContent;
80+
} else if ($mContent instanceof CSSList) {
81+
$mContent->allDeclarationBlocks($aResult);
82+
}
83+
}
84+
}
8585

86-
protected function allRuleSets(&$aResult) {
87-
foreach ($this->aContents as $mContent) {
88-
if ($mContent instanceof RuleSet) {
89-
$aResult[] = $mContent;
90-
} else if ($mContent instanceof CSSList) {
91-
$mContent->allRuleSets($aResult);
92-
}
93-
}
94-
}
86+
protected function allRuleSets(&$aResult) {
87+
foreach ($this->aContents as $mContent) {
88+
if ($mContent instanceof RuleSet) {
89+
$aResult[] = $mContent;
90+
} else if ($mContent instanceof CSSList) {
91+
$mContent->allRuleSets($aResult);
92+
}
93+
}
94+
}
9595

96-
protected function allValues($oElement, &$aResult, $sSearchString = null, $bSearchInFunctionArguments = false) {
97-
if ($oElement instanceof CSSList) {
98-
foreach ($oElement->getContents() as $oContent) {
99-
$this->allValues($oContent, $aResult, $sSearchString, $bSearchInFunctionArguments);
100-
}
101-
} else if ($oElement instanceof RuleSet) {
102-
foreach ($oElement->getRules($sSearchString) as $oRule) {
103-
$this->allValues($oRule, $aResult, $sSearchString, $bSearchInFunctionArguments);
104-
}
105-
} else if ($oElement instanceof Rule) {
106-
$this->allValues($oElement->getValue(), $aResult, $sSearchString, $bSearchInFunctionArguments);
107-
} else if ($oElement instanceof ValueList) {
108-
if ($bSearchInFunctionArguments || !($oElement instanceof CSSFunction)) {
109-
foreach ($oElement->getListComponents() as $mComponent) {
110-
$this->allValues($mComponent, $aResult, $sSearchString, $bSearchInFunctionArguments);
111-
}
112-
}
113-
} else {
114-
//Non-List Value or String (CSS identifier)
115-
$aResult[] = $oElement;
116-
}
117-
}
96+
protected function allValues($oElement, &$aResult, $sSearchString = null, $bSearchInFunctionArguments = false) {
97+
if ($oElement instanceof CSSList) {
98+
foreach ($oElement->getContents() as $oContent) {
99+
$this->allValues($oContent, $aResult, $sSearchString, $bSearchInFunctionArguments);
100+
}
101+
} else if ($oElement instanceof RuleSet) {
102+
foreach ($oElement->getRules($sSearchString) as $oRule) {
103+
$this->allValues($oRule, $aResult, $sSearchString, $bSearchInFunctionArguments);
104+
}
105+
} else if ($oElement instanceof Rule) {
106+
$this->allValues($oElement->getValue(), $aResult, $sSearchString, $bSearchInFunctionArguments);
107+
} else if ($oElement instanceof ValueList) {
108+
if ($bSearchInFunctionArguments || !($oElement instanceof CSSFunction)) {
109+
foreach ($oElement->getListComponents() as $mComponent) {
110+
$this->allValues($mComponent, $aResult, $sSearchString, $bSearchInFunctionArguments);
111+
}
112+
}
113+
} else {
114+
//Non-List Value or String (CSS identifier)
115+
$aResult[] = $oElement;
116+
}
117+
}
118118

119-
protected function allSelectors(&$aResult, $sSpecificitySearch = null) {
120-
foreach ($this->getAllDeclarationBlocks() as $oBlock) {
121-
foreach ($oBlock->getSelectors() as $oSelector) {
122-
if ($sSpecificitySearch === null) {
123-
$aResult[] = $oSelector;
124-
} else {
125-
$sComparison = "\$bRes = {$oSelector->getSpecificity()} $sSpecificitySearch;";
126-
eval($sComparison);
127-
if ($bRes) {
128-
$aResult[] = $oSelector;
129-
}
130-
}
131-
}
132-
}
133-
}
119+
protected function allSelectors(&$aResult, $sSpecificitySearch = null) {
120+
foreach ($this->getAllDeclarationBlocks() as $oBlock) {
121+
foreach ($oBlock->getSelectors() as $oSelector) {
122+
if ($sSpecificitySearch === null) {
123+
$aResult[] = $oSelector;
124+
} else {
125+
$sComparison = "\$bRes = {$oSelector->getSpecificity()} $sSpecificitySearch;";
126+
eval($sComparison);
127+
if ($bRes) {
128+
$aResult[] = $oSelector;
129+
}
130+
}
131+
}
132+
}
133+
}
134134

135135
}

lib/Sabberworm/CSS/CSSList/MediaQuery.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@
77
*/
88
class MediaQuery extends CSSList {
99

10-
private $sQuery;
11-
12-
public function __construct() {
13-
parent::__construct();
14-
$this->sQuery = null;
15-
}
16-
17-
public function setQuery($sQuery) {
18-
$this->sQuery = $sQuery;
19-
}
20-
21-
public function getQuery() {
22-
return $this->sQuery;
23-
}
24-
25-
public function __toString() {
26-
$sResult = "@media {$this->sQuery} {";
27-
$sResult .= parent::__toString();
28-
$sResult .= '}';
29-
return $sResult;
30-
}
10+
private $sQuery;
11+
12+
public function __construct() {
13+
parent::__construct();
14+
$this->sQuery = null;
15+
}
16+
17+
public function setQuery($sQuery) {
18+
$this->sQuery = $sQuery;
19+
}
20+
21+
public function getQuery() {
22+
return $this->sQuery;
23+
}
24+
25+
public function __toString() {
26+
$sResult = "@media {$this->sQuery} {";
27+
$sResult .= parent::__toString();
28+
$sResult .= '}';
29+
return $sResult;
30+
}
3131

3232
}

0 commit comments

Comments
 (0)