# packeta/trunk/deps/nette/di/src/DI/Definitions/Reference.php

Packeta, version trunk. 50 lines.

- Page: https://pluginprobe.com/plugins/packeta/trunk/code/deps/nette/di/src/DI/Definitions/Reference.php
- Raw: https://pluginprobe.com/plugins/packeta/trunk/raw/deps/nette/di/src/DI/Definitions/Reference.php
- Modified: 2025-03-10T10:47:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/packeta/trunk/code/deps/nette/di/src/DI/Definitions/Reference.php#L10-L20`.

```php
<?php

/**
 * This file is part of the Nette Framework (https://nette.org)
 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
 */
declare (strict_types=1);
namespace Packetery\Nette\DI\Definitions;

use Packetery\Nette;
/**
 * Reference to service. Either by name or by type or reference to the 'self' service.
 */
final class Reference
{
    use \Packetery\Nette\SmartObject;
    public const Self = 'self';
    /** @deprecated use Reference::Self */
    public const SELF = self::Self;
    /** @var string */
    private $value;
    public static function fromType(string $value) : self
    {
        if (\strpos($value, '\\') === \false) {
            $value = '\\' . $value;
        }
        return new static($value);
    }
    public function __construct(string $value)
    {
        $this->value = $value;
    }
    public function getValue() : string
    {
        return $this->value;
    }
    public function isName() : bool
    {
        return \strpos($this->value, '\\') === \false && $this->value !== self::Self;
    }
    public function isType() : bool
    {
        return \strpos($this->value, '\\') !== \false;
    }
    public function isSelf() : bool
    {
        return $this->value === self::Self;
    }
}

```
