JsonMigration::getTargetVersion()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 1
1
<?php
2
3
/*
4
 * This file is part of the webmozart/json package.
5
 *
6
 * (c) Bernhard Schussek <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Webmozart\Json\Migration;
13
14
use stdClass;
15
16
/**
17
 * Migrates a JSON object between versions.
18
 *
19
 * The JSON object is expected to have the property "version" set.
20
 *
21
 * @since  1.3
22
 *
23
 * @author Bernhard Schussek <[email protected]>
24
 */
25
interface JsonMigration
26
{
27
    /**
28
     * Returns the version of the JSON object that this migration expects.
29
     *
30
     * @return string The version string
31
     */
32
    public function getSourceVersion();
33
34
    /**
35
     * Returns the version of the JSON object that this migration upgrades to.
36
     *
37
     * @return string The version string
38
     */
39
    public function getTargetVersion();
40
41
    /**
42
     * Upgrades a JSON object from the source to the target version.
43
     *
44
     * @param stdClass $data The JSON object of the package file
45
     */
46
    public function up(stdClass $data);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
47
48
    /**
49
     * Reverts a JSON object from the target to the source version.
50
     *
51
     * @param stdClass $data The JSON object of the package file
52
     */
53
    public function down(stdClass $data);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
54
}
55