Code Duplication    Length = 5-5 lines in 2 locations

src/Api/Profile.php 1 location

@@ 57-61 (lines=5) @@
54
    private function isValidFields(array $fields): void
55
    {
56
        $allowedFields = $this->getAllowedFields();
57
        foreach ($fields as $field) {
58
            if (!\in_array($field, $allowedFields, true)) {
59
                throw new InvalidKeyException(sprintf('%s is not a valid value. fields must only contain "%s".', $field, implode(', ', $allowedFields)));
60
            }
61
        }
62
    }
63
64
    private function getAllowedFields(): array

src/Api/User.php 1 location

@@ 23-27 (lines=5) @@
20
        $fields = empty($fields) ? $allowedFields : $fields;
21
22
        if ($fields !== $allowedFields) {
23
            foreach ($fields as $field) {
24
                if (!\in_array($field, $allowedFields, true)) {
25
                    throw new InvalidKeyException(sprintf('%s is not a valid value. fields must only contain "%s".', $field, implode(', ', $allowedFields)));
26
                }
27
            }
28
        }
29
30
        $request = new UserRequest($this->pageToken, $fields);