original_string: public function export_metadata(array $subcontext, string $key, $value, string $description) : content_writer {
          $path = $this->get_full_path($subcontext, 'metadata.json');
  
          if (file_exists($path)) {
              $data = json_decode(file_get_contents($path));
          } else {
              $data = (object) [];
          }
  
          $data->$key = (object) [
              'value' => $value,
              'description' => $description,
          ];
  
          $path = $this->get_path($subcontext, 'metadata.json');
          $this->write_data($path, json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
  
          return $this;
      }
code: public function export_metadata(array $subcontext, string $key, $value, string $description) : content_writer {
          $path = $this->get_full_path($subcontext, 'metadata.json');
  
          if (file_exists($path)) {
              $data = json_decode(file_get_contents($path));
          } else {
              $data = (object) [];
          }
  
          $data->$key = (object) [
              'value' => $value,
              'description' => $description,
          ];
  
          $path = $this->get_path($subcontext, 'metadata.json');
          $this->write_data($path, json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
  
          return $this;
      }
code_tokens: public function export_metadata ( array $ subcontext , string $ key , $ value , string $ description ) : content_writer { $ path = $ this -> get_full_path ( $ subcontext , 'metadata.json' ) ; if ( file_exists ( $ path ) ) { $ data = json_decode ( file_get_contents ( $ path ) ) ; } else { $ data = ( object ) [ ] ; } $ data -> $ key = ( object ) [ 'value' => $ value , 'description' => $ description , ] ; $ path = $ this -> get_path ( $ subcontext , 'metadata.json' ) ; $ this -> write_data ( $ path , json_encode ( $ data , JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT ) ) ; return $ this ; }
docstring: Export metadata about the supplied subcontext.
  
  Metadata consists of a key/value pair and a description of the value.
  
  @param   array           $subcontext The location within the current context that this data belongs.
  @param   string          $key        The metadata name.
  @param   string          $value      The metadata value.
  @param   string          $description    The description of the value.
  @return  content_writer
docstring_tokens: Export metadata about the supplied subcontext .