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