@@ 86-101 (lines=16) @@ | ||
83 | /** |
|
84 | * {@inheritdoc} |
|
85 | */ |
|
86 | public function toJson($moduleFile, array $options = array()) |
|
87 | { |
|
88 | Assert::isInstanceOf($moduleFile, 'Puli\Manager\Api\Module\ModuleFile'); |
|
89 | ||
90 | $jsonData = new stdClass(); |
|
91 | $jsonData->{'$schema'} = sprintf(self::SCHEMA, self::VERSION); |
|
92 | ||
93 | $this->addModuleFileToJson($moduleFile, $jsonData); |
|
94 | ||
95 | // Sort according to key order |
|
96 | $jsonArray = (array) $jsonData; |
|
97 | $orderedKeys = array_intersect_key(array_flip(self::$keyOrder), $jsonArray); |
|
98 | $jsonData = (object) array_replace($orderedKeys, $jsonArray); |
|
99 | ||
100 | return $jsonData; |
|
101 | } |
|
102 | ||
103 | /** |
|
104 | * {@inheritdoc} |
@@ 52-67 (lines=16) @@ | ||
49 | /** |
|
50 | * {@inheritdoc} |
|
51 | */ |
|
52 | public function toJson($moduleFile, array $options = array()) |
|
53 | { |
|
54 | Assert::isInstanceOf($moduleFile, 'Puli\Manager\Api\Module\RootModuleFile'); |
|
55 | ||
56 | $jsonData = new stdClass(); |
|
57 | $jsonData->{'$schema'} = sprintf(self::SCHEMA, self::VERSION); |
|
58 | ||
59 | $this->addModuleFileToJson($moduleFile, $jsonData); |
|
60 | $this->addRootModuleFileToJson($moduleFile, $jsonData); |
|
61 | ||
62 | // Sort according to key order |
|
63 | $jsonArray = (array) $jsonData; |
|
64 | $orderedKeys = array_intersect_key(array_flip(self::$keyOrder), $jsonArray); |
|
65 | ||
66 | return (object) array_replace($orderedKeys, $jsonArray); |
|
67 | } |
|
68 | ||
69 | /** |
|
70 | * {@inheritdoc} |