26 $tcContexts = array();
27 foreach ($toolProvider->consumer->profile->{
'@context'} as $context) {
28 if (is_object($context)) {
29 $tcContexts = array_merge(get_object_vars($context), $tcContexts);
33 $this->shared_secret = $secret;
34 $toolServices = array();
35 foreach ($toolProvider->requiredServices as $requiredService) {
36 foreach ($requiredService->formats as $format) {
37 $service = $toolProvider->findService($format, $requiredService->actions);
38 if (($service !==
false) && !array_key_exists($service->{
'@id'}, $toolServices)) {
39 $id = $service->{
'@id'};
40 $parts = explode(
':', $id, 2);
41 if (count($parts) > 1) {
42 if (array_key_exists($parts[0], $tcContexts)) {
43 $id =
"{$tcContexts[$parts[0]]}{$parts[1]}";
46 $toolService = new \stdClass;
47 $toolService->{
'@type'} =
'RestServiceProfile';
48 $toolService->service = $id;
49 $toolService->action = $requiredService->actions;
50 $toolServices[$service->{
'@id'}] = $toolService;
54 foreach ($toolProvider->optionalServices as $optionalService) {
55 foreach ($optionalService->formats as $format) {
56 $service = $toolProvider->findService($format, $optionalService->actions);
57 if (($service !==
false) && !array_key_exists($service->{
'@id'}, $toolServices)) {
58 $id = $service->{
'@id'};
59 $parts = explode(
':', $id, 2);
60 if (count($parts) > 1) {
61 if (array_key_exists($parts[0], $tcContexts)) {
62 $id =
"{$tcContexts[$parts[0]]}{$parts[1]}";
65 $toolService = new \stdClass;
66 $toolService->{
'@type'} =
'RestServiceProfile';
67 $toolService->service = $id;
68 $toolService->action = $optionalService->actions;
69 $toolServices[$service->{
'@id'}] = $toolService;
73 $this->tool_service = array_values($toolServices);