respect-validation/library/Exceptions/KeyValueException.php

34 lines
954 B
PHP
Raw Normal View History

2015-10-08 18:54:42 +02:00
<?php
/*
* This file is part of Respect/Validation.
*
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
*
* For the full copyright and license information, please view the "LICENSE.md"
* file that was distributed with this source code.
*/
namespace Respect\Validation\Exceptions;
class KeyValueException extends ValidationException
{
const COMPONENT = 1;
2015-10-18 03:44:47 +02:00
public static $defaultTemplates = [
self::MODE_DEFAULT => [
2015-10-08 18:54:42 +02:00
self::STANDARD => 'Key {{name}} must be present',
self::COMPONENT => '{{baseKey}} must be valid to validate {{comparedKey}}',
2015-10-18 03:44:47 +02:00
],
self::MODE_NEGATIVE => [
2015-10-08 18:54:42 +02:00
self::STANDARD => 'Key {{name}} must not be present',
self::COMPONENT => '{{baseKey}} must not be valid to validate {{comparedKey}}',
2015-10-18 03:44:47 +02:00
],
];
2015-10-08 18:54:42 +02:00
public function chooseTemplate()
{
return $this->getParam('component') ? static::COMPONENT : static::STANDARD;
}
}