info.class.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /*
  3. * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License").
  6. * You may not use this file except in compliance with the License.
  7. * A copy of the License is located at
  8. *
  9. * http://aws.amazon.com/apache2.0
  10. *
  11. * or in the "license" file accompanying this file. This file is distributed
  12. * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  13. * express or implied. See the License for the specific language governing
  14. * permissions and limitations under the License.
  15. */
  16. /*%******************************************************************************************%*/
  17. // CLASS
  18. /**
  19. * Contains a series of methods that provide information about the SDK.
  20. *
  21. * @version 2010.10.01
  22. * @license See the included NOTICE.md file for more information.
  23. * @copyright See the included NOTICE.md file for more information.
  24. * @link http://aws.amazon.com/php/ PHP Developer Center
  25. */
  26. class CFInfo
  27. {
  28. /**
  29. * Gets information about the web service APIs that the SDK supports.
  30. *
  31. * @return array An associative array containing service classes and API versions.
  32. */
  33. public static function api_support()
  34. {
  35. $existing_classes = get_declared_classes();
  36. foreach (glob(dirname(dirname(__FILE__)) . '/services/*.class.php') as $file)
  37. {
  38. include $file;
  39. }
  40. $with_sdk_classes = get_declared_classes();
  41. $new_classes = array_diff($with_sdk_classes, $existing_classes);
  42. $filtered_classes = array();
  43. $collect = array();
  44. foreach ($new_classes as $class)
  45. {
  46. if (strpos($class, 'Amazon') !== false)
  47. {
  48. $filtered_classes[] = $class;
  49. }
  50. }
  51. $filtered_classes = array_values($filtered_classes);
  52. foreach ($filtered_classes as $class)
  53. {
  54. $obj = new $class();
  55. $collect[get_class($obj)] = $obj->api_version;
  56. unset($obj);
  57. }
  58. return $collect;
  59. }
  60. }