bingo-soft /
jabe
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Jabe\Impl\Json; |
||
| 4 | |||
| 5 | use Jabe\Impl\Migration\MigrationPlanImpl; |
||
| 6 | use Jabe\Impl\Util\JsonUtil; |
||
| 7 | |||
| 8 | class MigrationPlanJsonConverter extends JsonObjectConverter |
||
| 9 | { |
||
| 10 | private static $INSTANCE; |
||
| 11 | public const SOURCE_PROCESS_DEFINITION_ID = "sourceProcessDefinitionId"; |
||
| 12 | public const TARGET_PROCESS_DEFINITION_ID = "targetProcessDefinitionId"; |
||
| 13 | public const INSTRUCTIONS = "instructions"; |
||
| 14 | |||
| 15 | public static function instance(): MigrationPlanJsonConverter |
||
| 16 | { |
||
| 17 | if (self::$INSTANCE == null) { |
||
| 18 | self::$INSTANCE = new MigrationPlanJsonConverter(); |
||
| 19 | } |
||
| 20 | return self::$INSTANCE; |
||
| 21 | } |
||
| 22 | |||
| 23 | public function toJsonObject(/*MigrationPlanInterface*/$migrationPlan, bool $isOrQueryActive = false): ?\stdClass |
||
| 24 | { |
||
| 25 | $json = JsonUtil::createObject(); |
||
| 26 | |||
| 27 | JsonUtil::addField($json, self::SOURCE_PROCESS_DEFINITION_ID, $migrationPlan->getSourceProcessDefinitionId()); |
||
| 28 | JsonUtil::addField($json, self::TARGET_PROCESS_DEFINITION_ID, $migrationPlan->getTargetProcessDefinitionId()); |
||
| 29 | JsonUtil::addListField($json, self::INSTRUCTIONS, MigrationInstructionJsonConverter::instance(), $migrationPlan->getInstructions()); |
||
|
0 ignored issues
–
show
|
|||
| 30 | |||
| 31 | return $json; |
||
| 32 | } |
||
| 33 | |||
| 34 | public function toObject(\stdClass $json, bool $isOrQuery = false) |
||
| 35 | { |
||
| 36 | $migrationPlan = new MigrationPlanImpl( |
||
| 37 | JsonUtil::getString($json, self::SOURCE_PROCESS_DEFINITION_ID), |
||
| 38 | JsonUtil::getString($json, self::TARGET_PROCESS_DEFINITION_ID) |
||
| 39 | ); |
||
| 40 | $migrationPlan->setInstructions( |
||
| 41 | JsonUtil::asList(JsonUtil::getArray($json, self::INSTRUCTIONS), MigrationInstructionJsonConverter::instance()) |
||
| 42 | ); |
||
| 43 | return $migrationPlan; |
||
| 44 | } |
||
| 45 | } |
||
| 46 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.