Completed
Push — master ( 599dfd...0e29c2 )
by Владислав
02:23
created

DeCaptchaWiki   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 10
lcom 0
cbo 1
dl 0
loc 44
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B view() 0 32 6
A ggg() 0 8 4
1
<?php
2
3
namespace jumper423\decaptcha\core;
4
5
use jumper423\decaptcha\services\RuCaptcha;
6
7
/**
8
 * Class DeCaptchaAbstract.
9
 */
10
class DeCaptchaWiki
11
{
12
    public function view(){
13
        $rucaptcha = new RuCaptcha([]);
14
        /*
15
         * Markdown | Less | Pretty
16
            --- | --- | ---
17
            *Still* | `renders` | **nicely**
18
            1 | 2 | 3
19
         *
20
         * */
21
        echo " Название | Код | Тип | Обязательное значение | Значение по умолчания | Возможные значения | Описание " . PHP_EOL;
22
        echo " --- | --- | --- | --- | --- | ---| --- " . PHP_EOL;
23
        $rr = (new \ReflectionClass($rucaptcha))->getConstants();
24
//        print_r($rr);
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
25
        foreach ($rucaptcha->actions[RuCaptcha::ACTION_RECOGNIZE][RuCaptcha::ACTION_FIELDS] as $param => $setting) {
26
            if (array_key_exists(RuCaptcha::PARAM_SLUG_NOTWIKI, $setting) && $setting[RuCaptcha::PARAM_SLUG_NOTWIKI] === true) {
27
                continue;
28
            }
29
            echo " {$this->ggg($rr, 'ACTION_FIELD_', $param)} |";
30
            echo " {$this->ggg($rr, 'ACTION_FIELD_', $param)} |";
31
            echo " ".substr($this->ggg($rr, 'PARAM_FIELD_TYPE_', $setting[RuCaptcha::PARAM_SLUG_TYPE]), 17) ." |";
32
            echo " ".(array_key_exists(RuCaptcha::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-') ." |";
33
            echo " ".(array_key_exists(RuCaptcha::PARAM_SLUG_DEFAULT, $setting) ? $setting[RuCaptcha::PARAM_SLUG_DEFAULT] : '') ." |";
34
            echo " |";
35
            echo " ". PHP_EOL;
36
//            echo " --- | --- | --- | --- | ---| --- " . PHP_EOL;
0 ignored issues
show
Unused Code Comprehensibility introduced by
44% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
37
//            print_r($params);
38
        }
39
//        $rr = get_defined_constants(true);
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
40
//        print_r(array_keys($rr));
41
//        print_r($rr);
42
//        file_put_contents(__DIR__ . '/12331123', json_encode(get_defined_constants(true)));
43
    }
44
45
    public function ggg($constants, $keyMask, $value){
46
        foreach ($constants as $key => $val) {
47
            if (stripos($key, $keyMask) !== false && $val === $value) {
48
                return $key;
49
            }
50
        }
51
        return null;
52
    }
53
}
54