1 | <?php |
||
2 | |||
3 | namespace Ijeffro\Laralocker\LearningLocker\StatementForwarding; |
||
4 | |||
5 | use Ijeffro\Laralocker\LearningLocker\API\APIHandler; |
||
6 | |||
7 | class StatementForwardingHandler extends APIHandler { |
||
8 | |||
9 | private $statement_forwarding = '/statementforwarding'; |
||
10 | private $api = '/api'; |
||
11 | private $v1 = '/v1'; |
||
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
12 | private $v2 = '/v2'; |
||
13 | |||
14 | protected $headers = [ |
||
15 | 'Content-Type' => 'application/json' |
||
16 | ]; |
||
17 | |||
18 | function __construct($id = null) { |
||
19 | parent::__construct(); |
||
20 | $this->id = $id; |
||
0 ignored issues
–
show
|
|||
21 | } |
||
22 | |||
23 | |||
24 | /** |
||
25 | * Learning Locker: Request Organisation Details |
||
26 | * |
||
27 | * @return $response |
||
0 ignored issues
–
show
|
|||
28 | */ |
||
29 | public function get() { |
||
30 | try { |
||
31 | $url = $this->url . $this->api . $this->v2 . $this->statement_forwarding . '/' . $this->id ?? $this->id; |
||
32 | $response = $this->request($url); |
||
33 | return $response; |
||
34 | } catch (Exception $e) { |
||
0 ignored issues
–
show
|
|||
35 | return $e; |
||
36 | } |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Learning Locker: Request Organisation Details |
||
41 | * |
||
42 | * @return $response |
||
0 ignored issues
–
show
|
|||
43 | */ |
||
44 | public function update($data) { |
||
45 | try { |
||
46 | $url = $this->url . $this->api . $this->v2 . $this->statement_forwarding . '/' . $this->id ?? $this->id; |
||
47 | $response = $this->save($url, $data); |
||
48 | return $response; |
||
49 | } catch (Exception $e) { |
||
50 | return $e; |
||
51 | } |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Learning Locker: Request Organisation Details |
||
56 | * |
||
57 | * @return $response |
||
0 ignored issues
–
show
|
|||
58 | */ |
||
59 | public function create($data = null) { |
||
60 | try { |
||
61 | $url = $this->url . $this->api . $this->v2 . $this->statement_forwarding; |
||
62 | $response = $this->make($url, $data); |
||
63 | return $response; |
||
64 | } catch (Exception $e) { |
||
65 | return $e; |
||
66 | } |
||
67 | } |
||
68 | } |
||
69 |