Completed
Push — master ( 75ca6a...d59674 )
by Владислав
02:12
created

RuCaptcha   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 2
cbo 1
dl 0
loc 17
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 5 1
A getBalance() 0 6 1
1
<?php
2
3
namespace jumper423\decaptcha\services;
4
5
use jumper423\decaptcha\core\DeCaptchaBase;
6
7
/**
8
 * Распознавание капчи RuCaptcha.
9
 *
10
 * Class RuCaptcha
11
 *
12
 * @link http://infoblog1.ru/goto/rucaptcha
13
 */
14
class RuCaptcha extends DeCaptchaBase
15
{
16
    public $domain = 'rucaptcha.com';
17
18
    public function init()
19
    {
20
        parent::init();
21
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_SOFT_ID][static::PARAM_SLUG_DEFAULT] = 882;
22
    }
23
24
    public function getBalance(){
25
        $this->setParam(static::ACTION_FIELD_ACTION, 'getbalance');
26
        $response = $this->getResponse(static::ACTION_UNIVERSAL);
27
        $dataGet = $this->decodeResponse(static::DECODE_ACTION_GET, $response);
28
        return $dataGet[static::DECODE_PARAM_RESPONSE];
29
    }
30
}
31