@Symfony.test 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. --TEST--
  2. Symfony test.
  3. --CONFIG--
  4. level=symfony
  5. --EXPECT--
  6. <?php
  7. /*
  8. * This file is part of the Symfony package.
  9. *
  10. * (c) Fabien Potencier <fabien@symfony.com>
  11. *
  12. * For the full copyright and license information, please view the LICENSE
  13. * file that was distributed with this source code.
  14. */
  15. namespace Acme;
  16. /**
  17. * Coding standards demonstration.
  18. */
  19. class FooBar
  20. {
  21. const SOME_CONST = 42;
  22. private $fooBar;
  23. /**
  24. * @param string $dummy Some argument description
  25. */
  26. public function __construct($dummy)
  27. {
  28. $this->fooBar = $this->transformText($dummy);
  29. }
  30. /**
  31. * @param string $dummy Some argument description
  32. * @param array $options
  33. *
  34. * @return string|null Transformed input
  35. *
  36. * @throws \RuntimeException
  37. */
  38. private function transformText($dummy, array $options = array())
  39. {
  40. $mergedOptions = array_merge(
  41. array(
  42. 'some_default' => 'values',
  43. 'another_default' => 'more values',
  44. ),
  45. $options
  46. );
  47. if (true === $dummy) {
  48. return;
  49. }
  50. if ('string' === $dummy) {
  51. if ('values' === $mergedOptions['some_default']) {
  52. return substr($dummy, 0, 5);
  53. }
  54. return ucwords($dummy);
  55. }
  56. throw new \RuntimeException(sprintf('Unrecognized dummy option "%s"', $dummy));
  57. }
  58. private function reverseBoolean($value = null, $theSwitch = false)
  59. {
  60. if (!$theSwitch) {
  61. return;
  62. }
  63. return !$value;
  64. }
  65. }