Skip to content

Commit

Permalink
upgrade oc-php-lib to v1.5.0: php8.2 compat.
Browse files Browse the repository at this point in the history
  • Loading branch information
ferishili committed Nov 16, 2023
1 parent 20b22ab commit b6f58fa
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 28 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"prefer-stable": true,
"require": {
"php": ">=7.3",
"elan-ev/opencast-api": "1.4",
"elan-ev/opencast-api": "1.5",
"srag/custominputguis": ">=0.1.0",
"srag/datatable": ">=0.1.0",
"srag/dic": ">=0.1.0",
Expand Down
18 changes: 9 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"packages": [
{
"name": "elan-ev/opencast-api",
"version": "1.4.0",
"version_normalized": "1.4.0.0",
"version": "1.5.0",
"version_normalized": "1.5.0.0",
"source": {
"type": "git",
"url": "https://github.com/elan-ev/opencast-php-library.git",
"reference": "34b46fb9c0986fc7e4ecd05a45038612da7409c9"
"reference": "dfcfa0789c8a670623ed27434ced88f595941b73"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/elan-ev/opencast-php-library/zipball/34b46fb9c0986fc7e4ecd05a45038612da7409c9",
"reference": "34b46fb9c0986fc7e4ecd05a45038612da7409c9",
"url": "https://api.github.com/repos/elan-ev/opencast-php-library/zipball/dfcfa0789c8a670623ed27434ced88f595941b73",
"reference": "dfcfa0789c8a670623ed27434ced88f595941b73",
"shasum": ""
},
"require": {
Expand All @@ -24,7 +24,7 @@
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.7"
},
"time": "2023-07-21T11:58:16+00:00",
"time": "2023-11-13T16:47:55+00:00",
"type": "library",
"extra": {
"branch-alias": {
Expand Down Expand Up @@ -58,7 +58,7 @@
],
"support": {
"issues": "https://github.com/elan-ev/opencast-php-library/issues",
"source": "https://github.com/elan-ev/opencast-php-library/tree/1.4.0"
"source": "https://github.com/elan-ev/opencast-php-library/tree/1.5.0"
},
"install-path": "../elan-ev/opencast-api"
},
Expand Down
10 changes: 5 additions & 5 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
'name' => 'opencast-ilias/opencast',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '2fd8635d1cc1c538e133ee460ec8f324d4bc702f',
'reference' => '20b22ab52142ad56559561c1fc34248c73a6fda8',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => false,
),
'versions' => array(
'elan-ev/opencast-api' => array(
'pretty_version' => '1.4.0',
'version' => '1.4.0.0',
'reference' => '34b46fb9c0986fc7e4ecd05a45038612da7409c9',
'pretty_version' => '1.5.0',
'version' => '1.5.0.0',
'reference' => 'dfcfa0789c8a670623ed27434ced88f595941b73',
'type' => 'library',
'install_path' => __DIR__ . '/../elan-ev/opencast-api',
'aliases' => array(),
Expand Down Expand Up @@ -49,7 +49,7 @@
'opencast-ilias/opencast' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '2fd8635d1cc1c538e133ee460ec8f324d4bc702f',
'reference' => '20b22ab52142ad56559561c1fc34248c73a6fda8',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down
3 changes: 3 additions & 0 deletions vendor/elan-ev/opencast-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@
- Introducing runAsUser method to add X-RUN-AS-USER into the request headers.
- Introducing OcListProvidersApi REST API service endpoint.
- Add another array param into response result of the library called 'origin', which contains the information about oriniated request like its path, base url, params and method.

# 1.5.0
- PHP 8.2 compatibility: prevent dynamic property declarations
73 changes: 68 additions & 5 deletions vendor/elan-ev/opencast-api/src/OpencastApi/Opencast.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,69 @@

class Opencast
{
/** @var OpencastApi\Rest\OcRestClient the rest client */
/** @var OcRestClient the rest client */
private $restClient;

/** @var OpencastApi\Rest\OcRestClient the engage node rest client */
/** @var OcRestClient the engage node rest client */
private $engageRestClient;

// PHP 8.2 deprecates the creation of dynamic class properties.
// We also need to avoid the type declaration to provide the possibility of using Decorate proxy.

/** @var \OpencastApi\Rest\OcAgentsApi $agentsApi */
public $agentsApi;

/** @var \OpencastApi\Rest\OcBaseApi $baseApi */
public $baseApi;

/** @var \OpencastApi\Rest\OcCaptureAdmin $captureAdmin */
public $captureAdmin;

/** @var \OpencastApi\Rest\OcEventAdminNg $eventAdminNg */
public $eventAdminNg;

/** @var \OpencastApi\Rest\OcEventsApi $eventsApi */
public $eventsApi;

/** @var \OpencastApi\Rest\OcGroupsApi $groupsApi */
public $groupsApi;

/** @var \OpencastApi\Rest\OcRecordings $recordings */
public $recordings;

/** @var \OpencastApi\Rest\OcSearch $search */
public $search;

/** @var \OpencastApi\Rest\OcSecurityApi $securityApi */
public $securityApi;

/** @var \OpencastApi\Rest\OcSeriesApi $seriesApi */
public $seriesApi;

/** @var \OpencastApi\Rest\OcSeries $series */
public $series;

/** @var \OpencastApi\Rest\OcServices $services */
public $services;

/** @var \OpencastApi\Rest\OcStatisticsApi $statisticsApi */
public $statisticsApi;

/** @var \OpencastApi\Rest\OcSysinfo $sysinfo */
public $sysinfo;

/** @var \OpencastApi\Rest\OcWorkflow $agentsApi */
public $workflow;

/** @var \OpencastApi\Rest\OcWorkflowsApi $workflowsApi */
public $workflowsApi;

/** @var \OpencastApi\Rest\OcIngest $ingest */
public $ingest;

/** @var \OpencastApi\Rest\OcListProvidersApi $listProvidersApi */
public $listProvidersApi;

/*
$config = [
'url' => 'https://develop.opencast.org/', // The API url of the opencast instance (required)
Expand Down Expand Up @@ -55,15 +112,18 @@ private function setEndpointProperties($config, $enableingest)
$propertyName = lcfirst(str_replace('Oc', '', $className));
$client = $this->restClient;

if (in_array($className, $this->excludeFilters()) || property_exists($this, $propertyName)) {
if (in_array($className, $this->excludeFilters())) {
continue;
}

if (in_array($className, $this->engageFilters())) {
$client = $this->engageRestClient;
}

$this->{$propertyName} = new $fullClassName($client);
// Make sure the property is declared properly!
if (property_exists($this, $propertyName)) {
$this->{$propertyName} = new $fullClassName($client);
}
}

if ($enableingest) {
Expand Down Expand Up @@ -133,7 +193,10 @@ private function setIngestProperty($config)
$ingestClient = new OcRestClient($config);
}

$this->ingest = new OcIngest($ingestClient);
// Make sure ingest property exists!
if (property_exists($this, 'ingest')) {
$this->ingest = new OcIngest($ingestClient);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ public function get_providers_and_provider_list(): void
$this->assertSame(200, $response['code'], 'failure to get providers list');
$providers = $response['body'];
if (!empty($providers) && is_array($providers)) {
$providers = count($providers) == 1 ? reset($providers) : $providers;
$provider = $providers[array_rand($providers)];
$responseList = $this->ocListProvidersApi->get($provider);
$responseList = $this->ocListProvidersApi->getList($provider);
$this->assertSame(200, $responseList['code'], 'failure to get provider list');
} else {
$this->markTestIncomplete('No provider to complete the test!');
Expand Down

0 comments on commit b6f58fa

Please sign in to comment.