App\Traits\Scoreable::accuracy PHP Метод

accuracy() публичный Метод

public accuracy ( )
    public function accuracy()
    {
        $hits = $this->hits();
        $totalHits = $this->totalHits();
        // in a rare case when the score row has zero hits
        // (found it occuring in multiplayer scores)
        if ($totalHits === 0) {
            return 0;
        } else {
            return $hits / $totalHits;
        }
    }