1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- --TEST--
- Symfony test.
- --CONFIG--
- level=symfony
- --EXPECT--
- <?php
- /*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Acme;
- /**
- * Coding standards demonstration.
- */
- class FooBar
- {
- const SOME_CONST = 42;
- private $fooBar;
- /**
- * @param string $dummy Some argument description
- */
- public function __construct($dummy)
- {
- $this->fooBar = $this->transformText($dummy);
- }
- /**
- * @param string $dummy Some argument description
- * @param array $options
- *
- * @return string|null Transformed input
- *
- * @throws \RuntimeException
- */
- private function transformText($dummy, array $options = array())
- {
- $mergedOptions = array_merge(
- array(
- 'some_default' => 'values',
- 'another_default' => 'more values',
- ),
- $options
- );
- if (true === $dummy) {
- return;
- }
- if ('string' === $dummy) {
- if ('values' === $mergedOptions['some_default']) {
- return substr($dummy, 0, 5);
- }
- return ucwords($dummy);
- }
- throw new \RuntimeException(sprintf('Unrecognized dummy option "%s"', $dummy));
- }
- private function reverseBoolean($value = null, $theSwitch = false)
- {
- if (!$theSwitch) {
- return;
- }
- return !$value;
- }
- }
|