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
  • Engine
  • Helpers
  • HtmlNode
  • MacroNode
  • MacroTokens
  • Parser
  • PhpHelpers
  • PhpWriter
  • Token
  • TokenIterator
  • Tokenizer

Interfaces

  • ILoader
  • IMacro

Traits

  • Strict

Exceptions

  • CompileException
  • RegexpException
  • RuntimeException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Latte (https://latte.nette.org)
 5:  * Copyright (c) 2008 David Grudl (https://davidgrudl.com)
 6:  */
 7: 
 8: namespace Latte;
 9: 
10: use LogicException;
11: 
12: 
13: /**
14:  * Better OOP experience.
15:  */
16: trait Strict
17: {
18: 
19:     /**
20:      * Call to undefined method.
21:      * @throws LogicException
22:      */
23:     public function __call($name, $args)
24:     {
25:         $class = method_exists($this, $name) ? 'parent' : get_class($this);
26:         $items = (new \ReflectionClass($this))->getMethods(\ReflectionMethod::IS_PUBLIC);
27:         $hint = ($t = Helpers::getSuggestion($items, $name)) ? ", did you mean $t()?" : '.';
28:         throw new LogicException("Call to undefined method $class::$name()$hint");
29:     }
30: 
31: 
32:     /**
33:      * Call to undefined static method.
34:      * @throws LogicException
35:      */
36:     public static function __callStatic($name, $args)
37:     {
38:         $rc = new \ReflectionClass(get_called_class());
39:         $items = array_intersect($rc->getMethods(\ReflectionMethod::IS_PUBLIC), $rc->getMethods(\ReflectionMethod::IS_STATIC));
40:         $hint = ($t = Helpers::getSuggestion($items, $name)) ? ", did you mean $t()?" : '.';
41:         throw new LogicException("Call to undefined static method {$rc->getName()}::$name()$hint");
42:     }
43: 
44: 
45:     /**
46:      * Access to undeclared property.
47:      * @throws LogicException
48:      */
49:     public function &__get($name)
50:     {
51:         $rc = new \ReflectionClass($this);
52:         $items = array_diff($rc->getProperties(\ReflectionProperty::IS_PUBLIC), $rc->getProperties(\ReflectionProperty::IS_STATIC));
53:         $hint = ($t = Helpers::getSuggestion($items, $name)) ? ", did you mean $$t?" : '.';
54:         throw new LogicException("Attempt to read undeclared property {$rc->getName()}::$$name$hint");
55:     }
56: 
57: 
58:     /**
59:      * Access to undeclared property.
60:      * @throws LogicException
61:      */
62:     public function __set($name, $value)
63:     {
64:         $rc = new \ReflectionClass($this);
65:         $items = array_diff($rc->getProperties(\ReflectionProperty::IS_PUBLIC), $rc->getProperties(\ReflectionProperty::IS_STATIC));
66:         $hint = ($t = Helpers::getSuggestion($items, $name)) ? ", did you mean $$t?" : '.';
67:         throw new LogicException("Attempt to write to undeclared property {$rc->getName()}::$$name$hint");
68:     }
69: 
70: 
71:     /**
72:      * @return bool
73:      */
74:     public function __isset($name)
75:     {
76:         return false;
77:     }
78: 
79: 
80:     /**
81:      * Access to undeclared property.
82:      * @throws LogicException
83:      */
84:     public function __unset($name)
85:     {
86:         $class = get_class($this);
87:         throw new LogicException("Attempt to unset undeclared property $class::$$name.");
88:     }
89: }
90: 
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0