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

Traits

  • CommentAware
  • FunctionLike
  • NameAware
  • VisibilityAware
  • 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\PhpGenerator\Traits;
 9: 
10: use Nette;
11: 
12: 
13: /**
14:  * @internal
15:  */
16: trait NameAware
17: {
18:     /** @var string */
19:     private $name;
20: 
21: 
22:     /**
23:      * @param  string
24:      */
25:     public function __construct($name)
26:     {
27:         if (!Nette\PhpGenerator\Helpers::isIdentifier($name)) {
28:             throw new Nette\InvalidArgumentException("Value '$name' is not valid name.");
29:         }
30:         $this->name = $name;
31:     }
32: 
33: 
34:     /** @deprecated */
35:     public function setName($name)
36:     {
37:         trigger_error(__METHOD__ . '() is deprecated, use constructor.', E_USER_DEPRECATED);
38:         $this->__construct($name);
39:         return $this;
40:     }
41: 
42: 
43:     /**
44:      * @return string
45:      */
46:     public function getName()
47:     {
48:         return $this->name;
49:     }
50: }
51: 
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0