コード例 #1
0
 /**
  * 指定された文字で始まるメソッド名のリストを返却
  *
  * @param   Object  $instanse   クラスのインスタンス
  * @param   string  $prefix     取得するメソッド名のプレフィックス
  * @return  array   メソッド名のリスト
  * @access  public
  * @static
  */
 function getMethods(&$instance, $prefix)
 {
     $vars = BeanUtils::getVars($instance);
     $methods = array();
     foreach (get_class_methods(get_class($instance)) as $method) {
         if (preg_match("/^{$prefix}/", $method)) {
             $attribute = strtolower(preg_replace("/^{$prefix}/", "", $method));
             if (isset($vars[$attribute])) {
                 $methods[$attribute] = true;
             }
         }
     }
     return $methods;
 }