mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
drop unused stubs
This commit is contained in:
parent
2459f54d46
commit
7deec75fc4
@ -21,6 +21,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"nette/application": "^2.4",
|
||||
"nette/forms": "^2.4",
|
||||
"phpunit/phpunit": "^6.4",
|
||||
"slam/php-cs-fixer-extensions": "^1.7",
|
||||
"symfony/expression-language": "^3.3",
|
||||
|
@ -1,370 +0,0 @@
|
||||
<?php
|
||||
|
||||
# source: https://raw.githubusercontent.com/nette/application/12ce71ebb7389d2c24fa6f1a57a4348cad228c5e/src/Application/UI/Component.php
|
||||
# for: nette24.yml
|
||||
|
||||
/**
|
||||
* This file is part of the Nette Framework (https://nette.org)
|
||||
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Nette\Application\UI;
|
||||
|
||||
use Nette;
|
||||
|
||||
|
||||
/**
|
||||
* Component is the base class for all Presenter components.
|
||||
*
|
||||
* Components are persistent objects located on a presenter. They have ability to own
|
||||
* other child components, and interact with user. Components have properties
|
||||
* for storing their status, and responds to user command.
|
||||
*
|
||||
* @property-read Presenter $presenter
|
||||
* @property-read bool $linkCurrent
|
||||
*/
|
||||
abstract class Component extends Nette\ComponentModel\Container implements ISignalReceiver, IStatePersistent, \ArrayAccess
|
||||
{
|
||||
/** @var callable[] function (self $sender); Occurs when component is attached to presenter */
|
||||
public $onAnchor;
|
||||
|
||||
/** @var array */
|
||||
protected $params = [];
|
||||
|
||||
|
||||
/**
|
||||
* Returns the presenter where this component belongs to.
|
||||
* @param bool throw exception if presenter doesn't exist?
|
||||
*/
|
||||
public function getPresenter(bool $throw = true): ?Presenter
|
||||
{
|
||||
return $this->lookup(Presenter::class, $throw);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a fully-qualified name that uniquely identifies the component
|
||||
* within the presenter hierarchy.
|
||||
*/
|
||||
public function getUniqueId(): string
|
||||
{
|
||||
return $this->lookupPath(Presenter::class, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method will be called when the component (or component's parent)
|
||||
* becomes attached to a monitored object. Do not call this method yourself.
|
||||
*/
|
||||
protected function attached(Nette\ComponentModel\IComponent $presenter): void
|
||||
{
|
||||
if ($presenter instanceof Presenter) {
|
||||
$this->loadState($presenter->popGlobalParameters($this->getUniqueId()));
|
||||
$this->onAnchor($this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function validateParent(Nette\ComponentModel\IContainer $parent): void
|
||||
{
|
||||
parent::validateParent($parent);
|
||||
$this->monitor(Presenter::class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calls public method if exists.
|
||||
* @return bool does method exist?
|
||||
*/
|
||||
protected function tryCall(string $method, array $params): bool
|
||||
{
|
||||
$rc = $this->getReflection();
|
||||
if ($rc->hasMethod($method)) {
|
||||
$rm = $rc->getMethod($method);
|
||||
if ($rm->isPublic() && !$rm->isAbstract() && !$rm->isStatic()) {
|
||||
$this->checkRequirements($rm);
|
||||
try {
|
||||
$args = $rc->combineArgs($rm, $params);
|
||||
} catch (Nette\InvalidArgumentException $e) {
|
||||
throw new Nette\Application\BadRequestException($e->getMessage());
|
||||
}
|
||||
$rm->invokeArgs($this, $args);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks for requirements such as authorization.
|
||||
*/
|
||||
public function checkRequirements($element): void
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Access to reflection.
|
||||
*/
|
||||
public static function getReflection(): ComponentReflection
|
||||
{
|
||||
return new ComponentReflection(get_called_class());
|
||||
}
|
||||
|
||||
|
||||
/********************* interface IStatePersistent ****************d*g**/
|
||||
|
||||
|
||||
/**
|
||||
* Loads state informations.
|
||||
*/
|
||||
public function loadState(array $params): void
|
||||
{
|
||||
$reflection = $this->getReflection();
|
||||
foreach ($reflection->getPersistentParams() as $name => $meta) {
|
||||
if (isset($params[$name])) { // nulls are ignored
|
||||
$type = gettype($meta['def']);
|
||||
if (!$reflection->convertType($params[$name], $type)) {
|
||||
throw new Nette\Application\BadRequestException(sprintf(
|
||||
"Value passed to persistent parameter '%s' in %s must be %s, %s given.",
|
||||
$name,
|
||||
$this instanceof Presenter ? 'presenter ' . $this->getName() : "component '{$this->getUniqueId()}'",
|
||||
$type === 'NULL' ? 'scalar' : $type,
|
||||
is_object($params[$name]) ? get_class($params[$name]) : gettype($params[$name])
|
||||
));
|
||||
}
|
||||
$this->$name = $params[$name];
|
||||
} else {
|
||||
$params[$name] = $this->$name;
|
||||
}
|
||||
}
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves state informations for next request.
|
||||
*/
|
||||
public function saveState(array &$params): void
|
||||
{
|
||||
$this->getReflection()->saveState($this, $params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns component param.
|
||||
* @param string key
|
||||
* @param mixed default value
|
||||
* @return mixed
|
||||
*/
|
||||
public function getParameter(string $name, $default = null)
|
||||
{
|
||||
return $this->params[$name] ?? $default;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns component parameters.
|
||||
*/
|
||||
public function getParameters(): array
|
||||
{
|
||||
return $this->params;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a fully-qualified name that uniquely identifies the parameter.
|
||||
*/
|
||||
public function getParameterId(string $name): string
|
||||
{
|
||||
$uid = $this->getUniqueId();
|
||||
return $uid === '' ? $name : $uid . self::NAME_SEPARATOR . $name;
|
||||
}
|
||||
|
||||
|
||||
/** @deprecated */
|
||||
public function getParam($name = null, $default = null)
|
||||
{
|
||||
trigger_error(__METHOD__ . '() is deprecated; use getParameter() or getParameters() instead.', E_USER_DEPRECATED);
|
||||
return func_num_args() ? $this->getParameter($name, $default) : $this->getParameters();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns array of classes persistent parameters. They have public visibility and are non-static.
|
||||
* This default implementation detects persistent parameters by annotation @persistent.
|
||||
*/
|
||||
public static function getPersistentParams(): array
|
||||
{
|
||||
$rc = new \ReflectionClass(get_called_class());
|
||||
$params = [];
|
||||
foreach ($rc->getProperties(\ReflectionProperty::IS_PUBLIC) as $rp) {
|
||||
if (!$rp->isStatic() && ComponentReflection::parseAnnotation($rp, 'persistent')) {
|
||||
$params[] = $rp->getName();
|
||||
}
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
|
||||
/********************* interface ISignalReceiver ****************d*g**/
|
||||
|
||||
|
||||
/**
|
||||
* Calls signal handler method.
|
||||
* @throws BadSignalException if there is not handler method
|
||||
*/
|
||||
public function signalReceived(string $signal): void
|
||||
{
|
||||
if (!$this->tryCall($this->formatSignalMethod($signal), $this->params)) {
|
||||
$class = get_class($this);
|
||||
throw new BadSignalException("There is no handler for signal '$signal' in class $class.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Formats signal handler method name -> case sensitivity doesn't matter.
|
||||
*/
|
||||
public static function formatSignalMethod(string $signal): string
|
||||
{
|
||||
return 'handle' . $signal;
|
||||
}
|
||||
|
||||
|
||||
/********************* navigation ****************d*g**/
|
||||
|
||||
|
||||
/**
|
||||
* Generates URL to presenter, action or signal.
|
||||
* @param string destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
|
||||
* @param array|mixed
|
||||
* @throws InvalidLinkException
|
||||
*/
|
||||
public function link(string $destination, $args = []): string
|
||||
{
|
||||
try {
|
||||
$args = func_num_args() < 3 && is_array($args) ? $args : array_slice(func_get_args(), 1);
|
||||
return $this->getPresenter()->createRequest($this, $destination, $args, 'link');
|
||||
|
||||
} catch (InvalidLinkException $e) {
|
||||
return $this->getPresenter()->handleInvalidLink($e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns destination as Link object.
|
||||
* @param string destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
|
||||
* @param array|mixed
|
||||
*/
|
||||
public function lazyLink(string $destination, $args = []): Link
|
||||
{
|
||||
$args = func_num_args() < 3 && is_array($args) ? $args : array_slice(func_get_args(), 1);
|
||||
return new Link($this, $destination, $args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determines whether it links to the current page.
|
||||
* @param string destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
|
||||
* @param array|mixed
|
||||
* @throws InvalidLinkException
|
||||
*/
|
||||
public function isLinkCurrent(string $destination = null, $args = []): bool
|
||||
{
|
||||
if ($destination !== null) {
|
||||
$args = func_num_args() < 3 && is_array($args) ? $args : array_slice(func_get_args(), 1);
|
||||
$this->getPresenter()->createRequest($this, $destination, $args, 'test');
|
||||
}
|
||||
return $this->getPresenter()->getLastCreatedRequestFlag('current');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Redirect to another presenter, action or signal.
|
||||
* @param string destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
|
||||
* @param array|mixed
|
||||
* @throws Nette\Application\AbortException
|
||||
*/
|
||||
public function redirect($code, $destination = null, $args = []): void
|
||||
{
|
||||
if (is_numeric($code)) {
|
||||
trigger_error(__METHOD__ . '() first parameter $code is deprecated; use redirectPermanent() for 301 redirect.', E_USER_DEPRECATED);
|
||||
if (func_num_args() > 3 || !is_array($args)) {
|
||||
$args = array_slice(func_get_args(), 2);
|
||||
}
|
||||
} elseif (!is_numeric($code)) { // first parameter is optional
|
||||
$args = func_num_args() < 3 && is_array($destination) ? $destination : array_slice(func_get_args(), 1);
|
||||
$destination = $code;
|
||||
$code = null;
|
||||
}
|
||||
|
||||
$presenter = $this->getPresenter();
|
||||
$presenter->redirectUrl($presenter->createRequest($this, $destination, $args, 'redirect'), $code);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Permanently redirects to presenter, action or signal.
|
||||
* @param string destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
|
||||
* @param array|mixed
|
||||
* @throws Nette\Application\AbortException
|
||||
*/
|
||||
public function redirectPermanent(string $destination, $args = []): void
|
||||
{
|
||||
$args = func_num_args() < 3 && is_array($args) ? $args : array_slice(func_get_args(), 1);
|
||||
$presenter = $this->getPresenter();
|
||||
$presenter->redirectUrl(
|
||||
$presenter->createRequest($this, $destination, $args, 'redirect'),
|
||||
Nette\Http\IResponse::S301_MOVED_PERMANENTLY
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/********************* interface \ArrayAccess ****************d*g**/
|
||||
|
||||
|
||||
/**
|
||||
* Adds the component to the container.
|
||||
* @param Nette\ComponentModel\IComponent
|
||||
*/
|
||||
public function offsetSet($name, $component): void
|
||||
{
|
||||
$this->addComponent($component, $name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns component specified by name. Throws exception if component doesn't exist.
|
||||
* @throws Nette\InvalidArgumentException
|
||||
*/
|
||||
public function offsetGet($name): Nette\ComponentModel\IComponent
|
||||
{
|
||||
return $this->getComponent($name, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Does component specified by name exists?
|
||||
*/
|
||||
public function offsetExists($name): bool
|
||||
{
|
||||
return $this->getComponent($name, false) !== null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes component from the container.
|
||||
*/
|
||||
public function offsetUnset($name): void
|
||||
{
|
||||
$component = $this->getComponent($name, false);
|
||||
if ($component !== null) {
|
||||
$this->removeComponent($component);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,151 +0,0 @@
|
||||
<?php
|
||||
|
||||
# source: https://github.com/nette/application/blob/12ce71ebb7389d2c24fa6f1a57a4348cad228c5e/src/Application/UI/Control.php
|
||||
# for: nette24.yml
|
||||
|
||||
/**
|
||||
* This file is part of the Nette Framework (https://nette.org)
|
||||
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Nette\Application\UI;
|
||||
|
||||
use Nette;
|
||||
|
||||
|
||||
/**
|
||||
* Control is renderable Presenter component.
|
||||
*
|
||||
* @property-read ITemplate|Nette\Bridges\ApplicationLatte\Template|\stdClass $template
|
||||
*/
|
||||
abstract class Control extends Component implements IRenderable
|
||||
{
|
||||
/** @var bool */
|
||||
public $snippetMode;
|
||||
|
||||
/** @var ITemplateFactory */
|
||||
private $templateFactory;
|
||||
|
||||
/** @var ITemplate */
|
||||
private $template;
|
||||
|
||||
/** @var array */
|
||||
private $invalidSnippets = [];
|
||||
|
||||
|
||||
/********************* template factory ****************d*g**/
|
||||
|
||||
|
||||
public function setTemplateFactory(ITemplateFactory $templateFactory)
|
||||
{
|
||||
$this->templateFactory = $templateFactory;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getTemplate(): ITemplate
|
||||
{
|
||||
if ($this->template === null) {
|
||||
$this->template = $this->createTemplate();
|
||||
}
|
||||
return $this->template;
|
||||
}
|
||||
|
||||
|
||||
protected function createTemplate(): ITemplate
|
||||
{
|
||||
$templateFactory = $this->templateFactory ?: $this->getPresenter()->getTemplateFactory();
|
||||
return $templateFactory->createTemplate($this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Descendant can override this method to customize template compile-time filters.
|
||||
*/
|
||||
public function templatePrepareFilters(ITemplate $template): void
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saves the message to template, that can be displayed after redirect.
|
||||
*/
|
||||
public function flashMessage($message, string $type = 'info'): \stdClass
|
||||
{
|
||||
$id = $this->getParameterId('flash');
|
||||
$messages = $this->getPresenter()->getFlashSession()->$id;
|
||||
$messages[] = $flash = (object) [
|
||||
'message' => $message,
|
||||
'type' => $type,
|
||||
];
|
||||
$this->getTemplate()->flashes = $messages;
|
||||
$this->getPresenter()->getFlashSession()->$id = $messages;
|
||||
return $flash;
|
||||
}
|
||||
|
||||
|
||||
/********************* rendering ****************d*g**/
|
||||
|
||||
|
||||
/**
|
||||
* Forces control or its snippet to repaint.
|
||||
*/
|
||||
public function redrawControl($snippet = null, bool $redraw = true): void
|
||||
{
|
||||
if ($redraw) {
|
||||
$this->invalidSnippets[$snippet === null ? "\0" : $snippet] = true;
|
||||
|
||||
} elseif ($snippet === null) {
|
||||
$this->invalidSnippets = [];
|
||||
|
||||
} else {
|
||||
$this->invalidSnippets[$snippet] = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is required to repaint the control or its snippet?
|
||||
*/
|
||||
public function isControlInvalid(string $snippet = null): bool
|
||||
{
|
||||
if ($snippet === null) {
|
||||
if (count($this->invalidSnippets) > 0) {
|
||||
return true;
|
||||
|
||||
} else {
|
||||
$queue = [$this];
|
||||
do {
|
||||
foreach (array_shift($queue)->getComponents() as $component) {
|
||||
if ($component instanceof IRenderable) {
|
||||
if ($component->isControlInvalid()) {
|
||||
// $this->invalidSnippets['__child'] = true; // as cache
|
||||
return true;
|
||||
}
|
||||
|
||||
} elseif ($component instanceof Nette\ComponentModel\IContainer) {
|
||||
$queue[] = $component;
|
||||
}
|
||||
}
|
||||
} while ($queue);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
return $this->invalidSnippets[$snippet] ?? isset($this->invalidSnippets["\0"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns snippet HTML ID.
|
||||
*/
|
||||
public function getSnippetId(string $name): string
|
||||
{
|
||||
// HTML 4 ID & NAME: [A-Za-z][A-Za-z0-9:_.-]*
|
||||
return 'snippet-' . $this->getUniqueId() . '-' . $name;
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
# source: https://github.com/nette/application/blob/12ce71ebb7389d2c24fa6f1a57a4348cad228c5e/src/Application/UI/ITemplate.php
|
||||
# for: nette24.yml
|
||||
|
||||
/**
|
||||
* This file is part of the Nette Framework (https://nette.org)
|
||||
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Nette\Application\UI;
|
||||
|
||||
|
||||
/**
|
||||
* Defines template.
|
||||
*/
|
||||
interface ITemplate
|
||||
{
|
||||
|
||||
/**
|
||||
* Renders template to output.
|
||||
*/
|
||||
function render(): void;
|
||||
|
||||
/**
|
||||
* Sets the path to the template file.
|
||||
* @return static
|
||||
*/
|
||||
function setFile(string $file);
|
||||
|
||||
/**
|
||||
* Returns the path to the template file.
|
||||
*/
|
||||
function getFile(): ?string;
|
||||
}
|
@ -1,194 +0,0 @@
|
||||
<?php
|
||||
|
||||
# source: https://github.com/nette/application/blob/12ce71ebb7389d2c24fa6f1a57a4348cad228c5e/src/Bridges/ApplicationLatte/Template.php
|
||||
# for: nette24.ym
|
||||
|
||||
/**
|
||||
* This file is part of the Nette Framework (https://nette.org)
|
||||
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Nette\Bridges\ApplicationLatte;
|
||||
|
||||
use Latte;
|
||||
use Nette;
|
||||
|
||||
|
||||
/**
|
||||
* Latte powered template.
|
||||
*/
|
||||
class Template implements Nette\Application\UI\ITemplate
|
||||
{
|
||||
use Nette\SmartObject;
|
||||
|
||||
/** @var Latte\Engine */
|
||||
private $latte;
|
||||
|
||||
/** @var string */
|
||||
private $file;
|
||||
|
||||
/** @var array */
|
||||
private $params = [];
|
||||
|
||||
|
||||
public function __construct(Latte\Engine $latte)
|
||||
{
|
||||
$this->latte = $latte;
|
||||
}
|
||||
|
||||
|
||||
public function getLatte(): Latte\Engine
|
||||
{
|
||||
return $this->latte;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders template to output.
|
||||
*/
|
||||
public function render($file = null, array $params = []): void
|
||||
{
|
||||
$this->latte->render($file ?: $this->file, $params + $this->params);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders template to string.
|
||||
* @param can throw exceptions? (hidden parameter)
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
try {
|
||||
return $this->latte->renderToString($this->file, $this->params);
|
||||
} catch (\Throwable $e) {
|
||||
if (func_num_args()) {
|
||||
throw $e;
|
||||
}
|
||||
trigger_error('Exception in ' . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/********************* template filters & helpers ****************d*g**/
|
||||
|
||||
|
||||
/**
|
||||
* Registers run-time filter.
|
||||
* @return static
|
||||
*/
|
||||
public function addFilter(?string $name, callable $callback)
|
||||
{
|
||||
$this->latte->addFilter($name, $callback);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets translate adapter.
|
||||
* @return static
|
||||
*/
|
||||
public function setTranslator(?Nette\Localization\ITranslator $translator)
|
||||
{
|
||||
$this->latte->addFilter('translate', $translator === null ? null : function (Latte\Runtime\FilterInfo $fi, ...$args) use ($translator) {
|
||||
return $translator->translate(...$args);
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/********************* template parameters ****************d*g**/
|
||||
|
||||
|
||||
/**
|
||||
* Sets the path to the template file.
|
||||
* @return static
|
||||
*/
|
||||
public function setFile(string $file)
|
||||
{
|
||||
$this->file = $file;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getFile(): ?string
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds new template parameter.
|
||||
* @return static
|
||||
*/
|
||||
public function add($name, $value)
|
||||
{
|
||||
if (array_key_exists($name, $this->params)) {
|
||||
throw new Nette\InvalidStateException("The variable '$name' already exists.");
|
||||
}
|
||||
$this->params[$name] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets all parameters.
|
||||
* @return static
|
||||
*/
|
||||
public function setParameters(array $params)
|
||||
{
|
||||
$this->params = $params + $this->params;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns array of all parameters.
|
||||
*/
|
||||
public function getParameters(): array
|
||||
{
|
||||
return $this->params;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets a template parameter. Do not call directly.
|
||||
*/
|
||||
public function __set($name, $value): void
|
||||
{
|
||||
$this->params[$name] = $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a template parameter. Do not call directly.
|
||||
* @return mixed value
|
||||
*/
|
||||
public function &__get($name)
|
||||
{
|
||||
if (!array_key_exists($name, $this->params)) {
|
||||
trigger_error("The variable '$name' does not exist in template.", E_USER_NOTICE);
|
||||
}
|
||||
|
||||
return $this->params[$name];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determines whether parameter is defined. Do not call directly.
|
||||
*/
|
||||
public function __isset($name)
|
||||
{
|
||||
return isset($this->params[$name]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes a template parameter. Do not call directly.
|
||||
*/
|
||||
public function __unset(string $name): void
|
||||
{
|
||||
unset($this->params[$name]);
|
||||
}
|
||||
}
|
@ -71,6 +71,7 @@ final class PropertyBuilder
|
||||
}
|
||||
|
||||
$classPropertyName = (string) $inClassNode->props[0]->name;
|
||||
|
||||
if ($classPropertyName === $propertyName) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user