# betterdocs/3.8.9/includes/Dependencies/DI/Definition/ValueDefinition.php

BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ &amp; Chatbot, version 3.8.9. 73 lines.

- Page: https://pluginprobe.com/plugins/betterdocs/3.8.9/code/includes/Dependencies/DI/Definition/ValueDefinition.php
- Raw: https://pluginprobe.com/plugins/betterdocs/3.8.9/raw/includes/Dependencies/DI/Definition/ValueDefinition.php
- Modified: 2023-08-14T08:41:14+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/betterdocs/3.8.9/code/includes/Dependencies/DI/Definition/ValueDefinition.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace WPDeveloper\BetterDocs\Dependencies\DI\Definition;

use WPDeveloper\BetterDocs\Dependencies\Psr\Container\ContainerInterface;

/**
 * Definition of a value for dependency injection.
 *
 * @author Matthieu Napoli <matthieu@mnapoli.fr>
 */
class ValueDefinition implements Definition, SelfResolvingDefinition
{
    /**
     * Entry name.
     * @var string
     */
    private $name = '';

    /**
     * @var mixed
     */
    private $value;

    /**
     * @param mixed $value
     */
    public function __construct($value)
    {
        $this->value = $value;
    }

    public function getName() : string
    {
        return $this->name;
    }

    public function setName(string $name)
    {
        $this->name = $name;
    }

    /**
     * @return mixed
     */
    public function getValue()
    {
        return $this->value;
    }

    public function resolve(ContainerInterface $container)
    {
        return $this->getValue();
    }

    public function isResolvable(ContainerInterface $container) : bool
    {
        return true;
    }

    public function replaceNestedDefinitions(callable $replacer)
    {
        // no nested definitions
    }

    public function __toString()
    {
        return sprintf('Value (%s)', var_export($this->value, true));
    }
}

```
