parent
82254c2f79
commit
5ca17e7e59
@ -1,20 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Silex\Router;
|
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lorsqu'aucune route ne correspond à l'url demandée.
|
|
||||||
*/
|
|
||||||
class RouteNotFoundException extends Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
public function __construct(string $message, int $code = 0, ?Throwable $previous = null)
|
|
||||||
{
|
|
||||||
parent::__construct($message, $code, $previous);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Silex\Validation;
|
||||||
|
|
||||||
|
final class CommentValidation
|
||||||
|
{
|
||||||
|
public static function isValidComment(array $post, bool $requiresName, array &$errors): bool
|
||||||
|
{
|
||||||
|
if ($requiresName) {
|
||||||
|
UserValidation::isValidName($post, $errors, 'name');
|
||||||
|
}
|
||||||
|
if (empty($post['content'])) {
|
||||||
|
$errors[] = 'Empty message';
|
||||||
|
}
|
||||||
|
return empty($errors);
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,12 @@
|
|||||||
<?php if ($params['errors']):
|
<?php if ($params['errors']):
|
||||||
foreach ($params['errors'] as $error) { ?>
|
foreach ($params['errors'] as $error): ?>
|
||||||
<article class="message is-danger">
|
<article class="message is-danger">
|
||||||
<div class="message-header">
|
<div class="message-header">
|
||||||
<p>Auth failed</p>
|
<p>Error</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="message-body">
|
<div class="message-body">
|
||||||
<?= $error ?>
|
<?= $error ?>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
<?php } endif ?>
|
<?php endforeach;
|
||||||
|
endif; ?>
|
||||||
|
Loading…
Reference in new issue