| 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 |
declare (strict_types=1); |
| 8 |
namespace Packetery\Nette\Schema; |
| 9 |
|
| 10 |
use Packetery\Nette; |
| 11 |
final class Context |
| 12 |
{ |
| 13 |
use \Packetery\Nette\SmartObject; |
| 14 |
/** @var bool */ |
| 15 |
public $skipDefaults = \false; |
| 16 |
/** @var string[] */ |
| 17 |
public $path = []; |
| 18 |
/** @var bool */ |
| 19 |
public $isKey = \false; |
| 20 |
/** @var Message[] */ |
| 21 |
public $errors = []; |
| 22 |
/** @var Message[] */ |
| 23 |
public $warnings = []; |
| 24 |
/** @var array[] */ |
| 25 |
public $dynamics = []; |
| 26 |
public function addError(string $message, string $code, array $variables = []) : Message |
| 27 |
{ |
| 28 |
$variables['isKey'] = $this->isKey; |
| 29 |
return $this->errors[] = new Message($message, $code, $this->path, $variables); |
| 30 |
} |
| 31 |
public function addWarning(string $message, string $code, array $variables = []) : Message |
| 32 |
{ |
| 33 |
return $this->warnings[] = new Message($message, $code, $this->path, $variables); |
| 34 |
} |
| 35 |
} |
| 36 |
|