PHP code example of lindelius / php-fide

1. Go to this page and download the library: Download lindelius/php-fide library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lindelius / php-fide example snippets


use Lindelius\FIDE\ContestantInterface;

final class MyContestant implements ContestantInterface
{
    private int $highestRating;
    private int $matchesPlayed;
    private int $rating;
    
    // ...

    public function getCurrentRating(): int
    {
        return $this->rating;
    }

    public function getHighestRating(): int
    {
        return $this->highestRating;
    }

    public function getTotalMatchesPlayed(): int
    {
        return $this->matchesPlayed;
    }
}

$newRatingForWinner = $ratingSystem->calculateRatingAfterWin($winner, $loser);
$newRatingForLoser = $ratingSystem->calculateRatingAfterLoss($loser, $winner);

$newRatingForContestant = $ratingSystem->calculateRatingAfterDraw($contestant, $opponent);
$newRatingForOpponent = $ratingSystem->calculateRatingAfterDraw($opponent, $contestant);

composer