Skip to content

Commit 7380241

Browse files
committed
Keep it php 5.6 compatible
1 parent 0050567 commit 7380241

10 files changed

+42
-32
lines changed

AspectPropertyValue.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
*/
3333
class AspectPropertyValue
3434
{
35-
private $value;
36-
private $noValueMessage;
37-
public $hasValue;
35+
private $_value;
36+
public $noValueMessage = null;
37+
public $hasValue = false;
3838

3939
/**
4040
* Constructor for AspectPropertyValue
@@ -64,12 +64,18 @@ public function __get($key)
6464
{
6565
if ($key === "value") {
6666
if ($this->hasValue) {
67-
return $this->value;
68-
} else {
69-
throw new \Exception(
70-
empty($this->noValueMessage) ? '' : $this->noValueMessage
71-
);
67+
return $this->_value;
68+
} else if (!empty($this->noValueMessage)) {
69+
throw new \Exception($this->noValueMessage);
7270
}
7371
}
7472
}
73+
74+
public function __set($key, $value)
75+
{
76+
if ($key === "value") {
77+
$this->_value = $value;
78+
$this->hasValue = true;
79+
}
80+
}
7581
}

BasicListEvidenceKeyFilter.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,13 @@ public function __construct($list)
4949
*/
5050
public function filterEvidenceKey($key)
5151
{
52-
$keep = false;
53-
5452
foreach ($this->list as $evidenceKey) {
5553
if (strtolower($key) === strtolower($evidenceKey)) {
56-
$keep = true;
54+
return true;
5755
}
5856
}
5957

60-
return $keep;
58+
return false;
6159
}
6260

6361
/**

ElementDataDictionary.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
**/
3131
class ElementDataDictionary extends ElementData
3232
{
33-
private $contents;
33+
public $contents;
3434

3535
/**
3636
* Constructor for element data dictionary

EvidenceKeyFilter.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*/
3333
class EvidenceKeyFilter
3434
{
35-
public $filterEvidenceKey;
35+
private $_filterEvidenceKey = null;
3636

3737
/**
3838
* filterevidence from an object
@@ -59,6 +59,17 @@ public function filterEvidence($evidenceKeyObject)
5959
*/
6060
public function filterEvidenceKey($key)
6161
{
62+
if ($this->_filterEvidenceKey) {
63+
return call_user_func($this->_filterEvidenceKey, $key);
64+
}
65+
6266
return true;
6367
}
68+
69+
public function __set($name, $value)
70+
{
71+
if ($name === 'filterEvidenceKey') {
72+
$this->_filterEvidenceKey = $value;
73+
}
74+
}
6475
}

FlowElement.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,11 @@
3232
**/
3333
class FlowElement
3434
{
35-
public $pipelines;
36-
37-
public function __construct()
38-
{
39-
40-
// List of Pipelines the FlowElement has been added to
41-
$this->pipelines = [];
42-
}
43-
4435
public $dataKey;
4536
public $properties = [];
46-
37+
// List of Pipelines the FlowElement has been added to
38+
public $pipelines = [];
39+
4740
/**
4841
* General wrapper function that calls a FlowElement's processInternal method
4942
* @param FlowData

JavascriptBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
*/
3737
class JavascriptBuilderElement extends FlowElement
3838
{
39-
private $settings;
40-
private $minify;
39+
public $settings;
40+
public $minify;
4141

4242
public function __construct($settings = array())
4343
{

Pipeline.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Pipeline
3636
public $logger;
3737
public $metaDataStore;
3838
public $suppressProcessExceptions;
39-
private $propertyDatabase;
39+
public $propertyDatabase;
4040

4141
/**
4242
* Pipeline constructor

PipelineBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
class PipelineBuilder
3232
{
3333
public $pipelines;
34-
private $addJavaScriptBuilder;
35-
private $javascriptBuilderSettings;
36-
private $useSetHeaderProperties;
34+
public $addJavaScriptBuilder;
35+
public $javascriptBuilderSettings;
36+
public $useSetHeaderProperties;
3737

3838
public function __construct($settings = array())
3939
{

SetHeaderElement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,14 @@ public function getPropertyValue($flowData, $elementKey, $propertyKey){
153153

154154
$propertyKey = strtolower($propertyKey);
155155
try {
156-
$property = $elementData->$propertyKey;
156+
$property = isset($elementData->$propertyKey) ? $elementData->$propertyKey : null;
157157
}
158158
catch (Exception $e) {
159159
echo sprintf(Messages::PROPERTY_NOT_FOUND, $propertyKey, $elementKey);
160160
return "";
161161
}
162162

163-
if($property->hasValue && !in_array($property->value, ["Unknown", "noValue"])){
163+
if($property && $property->hasValue && !in_array($property->value, ["Unknown", "noValue"])){
164164
$value = $property->value;
165165
}
166166
else{

tests/JavaScriptBundlerTests.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ public function processInternal($FlowData)
6767

6868
class TestPipeline
6969
{
70+
public $Pipeline;
71+
7072
public function __construct($minify = NULL)
7173
{
7274
if (is_null($minify)) {

0 commit comments

Comments
 (0)