当前位置: 首页>>代码示例>>PHP>>正文


PHP Stat::applicable方法代码示例

本文整理汇总了PHP中Stat::applicable方法的典型用法代码示例。如果您正苦于以下问题:PHP Stat::applicable方法的具体用法?PHP Stat::applicable怎么用?PHP Stat::applicable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stat的用法示例。


在下文中一共展示了Stat::applicable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: points_game

 function points_game($stat_type, $game, &$stats)
 {
     $this->_init_rosters($stats);
     $kp_id = $this->_stat_type_id('Kills');
     $km_id = $this->_stat_type_id('Killed');
     $cp_id = $this->_stat_type_id('Catches');
     $cm_id = $this->_stat_type_id('Caught');
     foreach ($this->rosters as $team_id => $roster) {
         foreach ($roster as $person_id => $position) {
             $value = $this->_value($kp_id, $person_id, $stats) - $this->_value($km_id, $person_id, $stats) + ($this->_value($cp_id, $person_id, $stats) - $this->_value($cm_id, $person_id, $stats)) * 2;
             if (Stat::applicable($stat_type, $position) || $value != 0) {
                 $stats['Stat'][] = array('game_id' => $game['Game']['id'], 'team_id' => $team_id, 'person_id' => $person_id, 'stat_type_id' => $stat_type['id'], 'value' => $value);
             }
         }
     }
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:16,代码来源:sport_dodgeball.php

示例2: points_game

 function points_game($stat_type, $game, &$stats)
 {
     $this->_init_rosters($stats);
     $t_id = $this->_stat_type_id('Tries');
     $c_id = $this->_stat_type_id('Conversions');
     $pk_id = $this->_stat_type_id('Penalty Kicks');
     $dg_id = $this->_stat_type_id('Drop Goals');
     foreach ($this->rosters as $team_id => $roster) {
         foreach ($roster as $person_id => $position) {
             $value = $this->_value($t_id, $person_id, $stats) * 5 + $this->_value($c_id, $person_id, $stats) * 2 + $this->_value($pk_id, $person_id, $stats) * 3 + $this->_value($dg_id, $person_id, $stats) * 3;
             if (Stat::applicable($stat_type, $position) || $value != 0) {
                 $stats['Stat'][] = array('game_id' => $game['Game']['id'], 'team_id' => $team_id, 'person_id' => $person_id, 'stat_type_id' => $stat_type['id'], 'value' => $value);
             }
         }
     }
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:16,代码来源:sport_rugby.php

示例3: ops_season

 function ops_season($stat_type, &$stats)
 {
     $h_id = $this->_stat_type_id('Hits');
     $b1_id = $this->_stat_type_id('Singles');
     $b2_id = $this->_stat_type_id('Doubles');
     $b3_id = $this->_stat_type_id('Triples');
     $b4_id = $this->_stat_type_id('Home Runs');
     $bb_id = $this->_stat_type_id('Walks');
     $hbp_id = $this->_stat_type_id('Hit By Pitch');
     $sf_id = $this->_stat_type_id('Sacrifice Flies');
     $ab_id = $this->_stat_type_id('At Bats');
     $this->_init_rosters($stats);
     foreach ($this->rosters as $roster) {
         foreach ($roster as $person_id => $position) {
             $bases = $this->_value_sum($b1_id, $person_id, $stats) + $this->_value_sum($b2_id, $person_id, $stats) * 2 + $this->_value_sum($b3_id, $person_id, $stats) * 3 + $this->_value_sum($b4_id, $person_id, $stats) * 4;
             $reached = $this->_value_sum($h_id, $person_id, $stats) + $this->_value_sum($bb_id, $person_id, $stats) + $this->_value_sum($hbp_id, $person_id, $stats);
             $appearances = $this->_value_sum($ab_id, $person_id, $stats) + $this->_value_sum($bb_id, $person_id, $stats) + $this->_value_sum($sf_id, $person_id, $stats) + $this->_value_sum($hbp_id, $person_id, $stats);
             $value = sprintf('%.03f', $reached / $appearances + $bases / $this->_value_sum($ab_id, $person_id, $stats));
             if (Stat::applicable($stat_type, $position) || $value != 0) {
                 $stats['Calculated'][$person_id][$stat_type['id']] = $value;
             }
         }
     }
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:24,代码来源:sport_baseball.php

示例4: ties_game

 function ties_game($stat_type, $game, &$stats)
 {
     $this->_init_rosters($stats);
     foreach ($this->rosters as $team_id => $roster) {
         $value = $this->_is_tie($game, $team_id);
         foreach ($roster as $person_id => $position) {
             if (Stat::applicable($stat_type, $position)) {
                 $stats['Stat'][] = array('game_id' => $game['Game']['id'], 'team_id' => $team_id, 'person_id' => $person_id, 'stat_type_id' => $stat_type['id'], 'value' => $value);
             }
         }
     }
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:12,代码来源:sport.php

示例5: gaa_season

 function gaa_season($stat_type, &$stats)
 {
     $this->_init_rosters($stats);
     $m_id = $this->_stat_type_id('Minutes Played');
     $g_id = $this->_stat_type_id('Goals Against');
     foreach ($this->rosters as $team_id => $roster) {
         foreach ($roster as $person_id => $position) {
             $minutes = $this->_value_sum($m_id, $person_id, $stats);
             if ($minutes) {
                 $value = round($this->_value_sum($g_id, $person_id, $stats) * 60 / $minutes, 2);
             } else {
                 $value = 0;
             }
             if (Stat::applicable($stat_type, $position) || $value != 0) {
                 $stats['Calculated'][$person_id][$stat_type['id']] = $value;
             }
         }
     }
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:19,代码来源:sport_hockey.php

示例6: pir_season

 function pir_season($stat_type, &$stats)
 {
     $p_id = $this->_stat_type_id('Points');
     $r_id = $this->_stat_type_id('Rebounds');
     $a_id = $this->_stat_type_id('Assists');
     $s_id = $this->_stat_type_id('Steals');
     $b_id = $this->_stat_type_id('Blocks');
     $fd_id = $this->_stat_type_id('Fouls Drawn');
     $fgm_id = $this->_stat_type_id('Field Goals Made');
     $fga_id = $this->_stat_type_id('Field Goals Attempted');
     $ftm_id = $this->_stat_type_id('Free Throws Made');
     $fta_id = $this->_stat_type_id('Free Throws Attempted');
     $tpfgm_id = $this->_stat_type_id('Three-point Field Goals Made');
     $tpfga_id = $this->_stat_type_id('Three-point Field Goals Attempted');
     $t_id = $this->_stat_type_id('Turnovers');
     $pf_id = $this->_stat_type_id('Personal Fouls');
     $sr_id = $this->_stat_type_id('Shots Rejected');
     $this->_init_rosters($stats);
     foreach ($this->rosters as $roster) {
         foreach ($roster as $person_id => $position) {
             $value = $this->_value_sum($p_id, $person_id, $stats) + $this->_value_sum($r_id, $person_id, $stats) + $this->_value_sum($a_id, $person_id, $stats) + $this->_value_sum($s_id, $person_id, $stats) + $this->_value_sum($b_id, $person_id, $stats) + $this->_value_sum($fd_id, $person_id, $stats) + $this->_value_sum($fgm_id, $person_id, $stats) - $this->_value_sum($fga_id, $person_id, $stats) + $this->_value_sum($ftm_id, $person_id, $stats) - $this->_value_sum($fta_id, $person_id, $stats) + $this->_value_sum($tpfgm_id, $person_id, $stats) - $this->_value_sum($tpfga_id, $person_id, $stats) - $this->_value_sum($t_id, $person_id, $stats) - $this->_value_sum($pf_id, $person_id, $stats) - $this->_value_sum($sr_id, $person_id, $stats);
             if (Stat::applicable($stat_type, $position) || $value != 0) {
                 $stats['Calculated'][$person_id][$stat_type['id']] = $value;
             }
         }
     }
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:27,代码来源:sport_basketball.php


注:本文中的Stat::applicable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。