original_string: public static function get_framework_depth($frameworkid) {
          global $DB;
          $totallength = $DB->sql_length('path');
          $trimmedlength = $DB->sql_length("REPLACE(path, '/', '')");
          $sql = "SELECT ($totallength - $trimmedlength - 1) AS depth
                    FROM {" . self::TABLE . "}
                   WHERE competencyframeworkid = :id
                ORDER BY depth DESC";
          $record = $DB->get_record_sql($sql, array('id' => $frameworkid), IGNORE_MULTIPLE);
          if (!$record) {
              $depth = 0;
          } else {
              $depth = $record->depth;
          }
          return $depth;
      }
code: public static function get_framework_depth($frameworkid) {
          global $DB;
          $totallength = $DB->sql_length('path');
          $trimmedlength = $DB->sql_length("REPLACE(path, '/', '')");
          $sql = "SELECT ($totallength - $trimmedlength - 1) AS depth
                    FROM {" . self::TABLE . "}
                   WHERE competencyframeworkid = :id
                ORDER BY depth DESC";
          $record = $DB->get_record_sql($sql, array('id' => $frameworkid), IGNORE_MULTIPLE);
          if (!$record) {
              $depth = 0;
          } else {
              $depth = $record->depth;
          }
          return $depth;
      }
code_tokens: public static function get_framework_depth ( $ frameworkid ) { global $ DB ; $ totallength = $ DB -> sql_length ( 'path' ) ; $ trimmedlength = $ DB -> sql_length ( "REPLACE(path, '/', '')" ) ; $ sql = "SELECT ($totallength - $trimmedlength - 1) AS depth
                    FROM {" . self :: TABLE . "}
                   WHERE competencyframeworkid = :id
                ORDER BY depth DESC" ; $ record = $ DB -> get_record_sql ( $ sql , array ( 'id' => $ frameworkid ) , IGNORE_MULTIPLE ) ; if ( ! $ record ) { $ depth = 0 ; } else { $ depth = $ record -> depth ; } return $ depth ; }
docstring: Return the current depth of a competency framework.
  
  @param int $frameworkid The framework ID.
  @return int
docstring_tokens: Return the current depth of a competency framework .