Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • Compiler
  • CompilerExtension
  • Container
  • ContainerBuilder
  • ContainerLoader
  • DependencyChecker
  • Helpers
  • PhpGenerator
  • PhpReflection
  • ServiceDefinition
  • Statement

Exceptions

  • MissingServiceException
  • ServiceCreationException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
 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: namespace Nette\DI;
 9: 
10: use Nette;
11: 
12: 
13: /**
14:  * Assignment or calling statement.
15:  *
16:  * @property string|array|ServiceDefinition|null $entity
17:  */
18: class Statement
19: {
20:     use Nette\SmartObject;
21: 
22:     /** @var array */
23:     public $arguments;
24: 
25:     /** @var string|array|ServiceDefinition|null */
26:     private $entity;
27: 
28: 
29:     /**
30:      * @param  string|array|ServiceDefinition|null
31:      */
32:     public function __construct($entity, array $arguments = [])
33:     {
34:         if (
35:             !is_string($entity) // Class, @service, not, PHP literal, entity::member
36:             && !(is_array($entity) && isset($entity[0], $entity[1])) // [Class | @service | '' | Statement | ServiceDefinition, method | $property | $appender]
37:             && !$entity instanceof ServiceDefinition
38:             && $entity !== null
39:         ) {
40:             throw new Nette\InvalidArgumentException('Argument is not valid Statement entity.');
41:         }
42:         $this->entity = $entity;
43:         $this->arguments = $arguments;
44:     }
45: 
46: 
47:     /** @deprecated */
48:     public function setEntity($entity)
49:     {
50:         trigger_error(__METHOD__ . ' is deprecated, change Statement object itself.', E_USER_DEPRECATED);
51:         $this->__construct($entity, $this->arguments);
52:         return $this;
53:     }
54: 
55: 
56:     public function getEntity()
57:     {
58:         return $this->entity;
59:     }
60: }
61: 
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0