math.php ➔ default_value()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace DaveRoss\FunctionalProgrammingUtils;
4
5
/**
6
 * Add two numbers
7
 *
8
 * @param mixed $x
9
 * @param mixed $y
10
 *
11
 * @return mixed
12
 */
13
function add($x, $y)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $x. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $y. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
14
{
15
    return $x + $y;
16
}
17
18
/**
19
 * Invert a number
20
 *
21
 * @param mixed $x
22
 *
23
 * @return mixed
24
 */
25
function inverse($x)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $x. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
26
{
27
    return multiply($x, - 1);
28
}
29
30
/**
31
 * Subtract two numbers
32
 *
33
 * @param mixed $x
34
 * @param mixed $y
35
 *
36
 * @return mixed
37
 */
38
function subtract($x, $y)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $x. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $y. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
39
{
40
    return $x - $y;
41
}
42
43
/**
44
 * Multiply two numbers
45
 *
46
 * @param mixed $x
47
 * @param mixed $y
48
 *
49
 * @return mixed
50
 */
51
function multiply($x, $y)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $x. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $y. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
52
{
53
    return $x * $y;
54
}
55
56
/**
57
 * Divide two numbers
58
 *
59
 * @param mixed $x
60
 * @param mixed $y
61
 *
62
 * @return float
63
 */
64
function divide($x, $y)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $x. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $y. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
65
{
66
    return $x / $y;
67
}
68
69
/**
70
 * Divide two numbers, return the modulus
71
 *
72
 * @param mixed $x
73
 * @param mixed $y
74
 *
75
 * @return int
76
 */
77
function modulus($x, $y)
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $x. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $y. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
78
{
79
    return $x % $y;
80
}
81
82
/**
83
 * Check if a value is "truthy" but not necessarily equal to true
84
 *
85
 * @param mixed $x
86
 *
87
 * @return bool
88
 */
89
function truthy($x)
0 ignored issues
show
Coding Style introduced by
function truthy() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $x. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
90
{
91
    return true == $x;
92
}
93
94
/**
95
 * Check if a value is boolean true
96
 *
97
 * @param mixed $x
98
 *
99
 * @return bool
100
 */
101
function true($x)
0 ignored issues
show
Coding Style introduced by
function true() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $x. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
102
{
103
    return true === $x;
104
}
105
106
/**
107
 * Check if a value is "falsey" but not necessarily equal to false
108
 *
109
 * @param mixed $x
110
 *
111
 * @return bool
112
 */
113
function falsy($x)
0 ignored issues
show
Coding Style introduced by
function falsy() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $x. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
114
{
115
    return false == $x;
116
}
117
118
/**
119
 * Check if a value is boolean false
120
 *
121
 * @param mixed $x
122
 *
123
 * @return bool
124
 */
125
function false($x)
0 ignored issues
show
Coding Style introduced by
function false() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $x. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
126
{
127
    return false === $x;
128
}
129
130
/**
131
 * Return a value or a default if the value is null or not set
132
 *
133
 * @param mixed $x
134
 * @param mixed $y default value
135
 *
136
 * @return mixed
137
 */
138
function default_value($x, $y = null)
0 ignored issues
show
Coding Style introduced by
function default_value() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $x. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $y. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
139
{
140
    return null === $y ? $x : $y;
141
}
142