Issues (256)

src/LearningLocker/API.php (5 issues)

Labels
Severity
1
<?php
2
namespace HT2\Integrations\LearningLocker;
3
4
use HT2\Integrations\LearningLocker\Check;
0 ignored issues
show
The type HT2\Integrations\LearningLocker\Check 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...
5
use HT2\Integrations\LearningLocker\Client;
6
use HT2\Integrations\LearningLocker\Connector;
0 ignored issues
show
The type HT2\Integrations\LearningLocker\Connector 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
use HT2\Integrations\LearningLocker\Connection;
0 ignored issues
show
The type HT2\Integrations\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...
8
use HT2\Integrations\LearningLocker\Organisation;
0 ignored issues
show
The type HT2\Integrations\LearningLocker\Organisation 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...
9
use HT2\Integrations\LearningLocker\StatementForward;
10
use HT2\Integrations\LearningLocker\Query;
0 ignored issues
show
The type HT2\Integrations\LearningLocker\Query 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...
11
use Exception;
12
13
class API extends Connection {
14
  protected $org;
15
  protected $organisationApi;
16
  protected $clientApi;
17
  protected $statementForwardApi;
18
  protected $queryApi;
19
20
21
  /**
22
   * Organisations Facade
23
   *
24
   * @param null
25
   * @return Organisation
26
   */
27
  public function organisation() {
28
    if ($this->organisationApi) {
29
      return $this->organisationApi;
30
    }
31
    $this->organisationApi = new Organisation($this->org, $this->settings);
32
    return $this->organisation();
33
  }
34
35
  public function client()
36
  {
37
    if ($this->clientApi) {
38
      return $this->clientApi;
39
    }
40
    $this->clientApi = new Client($this->org, $this->settings);
41
    return $this->client();
42
  }
43
44
  public function statementForward()
45
  {
46
    if ($this->statementForwardApi) {
47
      return $this->statementForwardApi;
48
    }
49
    $this->statementForwardApi = new StatementForward($this->org, $this->settings);
50
    return $this->statementForward();
51
  }
52
53
  public function query()
54
  {
55
    if ($this->queryApi) {
56
      return $this->queryApi;
57
    }
58
    $this->queryApi = new Query($this->org, $this->settings);
59
    return $this->query();
60
  }
61
62
  public function isDomainAvailable($domain) {
63
    try {
64
      $url = trim($domain, '/') . '/api';
65
      $request = $this->getClient()->get($url, ['timeout' => 1]);
66
      if(!$request) {
67
        return false;
68
      }
69
      if($request->getStatusCode() === 200) {
70
        return true;
71
      }
72
    } catch (Exception $e) {
73
      return false;
74
    }
75
    return false;
76
  }
77
78
}
79