This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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
|
|||
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
|
|||
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
|
|||
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
|
|||
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
|
|||
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
|
|||
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
|
|||
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
|
|||
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
|
|||
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
|
|||
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
|
|||
139 | { |
||
140 | return null === $y ? $x : $y; |
||
141 | } |
||
142 |
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.