PermCheck::solution()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 9.2
cc 4
eloc 6
nc 3
nop 1
1
<?php
2
3
namespace Lesson02;
4
5
class PermCheck
6
{
7
    public function solution($A)
8
    {
9
        $countValues = array_count_values($A);
10
        if (max($A) == count($countValues)) {
11
            if (min($countValues) == max($countValues) && min($countValues) == 1) {
12
                return 1;
13
            }
14
        }
15
16
        return 0;
17
    }
18
}
19