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