• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nette / di / 6739035766

02 Nov 2023 10:44PM UTC coverage: 52.037% (-41.8%) from 93.846%
6739035766

push

github

dg
x

1009 of 1939 relevant lines covered (52.04%)

0.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

60.0
/src/DI/Definitions/Reference.php
1
<?php
2

3
/**
4
 * This file is part of the Nette Framework (https://nette.org)
5
 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6
 */
7

8
declare(strict_types=1);
9

10
namespace Nette\DI\Definitions;
11

12
use Nette;
13

14

15
/**
16
 * Reference to service. Either by name or by type or reference to the 'self' service.
17
 */
18
final class Reference
19
{
20
        use Nette\SmartObject;
21

22
        public const Self = 'self';
23

24
        /** @deprecated use Reference::Self */
25
        public const SELF = self::Self;
26

27
        /** @var string */
28
        private $value;
29

30

31
        public static function fromType(string $value): self
32
        {
33
                if (strpos($value, '\\') === false) {
×
34
                        $value = '\\' . $value;
×
35
                }
36

37
                return new static($value);
×
38
        }
39

40

41
        public function __construct(string $value)
1✔
42
        {
43
                $this->value = $value;
1✔
44
        }
1✔
45

46

47
        public function getValue(): string
48
        {
49
                return $this->value;
1✔
50
        }
51

52

53
        public function isName(): bool
54
        {
55
                return strpos($this->value, '\\') === false && $this->value !== self::Self;
1✔
56
        }
57

58

59
        public function isType(): bool
60
        {
61
                return strpos($this->value, '\\') !== false;
×
62
        }
63

64

65
        public function isSelf(): bool
66
        {
67
                return $this->value === self::Self;
1✔
68
        }
69
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc