-
Notifications
You must be signed in to change notification settings - Fork 506
/
Copy pathConsistency.patch
45 lines (44 loc) · 1.47 KB
/
Consistency.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--- Consistency.php 2017-05-02 14:18:12.000000000 +0200
+++ Consistency.php 2020-05-05 08:28:35.000000000 +0200
@@ -319,42 +319,6 @@
$define('STREAM_CRYPTO_METHOD_ANY_CLIENT', 63);
}
-if (!function_exists('curry')) {
- /**
- * Curry.
- * Example:
- * $c = curry('str_replace', …, …, 'foobar');
- * var_dump($c('foo', 'baz')); // bazbar
- * $c = curry('str_replace', 'foo', 'baz', …);
- * var_dump($c('foobarbaz')); // bazbarbaz
- * Nested curries also work:
- * $c1 = curry('str_replace', …, …, 'foobar');
- * $c2 = curry($c1, 'foo', …);
- * var_dump($c2('baz')); // bazbar
- * Obviously, as the first argument is a callable, we can combine this with
- * \Hoa\Consistency\Xcallable ;-).
- * The “…” character is the HORIZONTAL ELLIPSIS Unicode character (Unicode:
- * 2026, UTF-8: E2 80 A6).
- *
- * @param mixed $callable Callable (two parts).
- * @param ... ... Arguments.
- * @return \Closure
- */
- function curry($callable)
- {
- $arguments = func_get_args();
- array_shift($arguments);
- $ii = array_keys($arguments, …, true);
-
- return function () use ($callable, $arguments, $ii) {
- return call_user_func_array(
- $callable,
- array_replace($arguments, array_combine($ii, func_get_args()))
- );
- };
- }
-}
-
/**
* Flex entity.
*/