-
Notifications
You must be signed in to change notification settings - Fork 27
/
JsonMigration.php
54 lines (47 loc) · 1.25 KB
/
JsonMigration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*
* This file is part of the webmozart/json package.
*
* (c) Bernhard Schussek <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Webmozart\Json\Migration;
use stdClass;
/**
* Migrates a JSON object between versions.
*
* The JSON object is expected to have the property "version" set.
*
* @since 1.3
*
* @author Bernhard Schussek <[email protected]>
*/
interface JsonMigration
{
/**
* Returns the version of the JSON object that this migration expects.
*
* @return string The version string
*/
public function getSourceVersion();
/**
* Returns the version of the JSON object that this migration upgrades to.
*
* @return string The version string
*/
public function getTargetVersion();
/**
* Upgrades a JSON object from the source to the target version.
*
* @param stdClass $data The JSON object of the package file
*/
public function up(stdClass $data);
/**
* Reverts a JSON object from the target to the source version.
*
* @param stdClass $data The JSON object of the package file
*/
public function down(stdClass $data);
}