majority judgment library php
1.0.0
고의적 인 다수의 판결 여론 조사 ⚖.
작곡가를 사용하여 자신의 프로젝트에 필요합니다.
composer require mieuxvoter/majority-judgment
사용 :
use MieuxVoter MajorityJudgment MajorityJudgmentDeliberator ;
use MieuxVoter MajorityJudgment Model Settings MajorityJudgmentSettings ;
use MieuxVoter MajorityJudgment Model Tally ArrayPollTally ;
$ tally = new ArrayPollTally ([
' Proposal A ' => [ 1 , 1 , 4 , 3 , 7 , 4 , 1 ], // amount of judgments for each grade
' Proposal B ' => [ 0 , 2 , 4 , 6 , 4 , 2 , 3 ], // (worst grade to best grade)
]);
$ deliberator = new MajorityJudgmentDeliberator ();
$ result = $ deliberator -> deliberate ( $ tally );
// $result is a PollResultInterface
foreach ( $ result -> getProposalResults () as $ proposalResult ) {
// … Do something
print ( $ proposalResult -> getProposal ());
print ( $ proposalResult -> getRank ());
} PollTallyInterface 구현하는 객체는 입력으로 사용될 수 있습니다.
test/ 에서 테스트를 참조하십시오.
composer install --dev
vendor/phpunit/phpunit/phpunit -v test