Issues (256)

src/LearningLocker/Statements/StatementHandler.php (6 issues)

1
<?php
2
3
namespace Ijeffro\Laralocker\LearningLocker\Statements;
4
5
6
use Ijeffro\Laralocker\LearningLocker\API\APIHandler;
7
use Ijeffro\Laralocker\LearningLocker\StatementForwarding\StatementForwardingHandler;
8
9
class StatementHandler extends APIHandler {
10
11
    private $statements = '/statement';
12
    private $api = '/api';
13
    private $v1 = '/v1';
0 ignored issues
show
The private property $v1 is not used, and could be removed.
Loading history...
14
    private $v2 = '/v2';
15
16
    public $statement_forwarding;
17
18
    protected $headers = [
19
      'Content-Type' => 'application/json'
20
    ];
21
22
    function __construct($id = null) {
23
        parent::__construct();
24
        $this->id = $id;
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
25
    }
26
27
    /**
28
     * Learning Locker API: Clients
29
     *
30
     * @return ClientHandler
0 ignored issues
show
The type Ijeffro\Laralocker\Learn...tatements\ClientHandler was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
31
     */
32
    public function forwarding($id = null)
33
    {
34
        if ($this->statement_forwarding) return $this->statement_forwarding;
35
36
        $this->statement_forwarding = new StatementForwardingHandler($id ? $id : null);
37
        return $this->forwarding($id ? $id : null);
38
    }
39
40
    /**
41
     * Learning Locker: Request Organisation Details
42
     *
43
     * @return  $response
0 ignored issues
show
Documentation Bug introduced by
The doc comment $response at position 0 could not be parsed: Unknown type name '$response' at position 0 in $response.
Loading history...
44
     */
45
    public function get() {
46
        try {
47
            $url = $this->url . $this->api . $this->v2 . $this->statements . '/' . $this->id ?? $this->id;
48
            $response = $this->request($url);
49
            return $response;
50
        } catch (Exception $e) {
0 ignored issues
show
The type Ijeffro\Laralocker\Learn...er\Statements\Exception was not found. Did you mean Exception? If so, make sure to prefix the type with \.
Loading history...
51
            return $e;
52
        }
53
    }
54
55
    /**
56
     * Learning Locker: Request Organisation Details
57
     *
58
     * @return  $response
0 ignored issues
show
Documentation Bug introduced by
The doc comment $response at position 0 could not be parsed: Unknown type name '$response' at position 0 in $response.
Loading history...
59
     */
60
    public function update($data) {
61
        try {
62
            $url = $this->url . $this->api . $this->v2 . $this->statements . '/' . $this->id ?? $this->id;
63
            $response = $this->save($url, $data);
64
            return $response;
65
        } catch (Exception $e) {
66
            return $e;
67
        }
68
    }
69
}
70