GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 3.x ( 56b2ee...e477bf )
by Jindřich
01:49
created

WebServiceName::isValidServiceName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
6
namespace Skautis\Wsdl;
7
8
9
use ReflectionClass;
10
11
/**
12
 * Dostupné webové služby SkautISu
13
 */
14
abstract class WebServiceName
15
{
16
17
  public const APPLICATION_MANAGEMENT = 'ApplicationManagement';
18
19
  public const CONTENT_MANAGEMENT = 'ContentManagement';
20
21
  public const DOCUMENT_STORAGE = 'DocumentStorage';
22
23
  public const EVALUATION = 'Evaluation';
24
25
  public const EVENTS = 'Events';
26
27
  public const EXPORTS = 'Exports';
28
29
  public const GOOGLE_APPS = 'GoogleApps';
30
31
  public const GRANTS = 'Grants';
32
33
  public const INSURANCE = 'Insurance';
34
35
  public const JOURNAL = 'Journal';
36
37
  public const MATERIAL = 'Material';
38
39
  public const MESSAGE = 'Message';
40
41
  public const ORGANIZATION_UNIT = 'OrganizationUnit';
42
43
  public const POWER = 'Power';
44
45
  public const REPORTS = 'Reports';
46
47
  public const SUMMARY = 'Summary';
48
49
  public const TASK = 'Task';
50
51
  public const TELEPHONY = 'Telephony';
52
53
  public const USER_MANAGEMENT = 'UserManagement';
54
55
  public const VIVANT = 'Vivant';
56
57
  public const WELCOME = 'Welcome';
58
59
  /**
60
   * @var string[]
61
   */
62
  private static $cachedConstants = [];
63
64
65
  /**
66
   * @return string[]
67
   */
68 5
  private static function getConstants(): array
69
  {
70 5
    if (!self::$cachedConstants) {
0 ignored issues
show
Bug Best Practice introduced by
The expression self::$cachedConstants of type string[] is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
71 1
      $reflect = new ReflectionClass(static::class);
72 1
      self::$cachedConstants = $reflect->getConstants();
0 ignored issues
show
Documentation Bug introduced by
It seems like $reflect->getConstants() of type array<string,integer|double|string|boolean> is incompatible with the declared type array<integer,string> of property $cachedConstants.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
73
    }
74
75 5
    return self::$cachedConstants;
76
  }
77
78 5
  public static function isValidServiceName(
79
    string $name
80
  ): bool {
81 5
    return in_array($name, self::getConstants(), true);
82
  }
83
}