Issues (256)

src/LearningLocker/Organisation/Organisation.php (2 issues)

1
<?php
2
namespace HT2\LaraLocker\LearningLocker;
3
4
use Exception;
5
6
class Organisation extends Connection {
0 ignored issues
show
The type HT2\LaraLocker\LearningLocker\Connection 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...
7
8
  private $organisation = '/organisation';
9
  private $api = '/api';
10
  private $v2 = '/v2';
11
12
  private $headers = [
13
    'content-type' => 'application/json'
14
  ];
15
16
  /**
17
   * Get the Learning Locker Statement Forward by ID.
18
   *
19
   * @param   $id
20
   * @return  $response
21
   */
22
  public function get() {
23
    try {
24
      $url = $this->endpoint . $this->api . $this->v2 . $this->organisation;
25
      $request = $this->getClient()->get($url, [
26
        'auth' => $this->getAuth(),
27
        'headers' => [
28
          'content-type' => 'application/json'
29
        ],
30
      ]);
31
      $response = $request->json();
32
      return $response;
33
    } catch (Exception $e) {
34
      return false;
35
    }
36
  }
37
38
  /**
39
   * Get the Learning Locker Organisation Name.
40
   *
41
   * @param   $org
42
   * @return  $response, false
43
   */
44
  public function id() {
45
    $response = $this->get();
46
    if($response) {
47
      $id = $response[0]['_id'];
48
      $setSetting = LLService::create($this->org, LLService::LL_ID)->setSetting(LLService::ORGANISATION_ID, $id);
0 ignored issues
show
The type HT2\LaraLocker\LearningLocker\LLService 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...
49
      return $id;
50
    }
51
    return false;
52
  }
53
54
  /**
55
   * Get the Learning Locker Organisation Name.
56
   *
57
   * @param   $org
58
   * @return  $response, false
59
   */
60
  public function name()
61
  {
62
    $response = $this->get();
63
    if($response) {
64
      $name = $response[0]['name'];
65
      $setSetting = LLService::create($this->org, LLService::LL_ID)->setSetting(LLService::ORGANISATION, $name);
66
      return $name;
67
    }
68
    return false;
69
70
  }
71
72
}
73