| 1 | <?php |
| 2 | /** |
| 3 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 4 | * SPDX-License-Identifier: Apache-2.0. |
| 5 | */ |
| 6 | namespace AWS\CRT\Internal; |
| 7 | |
| 8 | use \RuntimeException; |
| 9 | |
| 10 | /** |
| 11 | * @internal |
| 12 | * Forwards calls on to awscrt PHP extension functions |
| 13 | */ |
| 14 | final class Extension { |
| 15 | function __construct() { |
| 16 | if (!extension_loaded('awscrt')) { |
| 17 | throw new RuntimeException('awscrt extension is not loaded'); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * Forwards any call made on this object to the extension function of the |
| 23 | * same name with the supplied arguments. Argument type hinting and checking |
| 24 | * occurs at the CRT wrapper. |
| 25 | */ |
| 26 | function __call($name, $args) { |
| 27 | return call_user_func_array($name, $args); |
| 28 | } |
| 29 | } |