Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
49 | public function with(array $overwrites) |
||
50 | { |
||
51 | if (is_null($this->resultData)) { |
||
52 | $message = 'you should set schema before "with". ex.) Ayaml::file("f")->schema("s")->with(["k" => "v"])->dump()'; |
||
53 | throw new AyamlSchemaNotSpecifiedException($message); |
||
54 | } |
||
55 | foreach ($overwrites as $overwriteKey => $overwriteVal) { |
||
56 | if (! array_key_exists($overwriteKey, $this->resultData)) { |
||
57 | throw new AyamlNoExistingKeyException("key: $overwriteKey does not exist."); |
||
58 | } |
||
59 | $this->resultData[$overwriteKey] = $overwriteVal; |
||
60 | } |
||
61 | |||
62 | return $this; |
||
63 | } |
||
64 | |||
73 |