Skip to content

Commit 47bc7c6

Browse files
committed
Issue #6: locator builder fixed and updated
1 parent ff69b2a commit 47bc7c6

12 files changed

+37
-17
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
### Added
99
- Issue #5: `ResultInterface::get()` method added.
10+
### Fixed
11+
- Issue #6: locator builder moved to correct namespace.
1012

1113
## [0.6.3] - 2019-11-18
1214
### Fixed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace Remorhaz\JSON\Pointer\Locator\Exception;
5+
6+
use Remorhaz\JSON\Pointer\Exception\ExceptionInterface as PointerExceptionInterface;
7+
8+
interface ExceptionInterface extends PointerExceptionInterface
9+
{
10+
}

src/Parser/Exception/LocatorAlreadyBuiltException.php renamed to src/Locator/Exception/LocatorAlreadyBuiltException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
declare(strict_types=1);
33

4-
namespace Remorhaz\JSON\Pointer\Parser\Exception;
4+
namespace Remorhaz\JSON\Pointer\Locator\Exception;
55

66
use LogicException;
77
use Throwable;

src/Parser/LocatorBuilder.php renamed to src/Locator/LocatorBuilder.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
<?php
22
declare(strict_types=1);
33

4-
namespace Remorhaz\JSON\Pointer\Parser;
5-
6-
use Remorhaz\JSON\Pointer\Locator\Locator;
7-
use Remorhaz\JSON\Pointer\Locator\LocatorInterface;
8-
use Remorhaz\JSON\Pointer\Locator\ReferenceFactoryInterface;
4+
namespace Remorhaz\JSON\Pointer\Locator;
95

106
final class LocatorBuilder implements LocatorBuilderInterface
117
{
@@ -16,6 +12,11 @@ final class LocatorBuilder implements LocatorBuilderInterface
1612

1713
private $references = [];
1814

15+
public static function create(): LocatorBuilderInterface
16+
{
17+
return new self(new ReferenceFactory);
18+
}
19+
1920
public function __construct(ReferenceFactoryInterface $referenceFactory)
2021
{
2122
$this->referenceFactory = $referenceFactory;

src/Parser/LocatorBuilderInterface.php renamed to src/Locator/LocatorBuilderInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php
22
declare(strict_types=1);
33

4-
namespace Remorhaz\JSON\Pointer\Parser;
5-
6-
use Remorhaz\JSON\Pointer\Locator\LocatorInterface;
4+
namespace Remorhaz\JSON\Pointer\Locator;
75

86
interface LocatorBuilderInterface
97
{

src/Parser/Ll1ParserFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace Remorhaz\JSON\Pointer\Parser;
55

6+
use Remorhaz\JSON\Pointer\Locator\LocatorBuilderInterface;
67
use Remorhaz\JSON\Pointer\TokenMatcher;
78
use Remorhaz\UniLex\Exception as UnilexException;
89
use Remorhaz\UniLex\Grammar\ContextFree\GrammarInterface;

src/Parser/Ll1ParserFactoryInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace Remorhaz\JSON\Pointer\Parser;
55

6+
use Remorhaz\JSON\Pointer\Locator\LocatorBuilderInterface;
67
use Remorhaz\UniLex\Parser\LL1\Parser as Ll1Parser;
78

89
interface Ll1ParserFactoryInterface

src/Parser/Parser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace Remorhaz\JSON\Pointer\Parser;
55

6+
use Remorhaz\JSON\Pointer\Locator\LocatorBuilder;
67
use Remorhaz\JSON\Pointer\Locator\LocatorInterface;
78
use Remorhaz\JSON\Pointer\Locator\ReferenceFactory;
89
use Remorhaz\JSON\Pointer\Locator\ReferenceFactoryInterface;

src/Parser/TranslationScheme.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
namespace Remorhaz\JSON\Pointer\Parser;
55

6+
use Remorhaz\JSON\Pointer\Locator\LocatorBuilderInterface;
67
use Remorhaz\UniLex\Grammar\SDD\TranslationSchemeInterface;
78
use Remorhaz\UniLex\Lexer\Token;
89
use Remorhaz\UniLex\Parser\Production;

tests/Parser/Exception/LocatorAlreadyBuiltExceptionTest.php renamed to tests/Locator/Exception/LocatorAlreadyBuiltExceptionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22
declare(strict_types=1);
33

4-
namespace Remorhaz\JSON\Pointer\Test\Parser\Exception;
4+
namespace Remorhaz\JSON\Pointer\Test\Locator\Exception;
55

66
use Exception;
77
use PHPUnit\Framework\TestCase;
8-
use Remorhaz\JSON\Pointer\Parser\Exception\LocatorAlreadyBuiltException;
8+
use Remorhaz\JSON\Pointer\Locator\Exception\LocatorAlreadyBuiltException;
99

1010
/**
11-
* @covers \Remorhaz\JSON\Pointer\Parser\Exception\LocatorAlreadyBuiltException
11+
* @covers \Remorhaz\JSON\Pointer\Locator\Exception\LocatorAlreadyBuiltException
1212
*/
1313
class LocatorAlreadyBuiltExceptionTest extends TestCase
1414
{

0 commit comments

Comments
 (0)