Skip to content

Commit c2e53d2

Browse files
author
Jamie Hannaford
committed
allow resources to retrieve services
1 parent 7f47ba7 commit c2e53d2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Common/Api/Operator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
abstract class Operator implements OperatorInterface
1616
{
1717
/** @var ClientInterface */
18-
private $client;
18+
protected $client;
1919

2020
/** @var ApiInterface */
2121
protected $api;

src/Common/Resource/AbstractResource.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,12 @@ public function extractMultipleInstances(ResponseInterface $response, $key = nul
231231

232232
return $resources;
233233
}
234+
235+
protected function getService()
236+
{
237+
$class = static::class;
238+
$service = substr($class, 0, strpos($class, 'Models') - 1) . '\\Service';
239+
240+
return new $service($this->client, $this->api);
241+
}
234242
}

0 commit comments

Comments
 (0)