Subir todo el proyecto incluyendo vendor y dependencias
This commit is contained in:
32
vendor/react/partial/src/Placeholder.php
vendored
Executable file
32
vendor/react/partial/src/Placeholder.php
vendored
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace React\Partial;
|
||||
|
||||
final class Placeholder
|
||||
{
|
||||
private static $instance = null;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function create()
|
||||
{
|
||||
if (self::$instance === null) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public function resolve(array &$args, $position)
|
||||
{
|
||||
if (count($args) === 0) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf('Cannot resolve parameter placeholder at position %d. Parameter stack is empty.', $position)
|
||||
);
|
||||
}
|
||||
|
||||
return array_shift($args);
|
||||
}
|
||||
}
|
||||
16
vendor/react/partial/src/Util.php
vendored
Executable file
16
vendor/react/partial/src/Util.php
vendored
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace React\Partial;
|
||||
|
||||
final class Util
|
||||
{
|
||||
public static function bind(/*$fn, $args...*/)
|
||||
{
|
||||
return call_user_func_array('React\Partial\bind', func_get_args());
|
||||
}
|
||||
|
||||
public static function bindRight(/*$fn, $args...*/)
|
||||
{
|
||||
return call_user_func_array('React\Partial\bind_right', func_get_args());
|
||||
}
|
||||
}
|
||||
63
vendor/react/partial/src/functions.php
vendored
Executable file
63
vendor/react/partial/src/functions.php
vendored
Executable file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace React\Partial;
|
||||
|
||||
/**
|
||||
* @return callable
|
||||
*/
|
||||
function bind(callable $fn, ...$bound)
|
||||
{
|
||||
return function (...$args) use ($fn, $bound) {
|
||||
return $fn(...mergeLeft($bound, $args));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return callable
|
||||
*/
|
||||
function bind_right(callable $fn, ...$bound)
|
||||
{
|
||||
return function (...$args) use ($fn, $bound) {
|
||||
return $fn(...mergeRight($bound, $args));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Placeholder
|
||||
**/
|
||||
function …()
|
||||
{
|
||||
return Placeholder::create();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Placeholder
|
||||
**/
|
||||
function placeholder()
|
||||
{
|
||||
return …();
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function mergeLeft(array $left, array $right)
|
||||
{
|
||||
resolvePlaceholder($left, $right);
|
||||
return array_merge($left, $right);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function mergeRight(array $left, array $right)
|
||||
{
|
||||
resolvePlaceholder($left, $right);
|
||||
return array_merge($right, $left);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function resolvePlaceholder(array &$parameters, array &$source)
|
||||
{
|
||||
foreach ($parameters as $position => &$param) {
|
||||
if ($param instanceof Placeholder) {
|
||||
$param = $param->resolve($source, $position);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user