Skip to content

add Galbar\ vendor namespace throughout #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
},
"autoload": {
"psr-4": {
"JsonPath\\": "src/Galbar/JsonPath",
"Utilities\\": "src/Galbar/Utilities"
"Galbar\\JsonPath\\": "src/Galbar/JsonPath",
"Galbar\\Utilities\\": "src/Galbar/Utilities"
}
},
"autoload-dev": {
Expand Down
6 changes: 3 additions & 3 deletions src/Galbar/JsonPath/Expression/ArrayInterval.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

namespace JsonPath\Expression;
namespace Galbar\JsonPath\Expression;

use Utilities\ArraySlice;
use JsonPath\Language;
use Galbar\Utilities\ArraySlice;
use Galbar\JsonPath\Language;

class ArrayInterval
{
Expand Down
4 changes: 2 additions & 2 deletions src/Galbar/JsonPath/Expression/BooleanExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

namespace JsonPath\Expression;
namespace Galbar\JsonPath\Expression;

use JsonPath\Language;
use Galbar\JsonPath\Language;

class BooleanExpression
{
Expand Down
4 changes: 2 additions & 2 deletions src/Galbar/JsonPath/Expression/ChildNameList.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

namespace JsonPath\Expression;
namespace Galbar\JsonPath\Expression;

use JsonPath\Language;
use Galbar\JsonPath\Language;

class ChildNameList
{
Expand Down
4 changes: 2 additions & 2 deletions src/Galbar/JsonPath/Expression/Comparison.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

namespace JsonPath\Expression;
namespace Galbar\JsonPath\Expression;

use JsonPath\Language;
use Galbar\JsonPath\Language;

class Comparison
{
Expand Down
2 changes: 1 addition & 1 deletion src/Galbar/JsonPath/Expression/InArray.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace JsonPath\Expression;
namespace Galbar\JsonPath\Expression;

class InArray
{
Expand Down
4 changes: 2 additions & 2 deletions src/Galbar/JsonPath/Expression/IndexList.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

namespace JsonPath\Expression;
namespace Galbar\JsonPath\Expression;

use JsonPath\Language;
use Galbar\JsonPath\Language;

class IndexList
{
Expand Down
10 changes: 5 additions & 5 deletions src/Galbar/JsonPath/Expression/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

namespace JsonPath\Expression;
namespace Galbar\JsonPath\Expression;

use JsonPath\Language;
use JsonPath\Operation;
use Galbar\JsonPath\Language;
use Galbar\JsonPath\Operation;

class Value
{
Expand All @@ -44,11 +44,11 @@ public static function evaluate(&$root, &$partial, $expression)
}
$result = [];
if ($expression[0] === Language\Token::ROOT){
list($result, $_) = \JsonPath\JsonPath::subtreeGet($root, $root, $expression);
list($result, $_) = \Galbar\JsonPath\JsonPath::subtreeGet($root, $root, $expression);
}
else if ($expression[0] === Language\Token::CHILD) {
$expression[0] = Language\Token::ROOT;
list($result, $_) = \JsonPath\JsonPath::subtreeGet($root, $partial, $expression);
list($result, $_) = \Galbar\JsonPath\JsonPath::subtreeGet($root, $partial, $expression);
}
if (!empty($result)) {
if ($length) {
Expand Down
2 changes: 1 addition & 1 deletion src/Galbar/JsonPath/InvalidJsonException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

namespace JsonPath;
namespace Galbar\JsonPath;

/**
* Exception that is raised when a invalid value is given to the JsonObject
Expand Down
2 changes: 1 addition & 1 deletion src/Galbar/JsonPath/InvalidJsonPathException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

namespace JsonPath;
namespace Galbar\JsonPath;

/**
* Exception that is raised when a error is found in the given JSONPath
Expand Down
6 changes: 3 additions & 3 deletions src/Galbar/JsonPath/JsonObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

namespace JsonPath;
namespace Galbar\JsonPath;

use JsonPath\InvalidJsonException;
use JsonPath\Operation;
use Galbar\JsonPath\InvalidJsonException;
use Galbar\JsonPath\Operation;

/**
* This is a [JSONPath](http://goessner.net/articles/JsonPath/) implementation for PHP.
Expand Down
12 changes: 6 additions & 6 deletions src/Galbar/JsonPath/JsonPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

namespace JsonPath;
namespace Galbar\JsonPath;

use JsonPath\Expression;
use JsonPath\Language;
use JsonPath\Operation;
use Galbar\JsonPath\Expression;
use Galbar\JsonPath\Language;
use Galbar\JsonPath\Operation;

class JsonPath
{
Expand All @@ -32,7 +32,7 @@ public static function subtreeGet(&$root, &$partial, $jsonPath, $createInexisten
{
$match = array();
if (preg_match(Language\Regex::ROOT_OBJECT, $jsonPath, $match) === 0) {
throw new \JsonPath\InvalidJsonPathException($jsonPath);
throw new \Galbar\JsonPath\InvalidJsonPathException($jsonPath);
}
$hasDiverged = false;
$jsonPath = $match[1];
Expand Down Expand Up @@ -90,7 +90,7 @@ public static function subtreeGet(&$root, &$partial, $jsonPath, $createInexisten
$jsonPath = "";
}
} else {
throw new \JsonPath\InvalidJsonPathException($jsonPath);
throw new \Galbar\JsonPath\InvalidJsonPathException($jsonPath);
}
$selection = $newSelection;
$hasDiverged = $hasDiverged || $newHasDiverged;
Expand Down
2 changes: 1 addition & 1 deletion src/Galbar/JsonPath/Language/ChildSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

namespace JsonPath\Language;
namespace Galbar\JsonPath\Language;

class ChildSelector
{
Expand Down
2 changes: 1 addition & 1 deletion src/Galbar/JsonPath/Language/Regex.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

namespace JsonPath\Language;
namespace Galbar\JsonPath\Language;

class Regex
{
Expand Down
2 changes: 1 addition & 1 deletion src/Galbar/JsonPath/Language/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

namespace JsonPath\Language;
namespace Galbar\JsonPath\Language;

class Token
{
Expand Down
4 changes: 2 additions & 2 deletions src/Galbar/JsonPath/Operation/GetChild.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

namespace JsonPath\Operation;
namespace Galbar\JsonPath\Operation;

use JsonPath\Language;
use Galbar\JsonPath\Language;

class GetChild
{
Expand Down
6 changes: 3 additions & 3 deletions src/Galbar/JsonPath/Operation/GetRecursive.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
* limitations under the License.
*/

namespace JsonPath\Operation;
namespace Galbar\JsonPath\Operation;

use JsonPath\Language;
use Galbar\JsonPath\Language;

class GetRecursive
{
public static function apply(&$root, &$partial, $jsonPath)
{
list($result, $_) = \JsonPath\JsonPath::subtreeGet($root, $partial, $jsonPath);
list($result, $_) = \Galbar\JsonPath\JsonPath::subtreeGet($root, $partial, $jsonPath);
if ($result === false) {
$result = array();
}
Expand Down
6 changes: 3 additions & 3 deletions src/Galbar/JsonPath/Operation/SelectChildren.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

namespace JsonPath\Operation;
namespace Galbar\JsonPath\Operation;

use JsonPath\Language;
use JsonPath\Expression;
use Galbar\JsonPath\Language;
use Galbar\JsonPath\Expression;

class SelectChildren
{
Expand Down
2 changes: 1 addition & 1 deletion src/Galbar/Utilities/ArraySlice.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

namespace Utilities;
namespace Galbar\Utilities;

class ArraySlice
{
Expand Down
8 changes: 4 additions & 4 deletions tests/Galbar/JsonPath/JsonObjectIssue37Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

namespace Tests;
namespace Galbar\Tests;

use JsonPath\InvalidJsonException;
use JsonPath\InvalidJsonPathException;
use JsonPath\JsonObject;
use Galbar\JsonPath\InvalidJsonException;
use Galbar\JsonPath\InvalidJsonPathException;
use Galbar\JsonPath\JsonObject;

/**
* Class JsonObjectTest
Expand Down
8 changes: 4 additions & 4 deletions tests/Galbar/JsonPath/JsonObjectIssue64Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

namespace Tests;
namespace Galbar\Tests;

use JsonPath\InvalidJsonException;
use JsonPath\InvalidJsonPathException;
use JsonPath\JsonObject;
use Galbar\JsonPath\InvalidJsonException;
use Galbar\JsonPath\InvalidJsonPathException;
use Galbar\JsonPath\JsonObject;

/**
* Class JsonObjectTest
Expand Down
6 changes: 3 additions & 3 deletions tests/Galbar/JsonPath/JsonObjectLengthOperatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

namespace Tests;
namespace Galbar\Tests;

use JsonPath\JsonObject;
use JsonPath\InvalidJsonException;
use Galbar\JsonPath\JsonObject;
use Galbar\JsonPath\InvalidJsonException;

/**
* Class JsonObjectLengthOperatorTest
Expand Down
20 changes: 10 additions & 10 deletions tests/Galbar/JsonPath/JsonObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

namespace Tests;
namespace Galbar\Tests;

use JsonPath\InvalidJsonException;
use JsonPath\InvalidJsonPathException;
use JsonPath\JsonObject;
use Galbar\JsonPath\InvalidJsonException;
use Galbar\JsonPath\InvalidJsonPathException;
use Galbar\JsonPath\JsonObject;

/**
* Class JsonObjectTest
Expand Down Expand Up @@ -1202,22 +1202,22 @@ public function testGetJsonObjects()
// Bug when using negative index triggers DivisionByZeroError
// https://github.com/Galbar/JsonPath-PHP/issues/60
public function testNegativeIndexOnEmptyArray() {
$object = new \JsonPath\JsonObject('{"data": []}');
$object = new JsonObject('{"data": []}');
$this->assertEquals([], $object->get('$.data[-1]'));

$object = new \JsonPath\JsonObject('{"data": [{"id": 1},{"id": 2}]}');
$object = new JsonObject('{"data": [{"id": 1},{"id": 2}]}');
$this->assertEquals([], $object->get('$.data[-5].id'));

$object = new \JsonPath\JsonObject('{"data": [{"id": 1}]}');
$object = new JsonObject('{"data": [{"id": 1}]}');
$this->assertEquals($object->get('$.data[-1].id'), [1]);

$object = new \JsonPath\JsonObject('{"data": [{"id": 1},{"id": 2}]}');
$object = new JsonObject('{"data": [{"id": 1},{"id": 2}]}');
$this->assertEquals($object->get('$.data[-1].id'), [2]);

$object = new \JsonPath\JsonObject('{"data": []}');
$object = new JsonObject('{"data": []}');
$this->assertEquals([], $object->get('$.data[1].id'));

$object = new \JsonPath\JsonObject('{"data": [{"id": 1},{"id": 2}]}');
$object = new JsonObject('{"data": [{"id": 1},{"id": 2}]}');
$this->assertEquals([], $object->get('$.data[3].id'));
}
}
6 changes: 3 additions & 3 deletions tests/Galbar/JsonPath/JsonPathKeyRegexMatchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

namespace Tests;
namespace Galbar\Tests;

use JsonPath\JsonObject;
use JsonPath\InvalidJsonException;
use Galbar\JsonPath\JsonObject;
use Galbar\JsonPath\InvalidJsonException;

/**
* Class JsonPathKeyRegexMatchTest
Expand Down
4 changes: 2 additions & 2 deletions tests/Galbar/Utilities/ArraySliceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

namespace Tests\Utilities;
namespace Galbar\Tests\Utilities;

use Utilities\ArraySlice;
use Galbar\Utilities\ArraySlice;

/**
* Class ArraySliceTest
Expand Down