original_string: public static function list_plans_with_competency($userid, $competencyorid) {
          global $USER;
  
          static::require_enabled();
          $competencyid = $competencyorid;
          $competency = null;
          if (is_object($competencyid)) {
              $competency = $competencyid;
              $competencyid = $competency->get('id');
          }
  
          $plans = plan::get_by_user_and_competency($userid, $competencyid);
          foreach ($plans as $index => $plan) {
              // Filter plans we cannot read.
              if (!$plan->can_read()) {
                  unset($plans[$index]);
              }
          }
          return $plans;
      }
code: public static function list_plans_with_competency($userid, $competencyorid) {
          global $USER;
  
          static::require_enabled();
          $competencyid = $competencyorid;
          $competency = null;
          if (is_object($competencyid)) {
              $competency = $competencyid;
              $competencyid = $competency->get('id');
          }
  
          $plans = plan::get_by_user_and_competency($userid, $competencyid);
          foreach ($plans as $index => $plan) {
              // Filter plans we cannot read.
              if (!$plan->can_read()) {
                  unset($plans[$index]);
              }
          }
          return $plans;
      }
code_tokens: public static function list_plans_with_competency ( $ userid , $ competencyorid ) { global $ USER ; static :: require_enabled ( ) ; $ competencyid = $ competencyorid ; $ competency = null ; if ( is_object ( $ competencyid ) ) { $ competency = $ competencyid ; $ competencyid = $ competency -> get ( 'id' ) ; } $ plans = plan :: get_by_user_and_competency ( $ userid , $ competencyid ) ; foreach ( $ plans as $ index => $ plan ) { // Filter plans we cannot read. if ( ! $ plan -> can_read ( ) ) { unset ( $ plans [ $ index ] ) ; } } return $ plans ; }
docstring: List the plans with a competency.
  
  @param  int $userid The user id we want the plans for.
  @param  int $competencyorid The competency, or its ID.
  @return array[plan] Array of learning plans.
docstring_tokens: List the plans with a competency .