Skip to content

Commit d871c82

Browse files
committedJun 14, 2016
Data cursor names unificated
1 parent 66b8161 commit d871c82

15 files changed

+45
-45
lines changed
 

‎src/Pointer/Evaluate/LocatorEvaluate.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ abstract class LocatorEvaluate
4646
*
4747
* @var mixed
4848
*/
49-
protected $cursor;
49+
protected $dataCursor;
5050

5151
/**
5252
* Evaluation result.
@@ -203,7 +203,7 @@ public function forbidNonNumericIndices()
203203
*/
204204
public function perform()
205205
{
206-
$this->cursor = &$this->getData();
206+
$this->dataCursor = &$this->getData();
207207
$this->resetResult();
208208
foreach ($this->getLocator()->getReferenceList() as $reference) {
209209
$this->processReference($reference);
@@ -227,10 +227,10 @@ public function perform()
227227
*/
228228
protected function createReferenceEvaluate(Reference $reference)
229229
{
230-
if (is_object($this->cursor)) {
230+
if (is_object($this->dataCursor)) {
231231
return $this->createReferenceEvaluateProperty($reference);
232232
}
233-
if (is_array($this->cursor)) {
233+
if (is_array($this->dataCursor)) {
234234
return $this->createReferenceEvaluateIndex($reference);
235235
}
236236
return $this->createReferenceEvaluateScalar($reference);
@@ -286,7 +286,7 @@ protected function setupReferenceEvaluate(Reference $reference)
286286
{
287287
$this->referenceEvaluate = $this
288288
->createReferenceEvaluate($reference)
289-
->setData($this->cursor);
289+
->setDataCursor($this->dataCursor);
290290
return $this;
291291
}
292292

@@ -330,9 +330,9 @@ protected function processReferenceEvaluate(Reference $reference)
330330
->setupReferenceEvaluate($reference)
331331
->getReferenceEvaluate()
332332
->perform();
333-
$this->cursor = &$this
333+
$this->dataCursor = &$this
334334
->getReferenceEvaluate()
335-
->getData();
335+
->getDataCursor();
336336
$isReferenceResultSet = $this
337337
->getReferenceEvaluate()
338338
->isResultSet();

‎src/Pointer/Evaluate/LocatorRead.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class LocatorRead extends LocatorEvaluate
1010

1111
protected function processCursor()
1212
{
13-
return $this->setResult($this->cursor);
13+
return $this->setResult($this->dataCursor);
1414
}
1515

1616

‎src/Pointer/Evaluate/LocatorWrite.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function forbidNumericIndexGaps()
5050

5151
protected function processCursor()
5252
{
53-
$this->cursor = $this->getValue();
53+
$this->dataCursor = $this->getValue();
5454
$result = null;
5555
return $this->setResult($result);
5656
}

‎src/Pointer/Evaluate/ReferenceEvaluate.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ abstract class ReferenceEvaluate
2020
*
2121
* @var mixed
2222
*/
23-
protected $data;
24-
25-
protected $result;
26-
27-
protected $isResultSet;
23+
protected $dataCursor;
2824

2925
/**
3026
* Flag of having data set.
3127
*
3228
* @var bool
3329
*/
34-
protected $isDataSet = false;
30+
protected $isDataCursorSet = false;
31+
32+
protected $result;
33+
34+
protected $isResultSet;
3535

3636
abstract protected function doesExist();
3737

@@ -86,20 +86,20 @@ protected function getReference()
8686
}
8787

8888

89-
public function setData(&$data)
89+
public function setDataCursor(&$dataCursor)
9090
{
91-
$this->data = &$data;
92-
$this->isDataSet = true;
91+
$this->dataCursor = &$dataCursor;
92+
$this->isDataCursorSet = true;
9393
return $this;
9494
}
9595

9696

97-
public function &getData()
97+
public function &getDataCursor()
9898
{
99-
if (!$this->isDataSet) {
99+
if (!$this->isDataCursorSet) {
100100
throw new LogicException("Data is not set in reference evaluator");
101101
}
102-
return $this->data;
102+
return $this->dataCursor;
103103
}
104104

105105

‎src/Pointer/Evaluate/ReferenceReadAllowedNonNumericIndex.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ class ReferenceReadAllowedNonNumericIndex extends ReferenceEvaluate
88

99
protected function doesExist()
1010
{
11-
return array_key_exists($this->getIndex(), $this->getData());
11+
return array_key_exists($this->getIndex(), $this->getDataCursor());
1212
}
1313

1414

1515
protected function performExisting()
1616
{
17-
$this->data = &$this->data[$this->getIndex()];
17+
$this->dataCursor = &$this->dataCursor[$this->getIndex()];
1818
return $this;
1919
}
2020

‎src/Pointer/Evaluate/ReferenceReadNumericIndex.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ class ReferenceReadNumericIndex extends ReferenceEvaluate
88

99
protected function doesExist()
1010
{
11-
return array_key_exists($this->getIndex(), $this->getData());
11+
return array_key_exists($this->getIndex(), $this->getDataCursor());
1212
}
1313

1414

1515
protected function performExisting()
1616
{
17-
$this->data = &$this->data[$this->getIndex()];
17+
$this->dataCursor = &$this->dataCursor[$this->getIndex()];
1818
return $this;
1919
}
2020

‎src/Pointer/Evaluate/ReferenceReadProperty.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ class ReferenceReadProperty extends ReferenceEvaluate
88

99
protected function doesExist()
1010
{
11-
return property_exists($this->getData(), $this->getProperty());
11+
return property_exists($this->getDataCursor(), $this->getProperty());
1212
}
1313

1414

1515
protected function performExisting()
1616
{
17-
$this->data = &$this->data->{$this->getProperty()};
17+
$this->dataCursor = &$this->dataCursor->{$this->getProperty()};
1818
return $this;
1919
}
2020

‎src/Pointer/Evaluate/ReferenceTestAllowedNonNumericIndex.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ class ReferenceTestAllowedNonNumericIndex extends ReferenceEvaluate
88

99
protected function doesExist()
1010
{
11-
return array_key_exists($this->getIndex(), $this->getData());
11+
return array_key_exists($this->getIndex(), $this->getDataCursor());
1212
}
1313

1414

1515
protected function performExisting()
1616
{
17-
$this->data = &$this->data[$this->getIndex()];
17+
$this->dataCursor = &$this->dataCursor[$this->getIndex()];
1818
return $this;
1919
}
2020

‎src/Pointer/Evaluate/ReferenceTestNumericIndex.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ class ReferenceTestNumericIndex extends ReferenceEvaluate
88

99
protected function doesExist()
1010
{
11-
return array_key_exists($this->getIndex(), $this->getData());
11+
return array_key_exists($this->getIndex(), $this->getDataCursor());
1212
}
1313

1414

1515
protected function performExisting()
1616
{
17-
$this->data = &$this->data[$this->getIndex()];
17+
$this->dataCursor = &$this->dataCursor[$this->getIndex()];
1818
return $this;
1919
}
2020

‎src/Pointer/Evaluate/ReferenceTestProperty.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ class ReferenceTestProperty extends ReferenceEvaluate
88

99
protected function doesExist()
1010
{
11-
return property_exists($this->getData(), $this->getProperty());
11+
return property_exists($this->getDataCursor(), $this->getProperty());
1212
}
1313

1414

1515
protected function performExisting()
1616
{
17-
$this->data = &$this->data->{$this->getProperty()};
17+
$this->dataCursor = &$this->dataCursor->{$this->getProperty()};
1818
return $this;
1919
}
2020

‎src/Pointer/Evaluate/ReferenceWriteAllowedNonNumericIndex.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ class ReferenceWriteAllowedNonNumericIndex extends ReferenceWrite
88

99
protected function doesExist()
1010
{
11-
return array_key_exists($this->getIndex(), $this->getData());
11+
return array_key_exists($this->getIndex(), $this->getDataCursor());
1212
}
1313

1414

1515
protected function performExisting()
1616
{
17-
$this->data = &$this->data[$this->getIndex()];
17+
$this->dataCursor = &$this->dataCursor[$this->getIndex()];
1818
return $this;
1919
}
2020

@@ -26,7 +26,7 @@ protected function performNonExisting()
2626
"Cannot write to non-existing index '{$this->getIndex()}'' in array"
2727
);
2828
}
29-
$this->data[$this->getIndex()] = $this->getValue();
29+
$this->dataCursor[$this->getIndex()] = $this->getValue();
3030
$result = null;
3131
return $this->setResult($result);
3232
}

‎src/Pointer/Evaluate/ReferenceWriteNextIndex.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function performNonExisting()
2323
if (!$this->canPerformNonExisting()) {
2424
throw new EvaluateException("Cannot write to non-existing next index of array if it is not last");
2525
}
26-
$this->data[] = $this->getValue();
26+
$this->dataCursor[] = $this->getValue();
2727
$result = null;
2828
return $this->setResult($result);
2929
}

‎src/Pointer/Evaluate/ReferenceWriteNumericIndex.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ abstract protected function canPerformNonExisting();
1010

1111
protected function doesExist()
1212
{
13-
return array_key_exists($this->getIndex(), $this->getData());
13+
return array_key_exists($this->getIndex(), $this->getDataCursor());
1414
}
1515

1616

1717
protected function performExisting()
1818
{
19-
$this->data = &$this->data[$this->getIndex()];
19+
$this->dataCursor = &$this->dataCursor[$this->getIndex()];
2020
return $this;
2121
}
2222

@@ -28,7 +28,7 @@ protected function performNonExisting()
2828
$indexText = is_int($index) ? "{$index}" : "'{$index}'";
2929
throw new EvaluateException("Cannot write to non-existing index {$indexText} in array");
3030
}
31-
$this->data[$index] = $this->getValue();
31+
$this->dataCursor[$index] = $this->getValue();
3232
$result = null;
3333
return $this->setResult($result);
3434
}

‎src/Pointer/Evaluate/ReferenceWriteNumericIndexWithoutGaps.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ protected function canPerformNonExisting()
1212
->isLast();
1313
if ($isLastReference) {
1414
return
15-
0 == $this->getIndex() && empty($this->data) ||
16-
array_key_exists($this->getIndex() - 1, $this->data);
15+
0 == $this->getIndex() && empty($this->dataCursor) ||
16+
array_key_exists($this->getIndex() - 1, $this->dataCursor);
1717
}
1818
return false;
1919
}

‎src/Pointer/Evaluate/ReferenceWriteProperty.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ class ReferenceWriteProperty extends ReferenceWrite
88

99
protected function doesExist()
1010
{
11-
return property_exists($this->getData(), $this->getProperty());
11+
return property_exists($this->getDataCursor(), $this->getProperty());
1212
}
1313

1414

1515
protected function performExisting()
1616
{
17-
$this->data = &$this->data->{$this->getProperty()};
17+
$this->dataCursor = &$this->dataCursor->{$this->getProperty()};
1818
return $this;
1919
}
2020

@@ -24,7 +24,7 @@ protected function performNonExisting()
2424
if (!$this->canPerformNonExisting()) {
2525
throw new EvaluateException("Cannot write to non-existing property if it is not last");
2626
}
27-
$this->data->{$this->getProperty()} = $this->getValue();
27+
$this->dataCursor->{$this->getProperty()} = $this->getValue();
2828
$result = null;
2929
return $this->setResult($result);
3030
}

0 commit comments

Comments
 (0)