original_string: protected function validate_axis($xy, chart_axis $axis, $index = 0) {
          if ($index > 0) {
              $axes = $xy == 'x' ? $this->xaxes : $this->yaxes;
              if (!isset($axes[$index - 1])) {
                  throw new coding_exception('Missing ' . $xy . ' axis at index lower than ' . $index);
              }
          }
      }
code: protected function validate_axis($xy, chart_axis $axis, $index = 0) {
          if ($index > 0) {
              $axes = $xy == 'x' ? $this->xaxes : $this->yaxes;
              if (!isset($axes[$index - 1])) {
                  throw new coding_exception('Missing ' . $xy . ' axis at index lower than ' . $index);
              }
          }
      }
code_tokens: protected function validate_axis ( $ xy , chart_axis $ axis , $ index = 0 ) { if ( $ index > 0 ) { $ axes = $ xy == 'x' ? $ this -> xaxes : $ this -> yaxes ; if ( ! isset ( $ axes [ $ index - 1 ] ) ) { throw new coding_exception ( 'Missing ' . $ xy . ' axis at index lower than ' . $ index ) ; } } }
docstring: Validate an axis.
  
  We validate this from PHP because not doing it here could result in errors being
  hard to trace down. For instance, if we were to add axis at keys without another
  axis preceding, we would effectively contain the axes in an associative array
  rather than a simple array, and that would have consequences on serialisation.
  
  @param string $xy Accepts x or y.
  @param chart_axis $axis The axis to validate.
  @param index $index The index of the axis.
docstring_tokens: Validate an axis .