aboutsummaryrefslogtreecommitdiff
path: root/Psso/Context.php
blob: 5af21023560225de6ae3994e01639b0f2b9ee227 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
namespace Psso;

class Context {
    public protected(set) array $results = [];
    public ?string $user = null;
    public protected(set) array $groups = [];
    public protected(set) array $tags = [];

    public function addResult(ChallengeResult $result): void {
        $this->results[] = $result;
    }

    public function setTag(string $tag): void {
        if (!$this->hasTag($tag)) $this->tags[] = $tag;
    }

    public function hasTag(string $tag): bool {
        return in_array($tag, $this->tags);
    }
}