Skip to content

Commit 8a0b2e1

Browse files
committed
Remove tabs/whitespace. Add unit test coverage. Add code comments.
1 parent 4713694 commit 8a0b2e1

File tree

8 files changed

+239
-187
lines changed

8 files changed

+239
-187
lines changed

src/JsonSchema/Constraints/Constraint.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ public function __construct($checkMode = self::CHECK_MODE_NORMAL, UriRetriever $
3737
$this->uriRetriever = $uriRetriever;
3838
}
3939

40-
/**
41-
* @return UriRetriever $uriRetriever
42-
*/
43-
public function getUriRetriever()
44-
{
45-
if (is_null($this->uriRetriever))
46-
{
47-
$this->setUriRetriever(new UriRetriever);
48-
}
49-
50-
return $this->uriRetriever;
51-
}
40+
/**
41+
* @return UriRetriever $uriRetriever
42+
*/
43+
public function getUriRetriever()
44+
{
45+
if (is_null($this->uriRetriever))
46+
{
47+
$this->setUriRetriever(new UriRetriever);
48+
}
49+
50+
return $this->uriRetriever;
51+
}
5252

5353
/**
5454
* @param UriRetriever $uriRetriever
@@ -257,7 +257,7 @@ protected function retrieveUri($uri)
257257
if (null === $this->uriRetriever) {
258258
$this->setUriRetriever(new UriRetriever);
259259
}
260-
$jsonSchema = $this->uriRetriever->retrieve($uri);
260+
$jsonSchema = $this->uriRetriever->retrieve($uri);
261261
// TODO validate using schema
262262
return $jsonSchema;
263263
}

src/JsonSchema/Constraints/ConstraintInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,29 @@ interface ConstraintInterface
2121
*
2222
* @return array
2323
*/
24-
function getErrors();
24+
public function getErrors();
2525

2626
/**
2727
* adds errors to this validator
2828
*
2929
* @param array $errors
3030
*/
31-
function addErrors(array $errors);
31+
public function addErrors(array $errors);
3232

3333
/**
3434
* adds an error
3535
*
3636
* @param $path
3737
* @param $message
3838
*/
39-
function addError($path, $message);
39+
public function addError($path, $message);
4040

4141
/**
4242
* checks if the validator has not raised errors
4343
*
4444
* @return boolean
4545
*/
46-
function isValid();
46+
public function isValid();
4747

4848
/**
4949
* invokes the validation of an element
@@ -54,5 +54,5 @@ function isValid();
5454
* @param mixed $path
5555
* @param mixed $i
5656
*/
57-
function check($value, $schema = null, $path = null, $i = null);
57+
public function check($value, $schema = null, $path = null, $i = null);
5858
}

src/JsonSchema/RefResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace JsonSchema;
1111

12-
use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
12+
use JsonSchema\Uri\UriRetriever;
1313

1414
/**
1515
* Take in an object that's a JSON schema and take care of all $ref references
@@ -201,4 +201,4 @@ public function setUriRetriever(UriRetriever $retriever)
201201

202202
return $this;
203203
}
204-
}
204+
}

src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,17 @@
1616
*/
1717
interface UriRetrieverInterface
1818
{
19+
/**
20+
* Retrieve a schema from the specified URI
21+
* @param string $uri URI that resolves to a JSON schema
22+
* @throws \JsonSchema\Exception\ResourceNotFoundException
23+
* @return mixed string|null
24+
*/
1925
public function retrieve($uri);
2026

27+
/**
28+
* Get media content type
29+
* @return string
30+
*/
2131
public function getContentType();
2232
}

tests/JsonSchema/Tests/Constraints/FormatTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313

1414
class FormatTest extends BaseTestCase
1515
{
16+
public function setUp()
17+
{
18+
date_default_timezone_set('UTC');
19+
}
20+
1621
public function testNullThing()
1722
{
1823
$validator = new Format();

0 commit comments

Comments
 (0)