File tree 8 files changed +25
-24
lines changed
8 files changed +25
-24
lines changed Original file line number Diff line number Diff line change @@ -13,4 +13,5 @@ ratings:
13
13
paths :
14
14
- " **.php"
15
15
exclude_paths :
16
+ - build/
16
17
- tests/
Original file line number Diff line number Diff line change 1
1
# PHP JSON Pointer
2
2
3
- [ ![ Build Status] ( https://travis-ci.org/remorhaz/php-json-pointer.svg?branch=master )] ( https://travis-ci.org/remorhaz/php-json-pointer )
4
3
[ ![ Latest Stable Version] ( https://poser.pugx.org/remorhaz/php-json-pointer/v/stable )] ( https://packagist.org/packages/remorhaz/php-json-pointer )
5
4
[ ![ License] ( https://poser.pugx.org/remorhaz/php-json-pointer/license )] ( https://packagist.org/packages/remorhaz/php-json-pointer )
5
+ [ ![ Build Status] ( https://travis-ci.org/remorhaz/php-json-pointer.svg?branch=master )] ( https://travis-ci.org/remorhaz/php-json-pointer )
6
6
[ ![ Code Climate] ( https://codeclimate.com/github/remorhaz/php-json-pointer/badges/gpa.svg )] ( https://codeclimate.com/github/remorhaz/php-json-pointer )
7
7
[ ![ Test Coverage] ( https://codeclimate.com/github/remorhaz/php-json-pointer/badges/coverage.svg )] ( https://codeclimate.com/github/remorhaz/php-json-pointer/coverage )
8
8
Original file line number Diff line number Diff line change 3
3
bootstrap =" vendor/autoload.php"
4
4
colors =" true" >
5
5
<testsuites >
6
- <testsuite name =" Library Test Suite" >
6
+ <testsuite name =" Full Test Suite" >
7
7
<directory >tests/</directory >
8
8
</testsuite >
9
9
</testsuites >
10
10
<filter >
11
- <whitelist >
11
+ <whitelist
12
+ getUncoveredFilesFromWhitelist =" true"
13
+ processUncoveredFilesFromWhitelist =" true" >
12
14
<directory suffix =" .php" >src/</directory >
13
15
</whitelist >
14
16
</filter >
Original file line number Diff line number Diff line change @@ -57,17 +57,15 @@ public function getReferenceList()
57
57
public function addReference (Locator \Reference $ reference )
58
58
{
59
59
$ this ->referenceList [] = $ reference ;
60
- if (null === $ this ->lastReference ) {
61
- $ pathPrefix = '' ;
62
- } else {
63
- $ pathPrefix = $ this
60
+ $ pathPrefix = null === $ this ->lastReference
61
+ ? ''
62
+ : $ this
64
63
->lastReference
65
- ->setLast (false )
64
+ ->setIsLast (false )
66
65
->getPath ();
67
- }
68
66
69
67
$ this ->lastReference = $ reference
70
- ->setLast ()
68
+ ->setIsLast ()
71
69
->setPath ("{$ pathPrefix }/ {$ reference ->getText ()}" );
72
70
return $ this ;
73
71
}
Original file line number Diff line number Diff line change @@ -173,12 +173,12 @@ public function isLast()
173
173
}
174
174
175
175
176
- public function setLast ( $ on = true )
176
+ public function setIsLast ( $ isLast = true )
177
177
{
178
- if (!is_bool ($ on )) {
178
+ if (!is_bool ($ isLast )) {
179
179
throw new Reference \InvalidArgumentException ("Reference value must be boolean " );
180
180
}
181
- $ this ->isLast = $ on ;
181
+ $ this ->isLast = $ isLast ;
182
182
return $ this ;
183
183
}
184
184
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ public function unsetData()
134
134
public function test ()
135
135
{
136
136
return Pointer \Evaluate \Test::factory ()
137
- ->setAllowedNonNumericArrayIndices ($ this ->hasOption (self ::OPTION_NON_NUMERIC_ARRAY_INDICES ))
137
+ ->setNonNumericArrayIndices ($ this ->hasOption (self ::OPTION_NON_NUMERIC_ARRAY_INDICES ))
138
138
->setLocator ($ this ->getLocator ())
139
139
->setData ($ this ->getData ())
140
140
->perform ()
@@ -144,7 +144,7 @@ public function test()
144
144
public function &read ()
145
145
{
146
146
return Pointer \Evaluate \Read::factory ()
147
- ->setAllowedNonNumericArrayIndices ($ this ->hasOption (self ::OPTION_NON_NUMERIC_ARRAY_INDICES ))
147
+ ->setNonNumericArrayIndices ($ this ->hasOption (self ::OPTION_NON_NUMERIC_ARRAY_INDICES ))
148
148
->setLocator ($ this ->getLocator ())
149
149
->setData ($ this ->getData ())
150
150
->perform ()
@@ -155,7 +155,7 @@ public function &read()
155
155
public function write ($ value )
156
156
{
157
157
Pointer \Evaluate \Write::factory ()
158
- ->setAllowedNonNumericArrayIndices ($ this ->hasOption (self ::OPTION_NON_NUMERIC_ARRAY_INDICES ))
158
+ ->setNonNumericArrayIndices ($ this ->hasOption (self ::OPTION_NON_NUMERIC_ARRAY_INDICES ))
159
159
->setLocator ($ this ->getLocator ())
160
160
->setData ($ this ->getData ())
161
161
->setValue ($ value )
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ abstract class Evaluate
55
55
*/
56
56
protected $ result ;
57
57
58
- protected $ areAllowedNonNumericArrayIndices = false ;
58
+ protected $ nonNumericArrayIndices = false ;
59
59
60
60
61
61
/**
@@ -176,12 +176,12 @@ public function &getResult()
176
176
}
177
177
178
178
179
- public function setAllowedNonNumericArrayIndices ( $ on = true )
179
+ public function setNonNumericArrayIndices ( $ allow = true )
180
180
{
181
- if (!is_bool ($ on )) {
181
+ if (!is_bool ($ allow )) {
182
182
throw new Evaluate \InvalidArgumentException ("Non-numeric array indices allowance flag must be boolean " );
183
183
}
184
- $ this ->areAllowedNonNumericArrayIndices = $ on ;
184
+ $ this ->nonNumericArrayIndices = $ allow ;
185
185
return $ this ;
186
186
}
187
187
@@ -267,7 +267,7 @@ protected function processArrayIndex(Reference $reference)
267
267
return $ this ->processNumericArrayIndex ($ reference );
268
268
269
269
default :
270
- return $ this ->areAllowedNonNumericArrayIndices
270
+ return $ this ->nonNumericArrayIndices
271
271
? $ this ->processAllowedNonNumericArrayIndex ($ reference )
272
272
: $ this ->processNotAllowedNonNumericArrayIndex ($ reference );
273
273
}
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ public function testAccessingUninitializedIsLastThrowsSplException()
32
32
*/
33
33
public function testGotIsLastSameAsSet ($ on )
34
34
{
35
- $ reference = Reference::factory ()->setLast ($ on );
35
+ $ reference = Reference::factory ()->setIsLast ($ on );
36
36
$ this ->assertSame ($ on , $ reference ->isLast (), "Got last reference flag differs from the one that was set " );
37
37
}
38
38
@@ -51,7 +51,7 @@ public function providerGotIsLastSameAsSet()
51
51
*/
52
52
public function testSetNotBooleanLastThrowsException ()
53
53
{
54
- Reference::factory ()->setLast (0 );
54
+ Reference::factory ()->setIsLast (0 );
55
55
}
56
56
57
57
@@ -60,6 +60,6 @@ public function testSetNotBooleanLastThrowsException()
60
60
*/
61
61
public function testSetNotBooleanLastThrowsSplException ()
62
62
{
63
- Reference::factory ()->setLast (0 );
63
+ Reference::factory ()->setIsLast (0 );
64
64
}
65
65
}
You can’t perform that action at this time.
0 commit comments