fduh / poker-bundle
此包已弃用,不再维护。未建议替代包。
扑克和其他纸牌游戏的成果管理器。
dev-master
2018-02-14 07:43 UTC
Requires
- php: >=5.3.9
- fabienduhamel/g-chart-bundle: dev-master
- symfony/symfony: ^4.0
Requires (Dev)
- mockery/mockery: ^1.0
- phpunit/phpunit: ^7.0
This package is not auto-updated.
Last update: 2022-05-28 05:21:10 UTC
README
安装
添加依赖
$ composer require fduh/poker-bundle dev-master
添加包
// app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Fduh\PokerBundle\FduhPokerBundle(), // Optional, for Google Chart new SaadTazi\GChartBundle\SaadTaziGChartBundle(), ); } }
如何使用
结果处理器
在创建了一些赛季、事件和结果之后,现在你想管理玩家、排名和分数。以下是使用此包的方法
$resultsHandler = $this->get('poker.results_handler'); // Add events $resultsHandler->addEvents($yourEvents); // Or a season $resultsHandler->addSeason($yourSeason);
当然,你可以使用以下方式检索事件
// Reduces requests count $events = $this->get('poker.repository.hydrated.event')->findAllViewableEventsByDateAsc();
现在这是你如何在模板中使用结果处理器的方法
{% for eventData in resultsHandler.eventManager.eventsData %} {{ eventData.event }} // Access to the Event entity {# And other functions... #} {% endfor %} {% for playerData in resultsHandler.playerManager.playersData %} {{ playerData.player }} // Access to the Player entity {{ playerData.score }} {{ playerData.rank }} {{ playerData.wonEvents }} {# And a lot of functions... #} {% endfor %}
打开 PlayerDataInterface.php 和 EventDataInterface.php 以了解更多关于提供的属性。
在 standrewspokerclub.fr 查看实际示例。
图表
如果你想在控制器中显示分数演变
$chartMaker = $this->get('poker.chart_maker'); $chartMaker->setSeason($season); $chart = $chartMaker->getChart(); return array( 'chart' => $chart->toArray(), 'width' => $chartMaker->getWidth(), 'height' => $chartMaker->getHeight() // ... }
在模板中(我的示例)
<script> $(function() { {{ gchart_line_chart(chart, 'chart', width, height, null, { // your options } ) }} }); </script>
在 standrewspokerclub.fr 查看实际示例。
配置
参考转储
fduh_poker: calculation_class: ~
如果你想让包以不同的方式计算分数,使用实现 Fduh\PokerBundle\Calculator\CalculationStrategyInterface 的类覆盖 calculation_class。
运行此命令以重新计算每个分数
$ php app/console poker:update-scores
待办事项
- TwigExtensions
- 很多事.....
欢迎为该项目做出贡献。