original_string: protected function decode_availability($availability, $lax) {
          // Decode JSON data.
          $structure = json_decode($availability);
          if (is_null($structure)) {
              throw new \coding_exception('Invalid availability text', $availability);
          }
  
          // Recursively decode tree.
          return new tree($structure, $lax);
      }
code: protected function decode_availability($availability, $lax) {
          // Decode JSON data.
          $structure = json_decode($availability);
          if (is_null($structure)) {
              throw new \coding_exception('Invalid availability text', $availability);
          }
  
          // Recursively decode tree.
          return new tree($structure, $lax);
      }
code_tokens: protected function decode_availability ( $ availability , $ lax ) { // Decode JSON data. $ structure = json_decode ( $ availability ) ; if ( is_null ( $ structure ) ) { throw new \ coding_exception ( 'Invalid availability text' , $ availability ) ; } // Recursively decode tree. return new tree ( $ structure , $ lax ) ; }
docstring: Decodes availability data from JSON format.
  
  This function also validates the retrieved data as follows:
  1. Data that does not meet the API-defined structure causes a
  coding_exception (this should be impossible unless there is
  a system bug or somebody manually hacks the database).
  2. Data that meets the structure but cannot be implemented (e.g.
  reference to missing plugin or to module that doesn't exist) is
  either silently discarded (if $lax is true) or causes a
  coding_exception (if $lax is false).
  
  @param string $availability Availability string in JSON format
  @param boolean $lax If true, throw exceptions only for invalid structure
  @return tree Availability tree
  @throws \coding_exception If data is not valid JSON format
docstring_tokens: Decodes availability data from JSON format .