1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6declare(strict_types=1);
7
8namespace App\Models\Traits;
9
10trait WithWeightedPp
11{
12 public ?float $weight = null;
13
14 public function weightedPp(): ?float
15 {
16 if ($this->weight !== null) {
17 $pp = $this->pp;
18
19 if ($pp !== null) {
20 return $this->weight * $pp;
21 }
22 }
23
24 return null;
25 }
26}