Completed
Push — master ( 713d54...d55531 )
by Amine
02:08
created

operators.php ➔ notEq()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php namespace Tarsana\Functional;
2
3
/**
4
 * This file contains operators as functions.
5
 */
6
7
/**
8
 * Returns `$a && $b`.
9
 *
10
 * @signature Boolean -> Boolean -> Boolean
11
 * @param  bool $a
0 ignored issues
show
Bug introduced by
There is no parameter named $a. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
12
 * @param  bool $b
0 ignored issues
show
Bug introduced by
There is no parameter named $b. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
13
 * @return bool
14
 */
15
function and_() {
16
    return apply(curry(function($a, $b){
17
        return $a && $b;
18
    }), func_get_args());
19
}
20
21
/**
22
 * Returns `$a || $b`.
23
 *
24
 * @signature Boolean -> Boolean -> Boolean
25
 * @param  bool $a
0 ignored issues
show
Bug introduced by
There is no parameter named $a. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
26
 * @param  bool $b
0 ignored issues
show
Bug introduced by
There is no parameter named $b. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
27
 * @return bool
28
 */
29
function or_() {
30
    return apply(curry(function($a, $b){
31
        return $a || $b;
32
    }), func_get_args());
33
}
34
35
/**
36
 * Returns `!$x`.
37
 *
38
 * @signature Boolean -> Boolean
39
 * @param  bool $x
0 ignored issues
show
Bug introduced by
There is no parameter named $x. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
40
 * @return bool
41
 */
42
function not() {
43
    $not = function($x) {
44
        return !$x;
45
    };
46
    return apply(curry($not), func_get_args());
47
}
48
49
/**
50
 * Returns `$x == $y`.
51
 *
52
 * @signature * -> * -> Boolean
53
 * @param  mixed $a
0 ignored issues
show
Bug introduced by
There is no parameter named $a. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
54
 * @param  mixed $b
0 ignored issues
show
Bug introduced by
There is no parameter named $b. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
55
 * @return bool
56
 */
57
function eq() {
58
    return apply(curry(function($a, $b){
59
        return $a == $b;
60
    }), func_get_args());
61
}
62
63
/**
64
 * Returns `$x === $y`.
65
 *
66
 * @signature * -> * -> Boolean
67
 * @param  mixed $a
0 ignored issues
show
Bug introduced by
There is no parameter named $a. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
68
 * @param  mixed $b
0 ignored issues
show
Bug introduced by
There is no parameter named $b. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
69
 * @return bool
70
 */
71
function eqq() {
72
    return apply(curry(function($a, $b){
73
        return $a === $b;
74
    }), func_get_args());
75
}
76
77
/**
78
 * Returns `true` if the two elements have the same type and are deeply equivalent.
79
 * ```php
80
 * $a = (object) ['a' => 1, 'b' => (object) ['c' => 'Hello'], 'd' => false];
81
 * $b = (object) ['a' => 1, 'b' => (object) ['c' => 'Hi'], 'd' => false];
82
 * $c = (object) ['a' => 1, 'b' => ['c' => 'Hello'], 'd' => false];
83
 * equals(5, '5'); // false (should have the same type)
84
 * equals([1, 2, 3], [1, 2, 3]); // true 
85
 * equals([1, 3, 2], [1, 2, 3]); // false (should have the same order)
86
 * equals($a, $b); // false
87
 * equals($a, $c); // false
88
 * $b->b->c = 'Hello';
89
 * equals($a, $b); // true
90
 * ```
91
 *
92
 * @signature * -> * -> Boolean
93
 * @param  mixed $a
0 ignored issues
show
Bug introduced by
There is no parameter named $a. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
94
 * @param  mixed $b
0 ignored issues
show
Bug introduced by
There is no parameter named $b. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
95
 * @return bool
96
 */
97
function equals() {
98
    $equals = function($a, $b) {
99
            $type = type($a);
100
            if ($type != type($b))
101
                return false;
102
            switch ($type) {
103
                case 'Null':
104
                case 'Boolean':
105
                case 'String':
106
                case 'Number':
107
                case 'Unknown':
108
                case 'Function':
109
                case 'Resource':
110
                case 'Error':
111
                case 'Stream':
112
                    return $a == $b;
113
                case 'List':
114
                    $length = length($a);
115
                    return length($b) != $length ? false :
116
                           0 == $length ? true :
117
                           equals(head($a), head($b)) && equals(tail($a), tail($b));
118
                case 'Array':
119
                case 'ArrayObject':
120
                case 'Object':
121
                    return equals(keys($a), keys($b)) && equals(values($a), values($b));
122
            }
123
    };
124
    return apply(curry($equals), func_get_args());
125
}
126
127
128
/**
129
 * Returns `$a < $b`.
130
 *
131
 * @signature * -> * -> Boolean
132
 * @param  mixed $a
0 ignored issues
show
Bug introduced by
There is no parameter named $a. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
133
 * @param  mixed $b
0 ignored issues
show
Bug introduced by
There is no parameter named $b. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
134
 * @return bool
135
 */
136
function lt() {
137
    return apply(curry(function($a, $b){
138
        return $a < $b;
139
    }), func_get_args());
140
}
141
142
/**
143
 * Returns `$a <= $b`.
144
 *
145
 * @signature * -> * -> Boolean
146
 * @param  mixed $a
0 ignored issues
show
Bug introduced by
There is no parameter named $a. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
147
 * @param  mixed $b
0 ignored issues
show
Bug introduced by
There is no parameter named $b. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
148
 * @return bool
149
 */
150
function lte() {
151
    return apply(curry(function($a, $b){
152
        return $a <= $b;
153
    }), func_get_args());
154
}
155
156
/**
157
 * Returns `$a > $b`.
158
 *
159
 * @signature * -> * -> Boolean
160
 * @param  mixed $a
0 ignored issues
show
Bug introduced by
There is no parameter named $a. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
161
 * @param  mixed $b
0 ignored issues
show
Bug introduced by
There is no parameter named $b. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
162
 * @return bool
163
 */
164
function gt() {
165
    return apply(curry(function($a, $b){
166
        return $a > $b;
167
    }), func_get_args());
168
}
169
170
/**
171
 * Returns `$a >= $b`.
172
 *
173
 * @signature * -> * -> Boolean
174
 * @param  mixed $a
0 ignored issues
show
Bug introduced by
There is no parameter named $a. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
175
 * @param  mixed $b
0 ignored issues
show
Bug introduced by
There is no parameter named $b. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
176
 * @return bool
177
 */
178
function gte() {
179
    return apply(curry(function($a, $b){
180
        return $a >= $b;
181
    }), func_get_args());
182
}
183