Skip to content

Commit 596b4ba

Browse files
committed
temp
1 parent ea78b88 commit 596b4ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+676
-699
lines changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
11
# yaoi schema
22

33
JSON-schema inspired PHP versatile structures.
4+
5+
```
6+
Schema:
7+
Ref
8+
Type
9+
Properties
10+
Items
11+
```
12+
13+
```php
14+
$schema = new Schema();
15+
16+
$schema->properties = Properties::create()->....;
17+
$schema->type = Type::create('object');
18+
19+
$schema->reset();
20+
$schema->import(json_decode('...'));
21+
22+
$schema->setPreserveNulls(true);
23+
try {
24+
$data = $schema->import(json_decode('...'));
25+
$data->property->deeper->olala;
26+
$data->additionalProperties[0];
27+
$data->property->additionalProperties[0];
28+
} catch (Exception $e) {
29+
$e->getMessage(); // Invalid value for properties::property->properties::deeper, object expected
30+
}
31+
```

src/AbstractConstraint.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55

66
abstract class AbstractConstraint extends Base implements Constraint
77
{
8-
/** @var Schema */
8+
/** @var OldSchema */
99
protected $ownerSchema;
1010

11-
public function setOwnerSchema(Schema $ownerSchema)
11+
public function setOwnerSchema(OldSchema $ownerSchema)
1212
{
1313
$this->ownerSchema = $ownerSchema;
1414
return $this;
1515
}
1616

1717
/**
18-
* @param Schema $schema
18+
* @param OldSchema $schema
1919
* @return null|static
2020
*/
21-
public static function getFromSchema(Schema $schema)
21+
public static function getFromSchema(OldSchema $schema)
2222
{
2323
$class = static::className();
2424
if (isset($schema->constraints[$class])) {

src/CodeBuilder/PHPCodeBuilder.php

Lines changed: 0 additions & 173 deletions
This file was deleted.

src/CodeBuilder/Templates/ClassStructurePhp.php

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/Constraint.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ interface Constraint
88
const P1 = 1;
99

1010

11-
public function __construct($schemaValue, Schema $ownerSchema = null);
11+
public function __construct($schemaValue, OldSchema $ownerSchema = null);
1212

1313
public static function getSchemaKey();
1414

15-
public function setOwnerSchema(Schema $ownerSchema);
15+
public function setOwnerSchema(OldSchema $ownerSchema);
1616

1717

1818
/**

src/Constraint/Constraint.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Yaoi\Schema\Constraint;
4+
5+
6+
interface Constraint
7+
{
8+
public function getConstraintName();
9+
10+
}

0 commit comments

Comments
 (0)