Orders
1 week ago
Products
1 week ago
Reports
1 week ago
Composite.php
1 week ago
Factory.php
1 week ago
Handler.php
1 week ago
ProductAttributes.php
1 week ago
ProductTerms.php
1 week ago
Composite.php
35 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WCML\Rest\Wrapper; |
| 4 | |
| 5 | class Composite extends Handler { |
| 6 | |
| 7 | private $restHandlers; |
| 8 | |
| 9 | public function __construct( array $restHandlers ) { |
| 10 | $this->restHandlers = $restHandlers; |
| 11 | } |
| 12 | |
| 13 | public function query( $args, $request ) { |
| 14 | foreach ( $this->restHandlers as $restHandler ) { |
| 15 | $args = $restHandler->query( $args, $request ); |
| 16 | } |
| 17 | |
| 18 | return $args; |
| 19 | } |
| 20 | |
| 21 | public function prepare( $response, $object, $request ) { |
| 22 | foreach ( $this->restHandlers as $restHandler ) { |
| 23 | $response = $restHandler->prepare( $response, $object, $request ); |
| 24 | } |
| 25 | |
| 26 | return $response; |
| 27 | } |
| 28 | |
| 29 | public function insert( $object, $request, $creating ) { |
| 30 | foreach ( $this->restHandlers as $restHandler ) { |
| 31 | $restHandler->insert( $object, $request, $creating ); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | } |