-
-
Notifications
You must be signed in to change notification settings - Fork 154
Expand file tree
/
Copy pathTextDocumentLanguage.php
More file actions
51 lines (41 loc) · 1010 Bytes
/
TextDocumentLanguage.php
File metadata and controls
51 lines (41 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace Phpactor\TextDocument;
class TextDocumentLanguage
{
const LANGUAGE_UNDEFINED = 'undefined';
const LANGUAGE_PHP = 'php';
private function __construct(private string $language)
{
}
public function __toString(): string
{
return $this->language;
}
public static function fromString(string $language): self
{
return new self($language);
}
public static function undefined(): self
{
return new self(self::LANGUAGE_UNDEFINED);
}
public function is(string $language): bool
{
return $this->language === strtolower($language);
}
/**
* @param array<string> $languages
*/
public function in(array $languages): bool
{
return in_array($this->language, $languages);
}
public function isDefined(): bool
{
return !$this->is(self::LANGUAGE_UNDEFINED);
}
public function isPhp(): bool
{
return $this->is(self::LANGUAGE_PHP);
}
}