Completed
Pull Request — master (#4)
by Siwapun
15:35 queued 13:55
created

multiply()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Aerophant\Ramda;
3
4
/**
5
 * Number → Number → Number
6
 * @param integer|float|double $firstValue
7
 * @param integer|float|double $secondValue
8
 * @return integer|float|double|\Closure
9
 */
10
function add()
11
{
12
  $add = function ($firstValue, $secondValue) {
13
    return $firstValue + $secondValue;
14
  };
15
  $arguments = func_get_args();
16
  $curried = curryN($add, 2);
17
  return call_user_func_array($curried, $arguments);
18
}
19
20
/**
21
 * Number → Number → Number
22
 * @param integer|float|double $firstValue
23
 * @param integer|float|double $secondValue
24
 * @return integer|float|double|\Closure
25
 */
26
function divide()
27
{
28
  $divide = function ($firstValue, $secondValue) {
29
    return $firstValue / $secondValue;
30
  };
31
  $arguments = func_get_args();
32
  $curried = curryN($divide, 2);
33
  return call_user_func_array($curried, $arguments);
34
}
35
36
/**
37
 * Number → Number → Number
38
 * @param integer|float|double $firstValue
39
 * @param integer|float|double $secondValue
40
 * @return integer|float|double|\Closure
41
 */
42
function multiply()
43
{
44
  $multiply = function ($firstValue, $secondValue) {
45
    return $firstValue * $secondValue;
46
  };
47
  $arguments = func_get_args();
48
  $curried = curryN($multiply, 2);
49
  return call_user_func_array($curried, $arguments);
50
}
51
52
/**
53
 * Number → Number → Number
54
 * @param integer|float|double $firstValue
55
 * @param integer|float|double $secondValue
56
 * @return integer|float|double|\Closure
57
 */
58
function subtract()
59
{
60
  $subtract = function ($firstValue, $secondValue) {
61
    return $firstValue - $secondValue;
62
  };
63
  $arguments = func_get_args();
64
  $curried = curryN($subtract, 2);
65
  return call_user_func_array($curried, $arguments);
66
}
67