Completed
Push — master ( 824234...3d4430 )
by Dmitry
9s
created

Client::getTaskResult()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @project Anticaptcha library
4
 */
5
6
namespace Anticaptcha;
7
8
use Anticaptcha\Entity\ImageToTextTask;
9
use Anticaptcha\Entity\QueueStats;
10
use Anticaptcha\Entity\Result;
11
12
/**
13
 * Class Client
14
 *
15
 * @author Dmitry Gladyshev <[email protected]>
16
 * @since 1.0
17
 */
18
class Client extends Service
19
{
20
    /**
21
     * @param string $string # base64 to resolve
22
     * @return int
23
     */
24
    public function createTaskByBase64($string)
25
    {
26
        return $this->createTask(ImageToTextTask::fromBase64($string));
27
    }
28
    /**
29
     * @param string $link  # Path or URL of image to resolve
30
     * @return int
31
     */
32
    public function createTaskByImage($link)
33
    {
34
        return $this->createTask(ImageToTextTask::fromImage($link));
35
    }
36
37
    /**
38
     * @param TaskInterface $task
39
     * @return int
40
     * @see https://anticaptcha.atlassian.net/wiki/spaces/API/pages/5079073/createTask+captcha+task+creating
41
     */
42
    public function createTask(TaskInterface $task)
43
    {
44
        return $this->call('createTask', [
45
            'task' => $task->toArray(),
46
        ]);
47
    }
48
49
    /**
50
     * @return double
51
     * @see https://anticaptcha.atlassian.net/wiki/spaces/API/pages/6389791/getBalance+retrieve+account+balance
52
     */
53
    public function getBalance()
54
    {
55
        return $this->call('getBalance');
56
    }
57
58
    /**
59
     * @param int $queueId
60
     * @return QueueStats
61
     * @see https://anticaptcha.atlassian.net/wiki/spaces/API/pages/8290316/getQueueStats+obtain+queue+load+statistics
62
     */
63
    public function getQueueStats($queueId)
64
    {
65
        return $this->call('getQueueStats', [
66
            'queueId' => $queueId
67
        ]);
68
    }
69
70
    /**
71
     * @param int $taskId
72
     * @return Result
73
     * https://anticaptcha.atlassian.net/wiki/spaces/API/pages/5079103/getTaskResult+request+task+result
74
     */
75
    public function getTaskResult($taskId)
76
    {
77
        return $this->call('getTaskResult', [
78
            'taskId' => $taskId
79
        ]);
80
    }
81
82
    /**
83
     * @param $taskId
84
     * @return mixed
85
     * @see https://anticaptcha.atlassian.net/wiki/spaces/API/pages/48693258/reportIncorrectImageCaptcha+sent+complaint+on+an+image+captcha
86
     */
87
    public function reportIncorrectImageCaptcha($taskId)
88
    {
89
        return $this->call('reportIncorrectImageCaptcha', [
90
            'taskId' => $taskId
91
        ]);
92
    }
93
}
94