Skip to content

Commit ea78b88

Browse files
committed
Merge branch 'simplification' of bitbucket.org:xiaoix/php-json-schema into simplification
2 parents 9d41031 + 8d6095a commit ea78b88

File tree

4 files changed

+9
-23
lines changed

4 files changed

+9
-23
lines changed

src/Constraint.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,5 @@ public function importFailed($data, &$entity);
3434
* @param $entity
3535
* @return mixed
3636
*/
37-
public function exportFailed($entity, &$data);
38-
39-
40-
/**
41-
* Constraints have priority, `Properties` first, `AdditionalProperties` after, etc...
42-
*/
43-
public static function getPriority();
44-
37+
public function exportFailed($data, &$entity);
4538
}

src/Constraint/Properties.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,4 @@ public function exportFailed($entity, &$data)
109109
{
110110
// TODO: Implement exportFailed() method.
111111
}
112-
113-
114-
public static function getPriority()
115-
{
116-
return self::P1;
117-
}
118-
119-
120112
}

src/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,7 @@ cast to `array` on iteration
6464

6565
## Road map
6666
* Exceptions-less mode
67-
67+
68+
69+
70+
https://github.com/epoberezkin/ajv

src/Schema.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,10 @@ public function __construct($schemaValue = null, Schema $parentSchema = null)
9595
$this->schemaData = $schemaValue;
9696
$this->parentSchema = $parentSchema ? $parentSchema : null;
9797

98-
foreach ($schemaValue as $constraintName => $constraintData) {
99-
$constraint = null;
100-
if (isset(self::$constraintKeys[$constraintName])) {
101-
/** @var Constraint $class */
102-
$class = self::$constraintKeys[$constraintName];
103-
$constraint = new $class($constraintData, $this);
98+
/** @var Constraint $class */
99+
foreach (self::$constraintKeys as $constraintKey => $class) {
100+
if (array_key_exists($constraintKey, $schemaValue)) {
101+
$constraint = new $class($schemaValue[$constraintKey], $this);
104102
$this->setConstraint($constraint);
105103
}
106104
}

0 commit comments

Comments
 (0)