classes.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. use Symfony\Component\DependencyInjection\Definition;
  3. use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface as ProxyDumper;
  4. function sc_configure($instance)
  5. {
  6. $instance->configure();
  7. }
  8. class BarClass extends BazClass
  9. {
  10. protected $baz;
  11. public $foo = 'foo';
  12. public function setBaz(BazClass $baz)
  13. {
  14. $this->baz = $baz;
  15. }
  16. public function getBaz()
  17. {
  18. return $this->baz;
  19. }
  20. }
  21. class BazClass
  22. {
  23. protected $foo;
  24. public function setFoo(Foo $foo)
  25. {
  26. $this->foo = $foo;
  27. }
  28. public function configure($instance)
  29. {
  30. $instance->configure();
  31. }
  32. public static function getInstance()
  33. {
  34. return new self();
  35. }
  36. public static function configureStatic($instance)
  37. {
  38. $instance->configure();
  39. }
  40. public static function configureStatic1()
  41. {
  42. }
  43. }
  44. class BarUserClass
  45. {
  46. public $bar;
  47. public function __construct(BarClass $bar)
  48. {
  49. $this->bar = $bar;
  50. }
  51. }
  52. class MethodCallClass
  53. {
  54. public $simple;
  55. public $complex;
  56. private $callPassed = false;
  57. public function callMe()
  58. {
  59. $this->callPassed = is_scalar($this->simple) && is_object($this->complex);
  60. }
  61. public function callPassed()
  62. {
  63. return $this->callPassed;
  64. }
  65. }
  66. class DummyProxyDumper implements ProxyDumper
  67. {
  68. public function isProxyCandidate(Definition $definition)
  69. {
  70. return $definition->isLazy();
  71. }
  72. public function getProxyFactoryCode(Definition $definition, $id)
  73. {
  74. return " // lazy factory\n\n";
  75. }
  76. public function getProxyCode(Definition $definition)
  77. {
  78. return "// proxy code\n";
  79. }
  80. }