mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-30 17:25:25 +09:00
Update composer dependencies
This commit is contained in:
parent
bb9a56bcac
commit
aabc7ac55e
690 changed files with 61555 additions and 37954 deletions
|
|
@ -185,7 +185,7 @@ class ElementNode extends Node
|
|||
public function removeChild(Node $child)
|
||||
{
|
||||
foreach ($this->children as $key => $value) {
|
||||
if ($value == $child) {
|
||||
if ($value === $child) {
|
||||
unset($this->children[$key]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
30
vendor/jbbcode/jbbcode/JBBCode/tests/validators/FnValidatorTest.php
vendored
Normal file
30
vendor/jbbcode/jbbcode/JBBCode/tests/validators/FnValidatorTest.php
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
class FnValidatorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test custom functional validator implementations.
|
||||
*
|
||||
* @param JBBCode\validators\FnValidator $validator
|
||||
* @dataProvider validatorProvider
|
||||
*/
|
||||
public function testValidator($validator)
|
||||
{
|
||||
$this->assertTrue($validator->validate('1234567890'));
|
||||
$this->assertFalse($validator->validate('QWERTZUIOP'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide custom numeric string validator implementations.
|
||||
*
|
||||
*/
|
||||
public function validatorProvider()
|
||||
{
|
||||
return array(
|
||||
array(new JBBCode\validators\FnValidator('is_numeric')),
|
||||
array(new JBBCode\validators\FnValidator(function ($input) {
|
||||
return is_numeric($input);
|
||||
})),
|
||||
);
|
||||
}
|
||||
}
|
||||
40
vendor/jbbcode/jbbcode/JBBCode/validators/FnValidator.php
vendored
Normal file
40
vendor/jbbcode/jbbcode/JBBCode/validators/FnValidator.php
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace JBBCode\validators;
|
||||
|
||||
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'InputValidator.php';
|
||||
|
||||
/**
|
||||
* An InputValidator that allows for shortcut implementation
|
||||
* of a validator using callable types (a function or a \Closure).
|
||||
*
|
||||
* @author Kubo2
|
||||
* @since Feb 2020
|
||||
*/
|
||||
class FnValidator implements \JBBCode\InputValidator
|
||||
{
|
||||
/**
|
||||
* @var callable
|
||||
*/
|
||||
private $validator;
|
||||
|
||||
/**
|
||||
* Construct a custom validator from a callable.
|
||||
* @param callable $validator
|
||||
*/
|
||||
public function __construct(callable $validator)
|
||||
{
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true iff the given input is valid, false otherwise.
|
||||
* @param string $input
|
||||
* @return boolean
|
||||
*/
|
||||
public function validate($input)
|
||||
{
|
||||
$validator = $this->validator; // FIXME: for PHP>=7.0 replace with ($this->validator)($input)
|
||||
return (bool) $validator($input);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue