AutoloaderInterface.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Autoload;
  7. /**
  8. * Interface for an autoloader class that allows the dynamic modification of PSR-0 and PSR-4 mappings
  9. */
  10. interface AutoloaderInterface
  11. {
  12. /**
  13. * Adds a PSR-4 mapping from a namespace prefix to directories to search in for the corresponding class
  14. *
  15. * @param string $nsPrefix The namespace prefix of the PSR-4 mapping
  16. * @param string|array $paths The path or paths to look in for the given prefix
  17. * @param bool $prepend Whether to append the given path or paths to the paths already associated with the prefix
  18. * @return void
  19. */
  20. public function addPsr4($nsPrefix, $paths, $prepend = false);
  21. /**
  22. * Adds a PSR-0 mapping from a namespace prefix to directories to search in for the corresponding class
  23. *
  24. * @param string $nsPrefix The namespace prefix of the PSR-0 mapping
  25. * @param string|array $paths The path or paths to look in for the given prefix
  26. * @param bool $prepend Whether to append the given path or paths to the paths already associated with the prefix
  27. * @return void
  28. */
  29. public function addPsr0($nsPrefix, $paths, $prepend = false);
  30. /**
  31. * Creates new PSR-0 mappings from the given prefix to the given set of paths, eliminating previous mappings
  32. *
  33. * @param string $nsPrefix The namespace prefix of the PSR-0 mapping
  34. * @param string|array $paths The path or paths to look in for the given prefix
  35. * @return void
  36. */
  37. public function setPsr0($nsPrefix, $paths);
  38. /**
  39. * Creates new PSR-4 mappings from the given prefix to the given set of paths, eliminating previous mappings
  40. *
  41. * @param string $nsPrefix The namespace prefix of the PSR-0 mapping
  42. * @param string|array $paths The path or paths to look in for the given prefix
  43. * @return void
  44. */
  45. public function setPsr4($nsPrefix, $paths);
  46. /**
  47. * Attempts to load a class and returns true if successful.
  48. *
  49. * @param string $className
  50. * @return bool
  51. */
  52. public function loadClass($className);
  53. /**
  54. * Get filepath of class on system or false if it does not exist
  55. *
  56. * @param string $className
  57. * @return string|bool
  58. */
  59. public function findFile($className);
  60. }