Config.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /**
  3. * This file is part of amfPHP
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the license that is bundled
  8. * with this package in the file license.txt.
  9. */
  10. /**
  11. * responsable for loading and maintaining Amfphp configuration
  12. *
  13. * @package Amfphp_Core
  14. * @author Ariel Sommeria-klein
  15. */
  16. class Amfphp_Core_Config {
  17. /**
  18. * paths to folders containing services(relative or absolute)
  19. * @var <array> of paths
  20. */
  21. public $serviceFolders;
  22. /**
  23. * a dictionary of service classes represented in a ClassFindInfo.
  24. * The key is the name of the service, the value is the class find info.
  25. * for example: $serviceNames2ClassFindInfo["AmfphpDiscoveryService"] = new Amfphp_Core_Common_ClassFindInfo( dirname(__FILE__) . '/AmfphpDiscoveryService.php', 'AmfphpDiscoveryService');
  26. * The forward slash is important, don't use "\'!
  27. * @var <array> of ClassFindInfo
  28. */
  29. public $serviceNames2ClassFindInfo;
  30. /**
  31. * set to true if you want the service router to check if the number of arguments received by amfPHP matches with the method being called.
  32. * This should be set to false in production for performance reasons
  33. * default is true
  34. * @var Boolean
  35. */
  36. public $checkArgumentCount = true;
  37. /**
  38. * paths to the folder containing the plugins. defaults to AMFPHP_ROOTPATH . '/Plugins/'
  39. * @var array
  40. */
  41. public $pluginsFolders;
  42. /**
  43. * array containing untyped plugin configuration data. Add as needed. The advised format is the name of the plugin as key, and then
  44. * paramName/paramValue pairs as an array.
  45. * example: array('plugin' => array( 'paramName' =>'paramValue'))
  46. * The array( 'paramName' =>'paramValue') will be passed as is to the plugin at construction time.
  47. *
  48. * @var array
  49. */
  50. public $pluginsConfig;
  51. /**
  52. * array containing configuration data that is shared between the plugins. The format is paramName/paramValue pairs as an array.
  53. *
  54. * @var array
  55. */
  56. public $sharedConfig;
  57. /**
  58. * if true, there will be detailed information in the error messages, including confidential information like paths.
  59. * So it is advised to set to true for development purposes and to false in production.
  60. * default is true.
  61. * Set in the shared config.
  62. * for example
  63. * $this->sharedConfig[self::CONFIG_RETURN_ERROR_DETAILS] = true;
  64. * @var Boolean
  65. */
  66. const CONFIG_RETURN_ERROR_DETAILS = 'returnErrorDetails';
  67. /**
  68. * array of plugins that are available but should be disabled
  69. * @var array
  70. */
  71. public $disabledPlugins;
  72. /**
  73. * constructor
  74. */
  75. public function __construct() {
  76. $this->serviceFolders = array();
  77. $this->serviceFolders [] = dirname(__FILE__) . '/../Services/';
  78. $this->serviceNames2ClassFindInfo = array();
  79. $this->pluginsFolders = array(AMFPHP_ROOTPATH . 'Plugins/');
  80. $this->pluginsConfig = array();
  81. $this->sharedConfig = array();
  82. $this->disabledPlugins = array();
  83. //disable logging by default
  84. $this->disabledPlugins[] = 'AmfphpLogger';
  85. //uncomment to disable monitor
  86. //$this->disabledPlugins[] = 'AmfphpMonitor';
  87. //some useful examples of setting a config value in a plugin:
  88. //$this->pluginsConfig['AmfphpDiscovery']['restrictAccess'] = false;
  89. //$this->pluginsConfig['AmfphpVoConverter']['enforceConversion'] = true;
  90. }
  91. }
  92. ?>