Changeset 31539
- Timestamp:
- 11/26/10 19:30:55 (2 years ago)
- Files:
-
- branches/2.0/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php (modified) (1 diff)
- branches/2.0/src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php (modified) (1 diff)
- branches/2.0/src/Symfony/Bundle/FrameworkBundle/Controller/InternalController.php (modified) (1 diff)
- branches/2.0/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php (modified) (6 diffs)
- branches/2.0/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php (modified) (2 diffs)
- branches/2.0/src/Symfony/Bundle/FrameworkBundle/RequestListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml (modified) (1 diff)
- branches/2.0/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/errors.php (modified) (1 diff)
- branches/2.0/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php (modified) (1 diff)
- branches/2.0/src/Symfony/Bundle/FrameworkBundle/Routing/LazyLoader.php (added)
- branches/2.0/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/SecurityHelper.php (modified) (1 diff)
- branches/2.0/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php (modified) (1 diff)
- branches/2.0/src/Symfony/Bundle/TwigBundle/Extension/SecurityExtension.php (modified) (1 diff)
- branches/2.0/src/Symfony/Bundle/TwigBundle/Node/IfRoleNode.php (modified) (1 diff)
- branches/2.0/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.twig (modified) (1 diff)
- branches/2.0/src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php (modified) (2 diffs)
- branches/2.0/src/Symfony/Component/Console/Application.php (modified) (16 diffs)
- branches/2.0/src/Symfony/Component/Console/Command/HelpCommand.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/Console/Shell.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php (modified) (2 diffs)
- branches/2.0/src/Symfony/Component/DomCrawler/Form.php (modified) (8 diffs)
- branches/2.0/src/Symfony/Component/EventDispatcher/Event.php (modified) (4 diffs)
- branches/2.0/src/Symfony/Component/Form/Form.php (modified) (5 diffs)
- branches/2.0/src/Symfony/Component/Form/FormConfiguration.php (added)
- branches/2.0/src/Symfony/Component/HttpFoundation/HeaderBag.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpFoundation/ParameterBag.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpFoundation/Response.php (modified) (6 diffs)
- branches/2.0/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpFoundation/Session.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Cache/Cache.php (modified) (4 diffs)
- branches/2.0/src/Symfony/Component/HttpKernel/Cache/Esi.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Cache/EsiListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Debug/ExceptionListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Kernel.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Profiler/ProfilerListener.php (modified) (3 diffs)
- branches/2.0/src/Symfony/Component/HttpKernel/Resources/bin/packager.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/ResponseListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/AccessListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/AnonymousAuthenticationListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/BasicAuthenticationListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/ChannelListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/ContextListener.php (modified) (3 diffs)
- branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/DigestAuthenticationListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/ExceptionListener.php (modified) (4 diffs)
- branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/FormAuthenticationListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/LogoutListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/PreAuthenticatedListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/SwitchUserListener.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/HttpKernel/bootstrap.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/Routing/Generator/UrlGenerator.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/Routing/Loader/XmlFileLoader.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/Routing/Loader/YamlFileLoader.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/Routing/Matcher/UrlMatcher.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/Routing/RouteCollection.php (modified) (5 diffs)
- branches/2.0/src/Symfony/Component/Security/Authentication/AuthenticationProviderManager.php (modified) (3 diffs)
- branches/2.0/src/Symfony/Component/Translation/Loader/ArrayLoader.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/Translation/Loader/XliffFileLoader.php (modified) (1 diff)
- branches/2.0/src/Symfony/Component/Translation/MessageCatalogue.php (modified) (8 diffs)
- branches/2.0/src/Symfony/Component/Translation/MessageCatalogueInterface.php (modified) (6 diffs)
- branches/2.0/src/Symfony/Component/Translation/Translator.php (modified) (2 diffs)
- branches/2.0/tests/Symfony/Tests/Component/Console/ApplicationTest.php (modified) (10 diffs)
- branches/2.0/tests/Symfony/Tests/Component/Console/Command/HelpCommandTest.php (modified) (1 diff)
- branches/2.0/tests/Symfony/Tests/Component/Console/Command/ListCommandTest.php (modified) (1 diff)
- branches/2.0/tests/Symfony/Tests/Component/DependencyInjection/Fixtures/php/services9.php (modified) (2 diffs)
- branches/2.0/tests/Symfony/Tests/Component/DomCrawler/FormTest.php (modified) (2 diffs)
- branches/2.0/tests/Symfony/Tests/Component/EventDispatcher/EventTest.php (modified) (1 diff)
- branches/2.0/tests/Symfony/Tests/Component/Form/FormTest.php (modified) (6 diffs)
- branches/2.0/tests/Symfony/Tests/Component/HttpKernel/BaseHttpKernelTest.php (modified) (1 diff)
- branches/2.0/tests/Symfony/Tests/Component/HttpKernel/Cache/CacheTest.php (modified) (1 diff)
- branches/2.0/tests/Symfony/Tests/Component/Routing/Loader/ClosureLoaderTest.php (modified) (1 diff)
- branches/2.0/tests/Symfony/Tests/Component/Routing/Loader/DelegatingLoaderTest.php (modified) (1 diff)
- branches/2.0/tests/Symfony/Tests/Component/Routing/Matcher/UrlMatcherTest.php (modified) (1 diff)
- branches/2.0/tests/Symfony/Tests/Component/Routing/RouteCollectionTest.php (modified) (4 diffs)
- branches/2.0/tests/Symfony/Tests/Component/Security/Authentication/AuthenticationProviderManagerTest.php (modified) (1 diff)
- branches/2.0/tests/Symfony/Tests/Component/Translation/Loader/PhpFileLoaderTest.php (modified) (1 diff)
- branches/2.0/tests/Symfony/Tests/Component/Translation/Loader/XliffFileLoaderTest.php (modified) (1 diff)
- branches/2.0/tests/Symfony/Tests/Component/Translation/Loader/YamlFileLoaderTest.php (modified) (1 diff)
- branches/2.0/tests/Symfony/Tests/Component/Translation/MessageCatalogTest.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/2.0/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
r31229 r31539 54 54 55 55 $routes = array(); 56 foreach ($router->getRouteCollection()-> getRoutes() as $name => $route) {56 foreach ($router->getRouteCollection()->all() as $name => $route) { 57 57 $routes[$name] = $route->compile(); 58 58 } branches/2.0/src/Symfony/Bundle/FrameworkBundle/Controller/ExceptionController.php
r31463 r31539 37 37 38 38 $currentContent = ''; 39 while ( false !== $content = @ob_get_clean()) {40 $currentContent .= $content;39 while (ob_get_level()) { 40 $currentContent .= ob_get_clean(); 41 41 } 42 42 branches/2.0/src/Symfony/Bundle/FrameworkBundle/Controller/InternalController.php
r31229 r31539 35 35 $attributes = $request->attributes; 36 36 37 $attributes-> delete('path');38 $attributes-> delete('controller');37 $attributes->remove('path'); 38 $attributes->remove('controller'); 39 39 if ('none' !== $path) 40 40 { branches/2.0/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
r31486 r31539 123 123 'Symfony\\Component\\HttpFoundation\\Response', 124 124 125 'Symfony\\Component\\HttpKernel\\BaseHttpKernel', 125 126 'Symfony\\Component\\HttpKernel\\HttpKernel', 126 127 'Symfony\\Component\\HttpKernel\\ResponseListener', 127 128 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver', 129 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface', 128 130 129 131 'Symfony\\Bundle\\FrameworkBundle\\RequestListener', … … 132 134 133 135 'Symfony\\Component\\EventDispatcher\\Event', 134 135 'Symfony\\Bundle\\FrameworkBundle\\ Controller\\ControllerInterface',136 'Symfony\\Bundle\\FrameworkBundle\\Controller\\BaseController', 136 'Symfony\\Component\\EventDispatcher\\EventDispatcher', 137 'Symfony\\Bundle\\FrameworkBundle\\EventDispatcher', 138 137 139 'Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller', 138 140 )); … … 147 149 protected function registerTemplatingConfiguration($config, ContainerBuilder $container) 148 150 { 149 $config = $config['templating'];151 $config = isset($config['templating']) ? $config['templating'] : array(); 150 152 151 153 if (!$container->hasDefinition('templating')) { … … 331 333 } 332 334 $container->setParameter('session.storage.'.strtolower($config['storage_id']).'.options', $options); 335 336 $this->addCompiledClasses($container, array( 337 'Symfony\\Component\\HttpFoundation\\Session', 338 'Symfony\\Component\\HttpFoundation\\SessionStorage\\SessionStorageInterface', 339 )); 333 340 } 334 341 … … 349 356 'Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface', 350 357 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', 351 'Symfony\\Component\\Routing\\Loader\\Loader', 352 'Symfony\\Component\\Routing\\Loader\\DelegatingLoader', 353 'Symfony\\Component\\Routing\\Loader\\LoaderResolver', 354 'Symfony\\Bundle\\FrameworkBundle\\Routing\\LoaderResolver', 355 'Symfony\\Bundle\\FrameworkBundle\\Routing\\DelegatingLoader', 358 'Symfony\\Component\\Routing\\Loader\\LoaderInterface', 359 'Symfony\\Bundle\\FrameworkBundle\\Routing\\LazyLoader', 356 360 )); 357 361 } … … 480 484 protected function addCompiledClasses($container, array $classes) 481 485 { 482 $container->setParameter('kernel.compiled_classes', array_merge($container->getParameter('kernel.compiled_classes'), $classes)); 486 $current = $container->hasParameter('kernel.compiled_classes') ? $container->getParameter('kernel.compiled_classes') : array(); 487 $container->setParameter('kernel.compiled_classes', array_merge($current, $classes)); 483 488 } 484 489 branches/2.0/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php
r31403 r31539 4 4 5 5 use Symfony\Component\HttpKernel\Bundle\Bundle; 6 use Symfony\Component\Form\Form ;6 use Symfony\Component\Form\FormConfiguration; 7 7 8 8 /* … … 30 30 $this->container->get('error_handler'); 31 31 } 32 33 32 if ($this->container->hasParameter('csrf_secret')) { 34 Form ::setDefaultCsrfSecret($this->container->getParameter('csrf_secret'));35 Form ::enableDefaultCsrfProtection();33 FormConfiguration::setDefaultCsrfSecret($this->container->getParameter('csrf_secret')); 34 FormConfiguration::enableDefaultCsrfProtection(); 36 35 } 37 36 } branches/2.0/src/Symfony/Bundle/FrameworkBundle/RequestListener.php
r31403 r31539 50 50 public function handle(Event $event) 51 51 { 52 $request = $event->get Parameter('request');53 $master = HttpKernelInterface::MASTER_REQUEST === $event->get Parameter('request_type');52 $request = $event->get('request'); 53 $master = HttpKernelInterface::MASTER_REQUEST === $event->get('request_type'); 54 54 55 55 $this->initializeSession($request, $master); branches/2.0/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml
r31030 r31539 40 40 </service> 41 41 42 <service id="routing.loader " class="%routing.loader.class%">42 <service id="routing.loader.real" class="%routing.loader.class%"> 43 43 <argument type="service" id="controller_name_converter" /> 44 44 <argument type="service" id="logger" on-invalid="null" /> 45 45 <argument type="service" id="routing.resolver" /> 46 </service> 47 48 <service id="routing.loader" class="Symfony\Bundle\FrameworkBundle\Routing\LazyLoader"> 49 <argument type="service" id="service_container" /> 50 <argument>routing.loader.real</argument> 46 51 </service> 47 52 branches/2.0/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/errors.php
r31463 r31539 4 4 <li><?php echo $view['translator']->trans( 5 5 $error->getMessageTemplate(), 6 $error->getMessageParameters() ->getRawValue(),6 $error->getMessageParameters(), 7 7 'validators' 8 8 ) ?></li> branches/2.0/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php
r31229 r31539 56 56 $collection = parent::load($resource); 57 57 58 foreach ($collection-> getRoutes() as $name => $route) {58 foreach ($collection->all() as $name => $route) { 59 59 if ($controller = $route->getDefault('_controller')) { 60 60 try { branches/2.0/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/SecurityHelper.php
r31403 r31539 36 36 public function vote($role, $object = null) 37 37 { 38 if (null === $this->context) { 39 return false; 40 } 41 38 42 return $this->context->vote($role, $object); 39 43 } branches/2.0/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php
r31147 r31539 118 118 "<?php use Symfony\Component\Translation\MessageCatalogue; return new MessageCatalogue('%s', %s);", 119 119 $locale, 120 var_export($this->catalogues[$locale]-> getMessages(), true)120 var_export($this->catalogues[$locale]->all(), true) 121 121 )); 122 122 branches/2.0/src/Symfony/Bundle/TwigBundle/Extension/SecurityExtension.php
r31229 r31539 28 28 } 29 29 30 public function getContext()30 public function vote($role, $object = null) 31 31 { 32 return $this->context; 32 if (null === $this->context) { 33 return false; 34 } 35 36 return $this->context->vote($role, $object); 33 37 } 34 38 branches/2.0/src/Symfony/Bundle/TwigBundle/Node/IfRoleNode.php
r31229 r31539 31 31 $compiler 32 32 ->addDebugInfo($this) 33 ->write('if ($this->env->getExtension(\'security\')-> getContext()->vote(')33 ->write('if ($this->env->getExtension(\'security\')->vote(') 34 34 ->subcompile($this->getNode('role')) 35 35 ; branches/2.0/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.twig
r31482 r31539 3 3 {% block toolbar %} 4 4 <img style="margin: 0 5px 0 10px; vertical-align: middle; height: 24px" width="24" height="24" alt="Request" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABJ5JREFUeNrEV1tIo0cUTuJqFH9iTBSjyUq8BVtLV2tLdV/6IiIFwe1LxQuu4mVBiwYfrCiI4KUv4oNdVKS64KX0qQUfKoKwT7WlTatS2sVdbXBXjVhtDPEetd9JZ2TWXExsiwOH/8y5zZmZM+ecX35xcSG7zSEXHZDL5dfJ9wMyGb4AMN9k0dfW9OOARDA1NWXjhI2NjZcJCQkGhr8CfpfzSkpKdPg4Ie8UjYDu1wGFDycltVr92GAwTMJAKinQ9/T0NIxwAsJFHsmSDnCJywRyvXd8Ld7W1vYRvuF9fX1flJaWLptMpkxJklTn5+f/CAEH7UvwFtLT003Nzc337Xb7UXd3twy0+vHxceeNYiAvL8+Un5//Y1xcnIpoR0dHLjKs0+kkbwZsNpuTHMVwb2Zra8sxOzv7Xnl5+TLNKyoqgouBsbExI2iLwFU3DDAHdO8BtdK8srIyuBiAghXH/MHh4eHJ2dmZzAssMPDgkQ7pArdy2nXDaxBWV1c7d3Z2yJhMgG8ASYAsBkmMdilDOqQr0oINQnrnMgTVGzExMRLfwfHx8YxSqXxwRZaO+AF434JXQATSge7ntbW1v9N8cHDQHFQQtrS0/EXfqKiocAJBLonfqZdhBPzBJ3t7e0cEhCcmJkY3NDT4jYHXTkCv16s5zne/u7u7o9ForH42YWUyWvY8wwlEGwHHgLfAOjk5UTY2Nup8BKSMeCTjix9UDLhcrqfMkbSQkBA94dHR0RKOsg28T7wZIB7JgM83sQ7d5/+qGPX29lLB+YXTV1dX/xwZGRkC+hg8d21obW2l3F9fU1PzKDk5OUawmcUKlYzJ3agYpZrNZotWq1WJTkxPT7/Y3t7+leaxsbFvFRYWpoqL4xk6+vv7s7u6ul5wWnt7e9AO6IxG41fI5/fDwsI8agUWced4OOeRmhELrsnJye+sVuvHnZ2d7pPq6OgI/BWw3K2Jj4/PUSgUd/i9igPPU2Lx4hnR0CkuLs7Z3NzUgG8LJAY8HMBT3ICHzxBMbwu5fVVoRK6OBcgk89qB7zOyQS+gp6dHbF4CS8VQslM+xw6WAA6W27MInE6ngz8vhrvpTN5BOhaL5UPYcJFMWlraGIHY4ATckqG+q1mWu/QeCeclEo6B4a+A3xVsZS4uLm7Pz8/30GR/f/832PiMcPQUn0ZGRr7J6PVY0xlwT9jU1HSJowv6PjQ09H2G/wA8R5RdWlrSI4AXsXslHHSmpKTQU5WtrKzY4KyE/HCMAL03Nze37q8jkl3NjkKQPcJczXD71UyXkZGxf3BwcKxSqbSAy2IGp9yOgOcgmWvLsZ/0TH3AUwYePcHAwMDXaFYVAu0JA/eceCQTVFteV1cXVEPEEbRmFrR17w4PD8uKiop+Ap7NeUNDQ/KAryCQpsLbwHHrsXgLx33ZufYEqqqqAl50dHRUKigosOB/wUTztbU1GytYOvYvsTwzM5MtvoL/9ARyc3Oj0AtouQ7+FXSiDeKRDP3A/C8OIOnsY3frVJJxmj+D9JCxnoD+TkREhFsmqCsoKysL9vp5V2XnQTkxMSGHHTXD7T6r4a3/Hd/G+FuAAQDV6k9Ni4q8owAAAABJRU5ErkJggg==" /> 5 {% if collector.route %}{{ collector.route }}{% else %}<span style="color: #a33">NONE</span>{% endif %}<span style="margin: 0; padding: 0; color: #aaa">|</span>{{ collector.format }}<span style="margin: 0; padding: 0; color: #aaa">|</span><span style="color: {{ 200 == datastatuscode ? '#3a3' : '#a33' }}">{{ collector.statuscode }}</span><span style="margin: 0; padding: 0; color: #aaa">|</span>{{ collector.contenttype }}5 {% if collector.route %}{{ collector.route }}{% else %}<span style="color: #a33">NONE</span>{% endif %}<span style="margin: 0; padding: 0; color: #aaa">|</span>{{ collector.format }}<span style="margin: 0; padding: 0; color: #aaa">|</span><span style="color: {{ 200 == collector.statuscode ? '#3a3' : '#a33' }}">{{ collector.statuscode }}</span><span style="margin: 0; padding: 0; color: #aaa">|</span>{{ collector.contenttype }} 6 6 {% endblock %} 7 7 branches/2.0/src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php
r31371 r31539 48 48 public function handle(Event $event, Response $response) 49 49 { 50 if (HttpKernelInterface::MASTER_REQUEST !== $event->get Parameter('request_type')) {50 if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { 51 51 return $response; 52 52 } … … 58 58 ); 59 59 $response->setStatusCode(200); 60 $response->headers-> delete('Location');60 $response->headers->remove('Location'); 61 61 } 62 62 63 $request = $event->get Parameter('request');63 $request = $event->get('request'); 64 64 if (!$response->headers->has('X-Debug-Token') 65 65 || '3' === substr($response->getStatusCode(), 0, 1) branches/2.0/src/Symfony/Component/Console/Application.php
r31229 r31539 38 38 * 39 39 * $app = new Application('myapp', '1.0 (stable)'); 40 * $app->add Command(new SimpleCommand());40 * $app->add(new SimpleCommand()); 41 41 * $app->run(); 42 42 * … … 75 75 )); 76 76 77 $this->add Command(new HelpCommand());78 $this->add Command(new ListCommand());77 $this->add(new HelpCommand()); 78 $this->add(new ListCommand()); 79 79 80 80 $this->definition = new InputDefinition(array( … … 182 182 183 183 // the command name MUST be the first element of the input 184 $command = $this->find Command($name);184 $command = $this->find($name); 185 185 186 186 $this->runningCommand = $command; … … 330 330 public function register($name) 331 331 { 332 return $this->add Command(new Command($name));332 return $this->add(new Command($name)); 333 333 } 334 334 … … 341 341 { 342 342 foreach ($commands as $command) { 343 $this->add Command($command);343 $this->add($command); 344 344 } 345 345 } … … 354 354 * @return Command The registered command 355 355 */ 356 public function add Command(Command $command)356 public function add(Command $command) 357 357 { 358 358 $command->setApplication($this); … … 376 376 * @throws \InvalidArgumentException When command name given does not exist 377 377 */ 378 public function get Command($name)378 public function get($name) 379 379 { 380 380 if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) { … … 387 387 $this->wantHelps = false; 388 388 389 $helpCommand = $this->get Command('help');389 $helpCommand = $this->get('help'); 390 390 $helpCommand->setCommand($command); 391 391 … … 403 403 * @return Boolean true if the command exists, false otherwise 404 404 */ 405 public function has Command($name)405 public function has($name) 406 406 { 407 407 return isset($this->commands[$name]) || isset($this->aliases[$name]); … … 452 452 * Finds a command by name or alias. 453 453 * 454 * Contrary to get Command, this command tries to find the best454 * Contrary to get, this command tries to find the best 455 455 * match if you give it an abbreviation of a name or alias. 456 456 * … … 461 461 * @throws \InvalidArgumentException When command name is incorrect or ambiguous 462 462 */ 463 public function find Command($name)463 public function find($name) 464 464 { 465 465 // namespace … … 482 482 $abbrevs = static::getAbbreviations($commands); 483 483 if (isset($abbrevs[$name]) && 1 == count($abbrevs[$name])) { 484 return $this->get Command($namespace ? $namespace.':'.$abbrevs[$name][0] : $abbrevs[$name][0]);484 return $this->get($namespace ? $namespace.':'.$abbrevs[$name][0] : $abbrevs[$name][0]); 485 485 } 486 486 … … 501 501 } 502 502 503 return $this->get Command($abbrevs[$fullName][0]);503 return $this->get($abbrevs[$fullName][0]); 504 504 } 505 505 … … 513 513 * @return array An array of Command instances 514 514 */ 515 public function getCommands($namespace = null)515 public function all($namespace = null) 516 516 { 517 517 if (null === $namespace) { … … 567 567 public function asText($namespace = null) 568 568 { 569 $commands = $namespace ? $this-> getCommands($this->findNamespace($namespace)) : $this->commands;569 $commands = $namespace ? $this->all($this->findNamespace($namespace)) : $this->commands; 570 570 571 571 $messages = array($this->getHelp(), ''); … … 608 608 public function asXml($namespace = null, $asDom = false) 609 609 { 610 $commands = $namespace ? $this-> getCommands($this->findNamespace($namespace)) : $this->commands;610 $commands = $namespace ? $this->all($this->findNamespace($namespace)) : $this->commands; 611 611 612 612 $dom = new \DOMDocument('1.0', 'UTF-8'); branches/2.0/src/Symfony/Component/Console/Command/HelpCommand.php
r31229 r31539 66 66 { 67 67 if (null === $this->command) { 68 $this->command = $this->application->get Command($input->getArgument('command_name'));68 $this->command = $this->application->get($input->getArgument('command_name')); 69 69 } 70 70 branches/2.0/src/Symfony/Component/Console/Shell.php
r31229 r31539 98 98 // task name? 99 99 if (false === strpos($text, ' ') || !$text) { 100 return array_keys($this->application-> getCommands());100 return array_keys($this->application->all()); 101 101 } 102 102 branches/2.0/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
r31486 r31539 63 63 protected function addServiceReturn($id, $definition) 64 64 { 65 return <<<EOF 66 67 return \$instance; 68 } 69 70 EOF; 65 if (!$definition->getMethodCalls() && !$definition->getConfigurator()) { 66 return " }\n"; 67 } 68 69 return "\n return \$instance;\n }\n"; 71 70 } 72 71 … … 84 83 } 85 84 85 $simple = !$definition->getMethodCalls() && !$definition->getConfigurator(); 86 87 $instantiation = ''; 86 88 if ($definition->isShared()) { 87 $instantiation = sprintf(" \$this->services['$id'] = \$instance"); 89 $instantiation = "\$this->services['$id'] = ".($simple ? '' : '$instance'); 90 } elseif (!$simple) { 91 $instantiation = '$instance'; 92 } 93 94 $return = ''; 95 if ($simple) { 96 $return = 'return '; 88 97 } else { 89 $instantiation = sprintf(" \$instance");98 $instantiation .= ' = '; 90 99 } 91 100 92 101 if (null !== $definition->getFactoryMethod()) { 93 102 if (null !== $definition->getFactoryService()) { 94 $code = sprintf(" $instantiation =%s->%s(%s);\n", $this->getServiceCall($definition->getFactoryService()), $definition->getFactoryMethod(), implode(', ', $arguments));103 $code = sprintf(" $return{$instantiation}%s->%s(%s);\n", $this->getServiceCall($definition->getFactoryService()), $definition->getFactoryMethod(), implode(', ', $arguments)); 95 104 } else { 96 $code = sprintf(" $instantiation =call_user_func(array(%s, '%s')%s);\n", $class, $definition->getFactoryMethod(), $arguments ? ', '.implode(', ', $arguments) : '');105 $code = sprintf(" $return{$instantiation}call_user_func(array(%s, '%s')%s);\n", $class, $definition->getFactoryMethod(), $arguments ? ', '.implode(', ', $arguments) : ''); 97 106 } 98 107 } elseif (false !== strpos($class, '$')) { 99 $code = sprintf(" \$class = %s;\n $instantiation =new \$class(%s);\n", $class, implode(', ', $arguments));108 $code = sprintf(" \$class = %s;\n $return{$instantiation}new \$class(%s);\n", $class, implode(', ', $arguments)); 100 109 } else { 101 $code = sprintf(" $instantiation =new \\%s(%s);\n", substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments));110 $code = sprintf(" $return{$instantiation}new \\%s(%s);\n", substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments)); 102 111 } 103 112 branches/2.0/src/Symfony/Component/DomCrawler/Form.php
r31229 r31539 216 216 * @return Boolean true if the field exists, false otherwise 217 217 */ 218 public function has Field($name)218 public function has($name) 219 219 { 220 220 return isset($this->fields[$name]); … … 230 230 * @throws \InvalidArgumentException When field is not present in this form 231 231 */ 232 public function get Field($name)233 { 234 if (!$this->has Field($name)) {232 public function get($name) 233 { 234 if (!$this->has($name)) { 235 235 throw new \InvalidArgumentException(sprintf('The form has no "%s" field', $name)); 236 236 } … … 246 246 * @return FormField The field instance 247 247 */ 248 public function set Field(Field\FormField $field)248 public function set(Field\FormField $field) 249 249 { 250 250 $this->fields[$field->getName()] = $field; … … 256 256 * @return array An array of fields 257 257 */ 258 public function getFields()258 public function all() 259 259 { 260 260 return $this->fields; … … 281 281 282 282 if ($node === $button) { 283 $this->set Field(new Field\InputFormField($node));283 $this->set(new Field\InputFormField($node)); 284 284 } elseif ('select' == $nodeName || 'input' == $nodeName && 'checkbox' == $node->getAttribute('type')) { 285 $this->set Field(new Field\ChoiceFormField($node));285 $this->set(new Field\ChoiceFormField($node)); 286 286 } elseif ('input' == $nodeName && 'radio' == $node->getAttribute('type')) { 287 if ($this->has Field($node->getAttribute('name'))) {288 $this->get Field($node->getAttribute('name'))->addChoice($node);287 if ($this->has($node->getAttribute('name'))) { 288 $this->get($node->getAttribute('name'))->addChoice($node); 289 289 } else { 290 $this->set Field(new Field\ChoiceFormField($node));290 $this->set(new Field\ChoiceFormField($node)); 291 291 } 292 292 } elseif ('input' == $nodeName && 'file' == $node->getAttribute('type')) { 293 $this->set Field(new Field\FileFormField($node));293 $this->set(new Field\FileFormField($node)); 294 294 } elseif ('input' == $nodeName && !in_array($node->getAttribute('type'), array('submit', 'button', 'image'))) { 295 $this->set Field(new Field\InputFormField($node));295 $this->set(new Field\InputFormField($node)); 296 296 } elseif ('textarea' == $nodeName) { 297 $this->set Field(new Field\TextareaFormField($node));297 $this->set(new Field\TextareaFormField($node)); 298 298 } 299 299 } … … 309 309 public function offsetExists($name) 310 310 { 311 return $this->has Field($name);311 return $this->has($name); 312 312 } 313 313 … … 323 323 public function offsetGet($name) 324 324 { 325 if (!$this->has Field($name)) {325 if (!$this->has($name)) { 326 326 throw new \InvalidArgumentException(sprintf('The form field "%s" does not exist', $name)); 327 327 } … … 340 340 public function offsetSet($name, $value) 341 341 { 342 if (!$this->has Field($name)) {342 if (!$this->has($name)) { 343 343 throw new \InvalidArgumentException(sprintf('The form field "%s" does not exist', $name)); 344 344 } branches/2.0/src/Symfony/Component/EventDispatcher/Event.php
r31229 r31539 103 103 * @return array The event parameters 104 104 */ 105 public function getParameters()105 public function all() 106 106 { 107 107 return $this->parameters; … … 115 115 * @return Boolean true if the parameter exists, false otherwise 116 116 */ 117 public function has Parameter($name)117 public function has($name) 118 118 { 119 119 return array_key_exists($name, $this->parameters); … … 129 129 * @throws \InvalidArgumentException When parameter doesn't exists for this event 130 130 */ 131 public function get Parameter($name)131 public function get($name) 132 132 { 133 133 if (!array_key_exists($name, $this->parameters)) { … … 144 144 * @param mixed $value The parameter value 145 145 */ 146 public function set Parameter($name, $value)146 public function set($name, $value) 147 147 { 148 148 $this->parameters[$name] = $value; branches/2.0/src/Symfony/Component/Form/Form.php
r31463 r31539 30 30 class Form extends FieldGroup 31 31 { 32 protected static $defaultCsrfSecret = null;33 protected static $defaultCsrfProtection = false;34 protected static $defaultCsrfFieldName = '_token';35 protected static $defaultLocale = null;36 37 32 protected $validator = null; 38 33 protected $validationGroups = null; … … 55 50 $this->setData($data); 56 51 57 if ( self::$defaultCsrfProtection !== false) {52 if (FormConfiguration::isDefaultCsrfProtectionEnabled()) { 58 53 $this->enableCsrfProtection(); 59 54 } 60 55 61 if ( self::$defaultLocale!== null) {62 $this->setLocale( self::$defaultLocale);56 if (FormConfiguration::getDefaultLocale() !== null) { 57 $this->setLocale(FormConfiguration::getDefaultLocale()); 63 58 } 64 59 … … 84 79 { 85 80 return $this->validationGroups; 86 }87 88 /**89 * Sets the default locale for newly created forms.90 *91 * @param string $defaultLocale92 */93 static public function setDefaultLocale($defaultLocale)94 {95 self::$defaultLocale = $defaultLocale;96 }97 98 /**99 * Returns the default locale for newly created forms.100 *101 * @return string102 */103 static public function getDefaultLocale()104 {105 return self::$defaultLocale;106 81 } 107 82 … … 199 174 if (!$this->isCsrfProtected()) { 200 175 if ($csrfFieldName === null) { 201 $csrfFieldName = self::$defaultCsrfFieldName;176 $csrfFieldName = FormConfiguration::getDefaultCsrfFieldName(); 202 177 } 203 178 204 179 if ($csrfSecret === null) { 205 if ( self::$defaultCsrfSecret!== null) {206 $csrfSecret = self::$defaultCsrfSecret;180 if (FormConfiguration::getDefaultCsrfSecret() !== null) { 181 $csrfSecret = FormConfiguration::getDefaultCsrfSecret(); 207 182 } else { 208 183 $csrfSecret = md5(__FILE__.php_uname()); … … 266 241 return $this->get($this->getCsrfFieldName())->getDisplayedData() === $this->generateCsrfToken($this->getCsrfSecret()); 267 242 } 268 }269 270 /**271 * Enables CSRF protection for all new forms272 */273 static public function enableDefaultCsrfProtection()274 {275 self::$defaultCsrfProtection = true;276 }277 278 /**279 * Disables Csrf protection for all forms.280 */281 static public function disableDefaultCsrfProtection()282 {283 self::$defaultCsrfProtection = false;284 }285 286 /**287 * Sets the CSRF field name used in all new CSRF protected forms288 *289 * @param string $name The CSRF field name290 */291 static public function setDefaultCsrfFieldName($name)292 {293 self::$defaultCsrfFieldName = $name;294 }295 296 /**297 * Returns the default CSRF field name298 *299 * @return string The CSRF field name300 */301 static public function getDefaultCsrfFieldName()302 {303 return self::$defaultCsrfFieldName;304 }305 306 /**307 * Sets the CSRF secret used in all new CSRF protected forms308 *309 * @param string $secret310 */311 static public function setDefaultCsrfSecret($secret)312 {313 self::$defaultCsrfSecret = $secret;314 }315 316 /**317 * Returns the default CSRF secret318 *319 * @return string320 */321 static public function getDefaultCsrfSecret()322 {323 return self::$defaultCsrfSecret;324 243 } 325 244 branches/2.0/src/Symfony/Component/HttpFoundation/HeaderBag.php
r31463 r31539 146 146 147 147 /** 148 * Deletes a header.148 * Removes a header. 149 149 * 150 150 * @param string $key The HTTP header name 151 151 */ 152 public function delete($key)152 public function remove($key) 153 153 { 154 154 $key = strtr(strtolower($key), '_', '-'); branches/2.0/src/Symfony/Component/HttpFoundation/ParameterBag.php
r31229 r31539 106 106 107 107 /** 108 * Deletes a parameter.108 * Removes a parameter. 109 109 * 110 110 * @param string $key The key 111 111 */ 112 public function delete($key)112 public function remove($key) 113 113 { 114 114 unset($this->parameters[$key]); branches/2.0/src/Symfony/Component/HttpFoundation/Response.php
r31463 r31539 370 370 * Sets the Expires HTTP header with a \DateTime instance. 371 371 * 372 * If passed a null value, it deletes the header.372 * If passed a null value, it removes the header. 373 373 * 374 374 * @param \DateTime $date A \DateTime instance … … 377 377 { 378 378 if (null === $date) { 379 $this->headers-> delete('Expires');379 $this->headers->remove('Expires'); 380 380 } else { 381 381 $date = clone $date; … … 491 491 * Sets the Last-Modified HTTP header with a \DateTime instance. 492 492 * 493 * If passed a null value, it deletes the header.493 * If passed a null value, it removes the header. 494 494 * 495 495 * @param \DateTime $date A \DateTime instance … … 498 498 { 499 499 if (null === $date) { 500 $this->headers-> delete('Last-Modified');500 $this->headers->remove('Last-Modified'); 501 501 } else { 502 502 $date = clone $date; … … 525 525 { 526 526 if (null === $etag) { 527 $this->headers-> delete('Etag');527 $this->headers->remove('Etag'); 528 528 } else { 529 529 if (0 !== strpos($etag, '"')) { … … 596 596 // remove headers that MUST NOT be included with 304 Not Modified responses 597 597 foreach (array('Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified') as $header) { 598 $this->headers-> delete($header);598 $this->headers->remove($header); 599 599 } 600 600 } branches/2.0/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php
r31463 r31539 50 50 * {@inheritdoc} 51 51 */ 52 public function delete($key)52 public function remove($key) 53 53 { 54 parent:: delete($key);54 parent::remove($key); 55 55 56 56 if ('cache-control' === strtr(strtolower($key), '_', '-')) { branches/2.0/src/Symfony/Component/HttpFoundation/Session.php
r31403 r31539 193 193 } 194 194 195 public function getFlash Messages()195 public function getFlashes() 196 196 { 197 197 return $this->attributes['_flash']; 198 198 } 199 199 200 public function setFlash Messages($values)200 public function setFlashes($values) 201 201 { 202 202 if (false === $this->started) { branches/2.0/src/Symfony/Component/HttpKernel/Cache/Cache.php
r31463 r31539 302 302 303 303 $entry = clone $entry; 304 $entry->headers-> delete('Date');304 $entry->headers->remove('Date'); 305 305 306 306 foreach (array('Date', 'Expires', 'Cache-Control', 'ETag', 'Last-Modified') as $name) { … … 339 339 340 340 // avoid that the backend sends no content 341 $subRequest->headers-> delete('if_modified_since');342 $subRequest->headers-> delete('if_none_match');341 $subRequest->headers->remove('if_modified_since'); 342 $subRequest->headers->remove('if_none_match'); 343 343 344 344 $response = $this->forward($subRequest); … … 517 517 518 518 $response->setContent(ob_get_clean()); 519 $response->headers-> delete('X-Body-Eval');519 $response->headers->remove('X-Body-Eval'); 520 520 } elseif ($response->headers->has('X-Body-File')) { 521 521 $response->setContent(file_get_contents($response->headers->get('X-Body-File'))); … … 524 524 } 525 525 526 $response->headers-> delete('X-Body-File');526 $response->headers->remove('X-Body-File'); 527 527 528 528 if (!$response->headers->has('Transfer-Encoding')) { branches/2.0/src/Symfony/Component/HttpKernel/Cache/Esi.php
r31317 r31539 156 156 $value = $response->headers->get('Surrogate-Control'); 157 157 if ('content="ESI/1.0"' == $value) { 158 $response->headers-> delete('Surrogate-Control');158 $response->headers->remove('Surrogate-Control'); 159 159 } elseif (preg_match('#,\s*content="ESI/1.0"#', $value)) { 160 160 $response->headers->set('Surrogate-Control', preg_replace('#,\s*content="ESI/1.0"#', '', $value)); branches/2.0/src/Symfony/Component/HttpKernel/Cache/EsiListener.php
r31229 r31539 58 58 public function filter($event, Response $response) 59 59 { 60 if (HttpKernelInterface::MASTER_REQUEST !== $event->get Parameter('request_type')) {60 if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { 61 61 return $response; 62 62 } branches/2.0/src/Symfony/Component/HttpKernel/Debug/ExceptionListener.php
r31229 r31539 49 49 public function handle(Event $event) 50 50 { 51 if (HttpKernelInterface::MASTER_REQUEST !== $event->get Parameter('request_type')) {51 if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { 52 52 return false; 53 53 } 54 54 55 $exception = $event->get Parameter('exception');56 $request = $event->get Parameter('request');55 $exception = $event->get('exception'); 56 $request = $event->get('request'); 57 57 58 58 if (null !== $this->logger) { branches/2.0/src/Symfony/Component/HttpKernel/Kernel.php
r31486 r31539 319 319 'kernel.bundles' => $bundles, 320 320 'kernel.charset' => 'UTF-8', 321 'kernel.compiled_classes' => array(),322 321 ), 323 322 $this->getEnvParameters() branches/2.0/src/Symfony/Component/HttpKernel/Profiler/ProfilerListener.php
r31229 r31539 63 63 public function handleException(Event $event) 64 64 { 65 if (HttpKernelInterface::MASTER_REQUEST !== $event->get Parameter('request_type')) {65 if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { 66 66 return false; 67 67 } 68 68 69 $this->exception = $event->get Parameter('exception');69 $this->exception = $event->get('exception'); 70 70 71 71 return false; … … 81 81 public function handleResponse(Event $event, Response $response) 82 82 { 83 if (HttpKernelInterface::MASTER_REQUEST !== $event->get Parameter('request_type')) {83 if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { 84 84 return $response; 85 85 } 86 86 87 if (null !== $this->matcher && !$this->matcher->matches($event->get Parameter('request'))) {87 if (null !== $this->matcher && !$this->matcher->matches($event->get('request'))) { 88 88 return $response; 89 89 } … … 93 93 } 94 94 95 $this->profiler->collect($event->get Parameter('request'), $response, $this->exception);95 $this->profiler->collect($event->get('request'), $response, $this->exception); 96 96 $this->exception = null; 97 97 branches/2.0/src/Symfony/Component/HttpKernel/Resources/bin/packager.php
r30923 r31539 28 28 'Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler', 29 29 'Symfony\\Component\\HttpKernel\\ClassCollectionLoader', 30 31 'Symfony\\Component\\DependencyInjection\\Container', 32 'Symfony\\Component\\DependencyInjection\\ContainerAwareInterface', 33 'Symfony\\Component\\DependencyInjection\\ContainerInterface', 34 'Symfony\\Component\\DependencyInjection\\ParameterBag\\FrozenParameterBag', 35 'Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBagInterface', 36 'Symfony\\Component\\DependencyInjection\\TaggedContainerInterface', 37 30 38 ), __DIR__.'/../..', 'bootstrap', false); branches/2.0/src/Symfony/Component/HttpKernel/ResponseListener.php
r31229 r31539 42 42 public function filter(Event $event, Response $response) 43 43 { 44 if (HttpKernelInterface::MASTER_REQUEST !== $event->get Parameter('request_type') || $response->headers->has('Content-Type')) {44 if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type') || $response->headers->has('Content-Type')) { 45 45 return $response; 46 46 } 47 47 48 $request = $event->get Parameter('request');48 $request = $event->get('request'); 49 49 $format = $request->getRequestFormat(); 50 50 if ((null !== $format) && $mimeType = $request->getMimeType($format)) { branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall.php
r31266 r31539 61 61 public function handle(Event $event) 62 62 { 63 if (HttpKernelInterface::MASTER_REQUEST !== $event->get Parameter('request_type')) {63 if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { 64 64 return; 65 65 } 66 66 67 $request = $event->get Parameter('request');67 $request = $event->get('request'); 68 68 69 69 $this->dispatcher->disconnect('core.security'); branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/AccessListener.php
r31266 r31539 66 66 } 67 67 68 $request = $event->get Parameter('request');68 $request = $event->get('request'); 69 69 70 70 list($attributes, $channel) = $this->map->getPatterns($request); branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/AnonymousAuthenticationListener.php
r31266 r31539 56 56 public function handle(Event $event) 57 57 { 58 $request = $event->get Parameter('request');58 $request = $event->get('request'); 59 59 60 60 if (null !== $this->context->getToken()) { branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/BasicAuthenticationListener.php
r31266 r31539 61 61 public function handle(Event $event) 62 62 { 63 $request = $event->get Parameter('request');63 $request = $event->get('request'); 64 64 65 65 if (false === $username = $request->server->get('PHP_AUTH_USER', false)) { branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/ChannelListener.php
r31266 r31539 55 55 public function handle(Event $event) 56 56 { 57 $request = $event->get Parameter('request');57 $request = $event->get('request'); 58 58 59 59 list($attributes, $channel) = $this->map->getPatterns($request); branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/ContextListener.php
r31266 r31539 56 56 public function read(Event $event) 57 57 { 58 $request = $event->get Parameter('request');58 $request = $event->get('request'); 59 59 60 60 $session = $request->hasSession() ? $request->getSession() : null; … … 84 84 public function write(Event $event, Response $response) 85 85 { 86 if (HttpKernelInterface::MASTER_REQUEST !== $event->get Parameter('request_type')) {86 if (HttpKernelInterface::MASTER_REQUEST !== $event->get('request_type')) { 87 87 return $response; 88 88 } … … 100 100 } 101 101 102 $event->get Parameter('request')->getSession()->set('_security', serialize($token));102 $event->get('request')->getSession()->set('_security', serialize($token)); 103 103 104 104 return $response; branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/DigestAuthenticationListener.php
r31266 r31539 64 64 public function handle(Event $event) 65 65 { 66 $request = $event->get Parameter('request');66 $request = $event->get('request'); 67 67 68 68 if (!$header = $request->server->get('PHP_AUTH_DIGEST')) { branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/ExceptionListener.php
r31266 r31539 63 63 public function handleException(Event $event) 64 64 { 65 $exception = $event->get Parameter('exception');66 $request = $event->get Parameter('request');65 $exception = $event->get('exception'); 66 $request = $event->get('request'); 67 67 68 68 if ($exception instanceof AuthenticationException) { … … 74 74 $response = $this->startAuthentication($request, $exception); 75 75 } catch (\Exception $e) { 76 $event->set Parameter('exception', $e);76 $event->set('exception', $e); 77 77 78 78 return; … … 88 88 $response = $this->startAuthentication($request, new InsufficientAuthenticationException('Full authentication is required to access this resource.', $token, 0, $exception)); 89 89 } catch (\Exception $e) { 90 $event->set Parameter('exception', $e);90 $event->set('exception', $e); 91 91 92 92 return; … … 111 111 } 112 112 113 $event->set Parameter('exception', new \RuntimeException('Exception thrown when handling an exception.', 0, $e));113 $event->set('exception', new \RuntimeException('Exception thrown when handling an exception.', 0, $e)); 114 114 115 115 return; branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/FormAuthenticationListener.php
r31266 r31539 78 78 public function handle(Event $event) 79 79 { 80 $request = $event->get Parameter('request');80 $request = $event->get('request'); 81 81 82 82 if ($this->options['check_path'] !== $request->getPathInfo()) { branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/LogoutListener.php
r31266 r31539 59 59 public function handle(Event $event) 60 60 { 61 $request = $event->get Parameter('request');61 $request = $event->get('request'); 62 62 63 63 if ($this->logoutPath !== $request->getPathInfo()) { branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/PreAuthenticatedListener.php
r31266 r31539 59 59 public function handle(Event $event) 60 60 { 61 $request = $event->get Parameter('request');61 $request = $event->get('request'); 62 62 63 63 if (null !== $this->logger) { branches/2.0/src/Symfony/Component/HttpKernel/Security/Firewall/SwitchUserListener.php
r31266 r31539 75 75 public function handle(Event $event) 76 76 { 77 $request = $event->get Parameter('request');77 $request = $event->get('request'); 78 78 79 79 if (!$request->get($this->usernameParameter)) { branches/2.0/src/Symfony/Component/HttpKernel/bootstrap.php
r31371 r31539 128 128 return; } 129 129 throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $file)); } } 130 namespace Symfony\Component\DependencyInjection; 131 use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; 132 use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; 133 use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; 134 class Container implements ContainerInterface { 135 protected $parameterBag; 136 protected $services; 137 public function __construct(ParameterBagInterface $parameterBag = null) { 138 $this->parameterBag = null === $parameterBag ? new ParameterBag() : $parameterBag; 139 $this->services = array(); 140 $this->set('service_container', $this); } 141 public function freeze() { 142 $this->parameterBag->resolve(); 143 $this->parameterBag = new FrozenParameterBag($this->parameterBag->all()); } 144 public function isFrozen() { 145 return $this->parameterBag instanceof FrozenParameterBag; } 146 public function getParameterBag() { 147 return $this->parameterBag; } 148 public function getParameter($name) { 149 return $this->parameterBag->get($name); } 150 public function hasParameter($name) { 151 return $this->parameterBag->has($name); } 152 public function setParameter($name, $value) { 153 $this->parameterBag->set($name, $value); } 154 public function set($id, $service) { 155 $this->services[$id] = $service; } 156 public function has($id) { 157 return isset($this->services[$id]) || method_exists($this, 'get'.strtr($id, array('_' => '', '.' => '_')).'Service'); } 158 public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) { 159 $id = (string) $id; 160 if (isset($this->services[$id])) { 161 return $this->services[$id]; } 162 if (method_exists($this, $method = 'get'.strtr($id, array('_' => '', '.' => '_')).'Service')) { 163 return $this->$method(); } 164 if (self::EXCEPTION_ON_INVALID_REFERENCE === $invalidBehavior) { 165 throw new \InvalidArgumentException(sprintf('The service "%s" does not exist.', $id)); } } 166 public function getServiceIds() { 167 $ids = array(); 168 $r = new \ReflectionClass($this); 169 foreach ($r->getMethods() as $method) { 170 if (preg_match('/^get(.+)Service$/', $name = $method->getName(), $match)) { 171 $ids[] = self::underscore($match[1]); } } 172 return array_merge($ids, array_keys($this->services)); } 173 static public function camelize($id) { 174 return preg_replace(array('/(?:^|_)+(.)/e', '/\.(.)/e'), array("strtoupper('\\1')", "'_'.strtoupper('\\1')"), $id); } 175 static public function underscore($id) { 176 return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), strtr($id, '_', '.'))); } } 177 namespace Symfony\Component\DependencyInjection; 178 interface ContainerAwareInterface { 179 function setContainer(ContainerInterface $container = null); } 180 namespace Symfony\Component\DependencyInjection; 181 interface ContainerInterface { 182 const EXCEPTION_ON_INVALID_REFERENCE = 1; 183 const NULL_ON_INVALID_REFERENCE = 2; 184 const IGNORE_ON_INVALID_REFERENCE = 3; 185 function set($id, $service); 186 function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); 187 function has($id); } 188 namespace Symfony\Component\DependencyInjection\ParameterBag; 189 class FrozenParameterBag extends ParameterBag { 190 public function __construct(array $parameters = array()) { 191 foreach ($parameters as $key => $value) { 192 $this->parameters[strtolower($key)] = $value; } } 193 public function clear() { 194 throw new \LogicException('Impossible to call clear() on a frozen ParameterBag.'); } 195 public function add(array $parameters) { 196 throw new \LogicException('Impossible to call add() on a frozen ParameterBag.'); } 197 public function set($name, $value) { 198 throw new \LogicException('Impossible to call set() on a frozen ParameterBag.'); } } 199 namespace Symfony\Component\DependencyInjection\ParameterBag; 200 interface ParameterBagInterface { 201 function clear(); 202 function add(array $parameters); 203 function all(); 204 function get($name); 205 function set($name, $value); 206 function has($name); } 207 namespace Symfony\Component\DependencyInjection; 208 interface TaggedContainerInterface extends ContainerInterface { 209 function findTaggedServiceIds($name); } branches/2.0/src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php
r31229 r31539 52 52 $methods = array(); 53 53 54 foreach ($this->routes-> getRoutes() as $name => $route) {54 foreach ($this->routes->all() as $name => $route) { 55 55 $compiledRoute = $route->compile(); 56 56 branches/2.0/src/Symfony/Component/Routing/Generator/UrlGenerator.php
r31229 r31539 55 55 public function generate($name, array $parameters, $absolute = false) 56 56 { 57 if (null === $route = $this->routes->get Route($name)) {57 if (null === $route = $this->routes->get($name)) { 58 58 throw new \InvalidArgumentException(sprintf('Route "%s" does not exist.', $name)); 59 59 } branches/2.0/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
r31229 r31539 122 122 123 123 $route = new Route($globals['pattern'].$annot->getPattern(), $defaults, $requirements, $options); 124 $collection->add Route($annot->getName(), $route);124 $collection->add($annot->getName(), $route); 125 125 } 126 126 } branches/2.0/src/Symfony/Component/Routing/Loader/XmlFileLoader.php
r31266 r31539 105 105 $route = new Route((string) $definition->getAttribute('pattern'), $defaults, $requirements, $options); 106 106 107 $collection->add Route((string) $definition->getAttribute('id'), $route);107 $collection->add((string) $definition->getAttribute('id'), $route); 108 108 } 109 109 branches/2.0/src/Symfony/Component/Routing/Loader/YamlFileLoader.php
r31229 r31539 84 84 $route = new Route($config['pattern'], $defaults, $requirements, $options); 85 85 86 $collection->add Route($name, $route);86 $collection->add($name, $route); 87 87 } 88 88 branches/2.0/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php
r31371 r31539 42 42 $regexes = array(); 43 43 44 foreach ($this->routes-> getRoutes() as $name => $route) {44 foreach ($this->routes->all() as $name => $route) { 45 45 $compiledRoute = $route->compile(); 46 46 branches/2.0/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
r31229 r31539 52 52 $code = array(); 53 53 54 foreach ($this->routes-> getRoutes() as $name => $route) {54 foreach ($this->routes->all() as $name => $route) { 55 55 $compiledRoute = $route->compile(); 56 56 branches/2.0/src/Symfony/Component/Routing/Matcher/UrlMatcher.php
r31229 r31539 53 53 $url = $this->normalizeUrl($url); 54 54 55 foreach ($this->routes-> getRoutes() as $name => $route) {55 foreach ($this->routes->all() as $name => $route) { 56 56 $compiledRoute = $route->compile(); 57 57 branches/2.0/src/Symfony/Component/Routing/RouteCollection.php
r31229 r31539 41 41 * @throws \InvalidArgumentException When route name contains non valid characters 42 42 */ 43 public function add Route($name, Route $route)43 public function add($name, Route $route) 44 44 { 45 45 if (!preg_match('/^[a-z0-9A-Z_]+$/', $name)) { … … 55 55 * @return array An array of routes 56 56 */ 57 public function getRoutes()57 public function all() 58 58 { 59 59 return $this->routes; … … 67 67 * @return Route $route A Route instance 68 68 */ 69 public function get Route($name)69 public function get($name) 70 70 { 71 71 return isset($this->routes[$name]) ? $this->routes[$name] : null; … … 86 86 } 87 87 88 $this->routes = array_merge($this->routes, $collection-> getRoutes());88 $this->routes = array_merge($this->routes, $collection->all()); 89 89 } 90 90 … … 100 100 } 101 101 102 foreach ($this-> getRoutes() as $route) {102 foreach ($this->all() as $route) { 103 103 $route->setPattern($prefix.$route->getPattern()); 104 104 } branches/2.0/src/Symfony/Component/Security/Authentication/AuthenticationProviderManager.php
r31317 r31539 91 91 * @return AuthenticationProviderInterface[] An array of AuthenticationProviderInterface instances 92 92 */ 93 public function getProviders()93 public function all() 94 94 { 95 95 return $this->providers; … … 105 105 $this->providers = array(); 106 106 foreach ($providers as $provider) { 107 $this->add Provider($provider);107 $this->add($provider); 108 108 } 109 109 } … … 114 114 * @param AuthenticationProviderInterface $provider A AuthenticationProviderInterface instance 115 115 */ 116 public function add Provider(AuthenticationProviderInterface $provider)116 public function add(AuthenticationProviderInterface $provider) 117 117 { 118 118 $this->providers[] = $provider; branches/2.0/src/Symfony/Component/Translation/Loader/ArrayLoader.php
r31403 r31539 28 28 $this->flatten($resource); 29 29 $catalogue = new MessageCatalogue($locale); 30 $catalogue->add Messages($resource, $domain);30 $catalogue->add($resource, $domain); 31 31 32 32 return $catalogue; branches/2.0/src/Symfony/Component/Translation/Loader/XliffFileLoader.php
r31403 r31539 32 32 $catalogue = new MessageCatalogue($locale); 33 33 foreach ($xml->xpath('//xliff:trans-unit') as $translation) { 34 $catalogue->set Message((string) $translation->source, (string) $translation->target, $domain);34 $catalogue->set((string) $translation->source, (string) $translation->target, $domain); 35 35 } 36 36 $catalogue->addResource(new FileResource($resource)); branches/2.0/src/Symfony/Component/Translation/MessageCatalogue.php
r31317 r31539 57 57 * {@inheritdoc} 58 58 */ 59 public function getMessages($domain = null)59 public function all($domain = null) 60 60 { 61 61 if (null === $domain) { … … 69 69 * {@inheritdoc} 70 70 */ 71 public function set Message($id, $translation, $domain = 'messages')71 public function set($id, $translation, $domain = 'messages') 72 72 { 73 $this->add Messages(array($id => $translation), $domain);73 $this->add(array($id => $translation), $domain); 74 74 } 75 75 … … 77 77 * {@inheritdoc} 78 78 */ 79 public function has Message($id, $domain = 'messages')79 public function has($id, $domain = 'messages') 80 80 { 81 81 return isset($this->messages[$domain][$id]); … … 85 85 * {@inheritdoc} 86 86 */ 87 public function get Message($id, $domain = 'messages')87 public function get($id, $domain = 'messages') 88 88 { 89 89 return isset($this->messages[$domain][$id]) ? $this->messages[$domain][$id] : $id; … … 93 93 * {@inheritdoc} 94 94 */ 95 public function setMessages($messages, $domain = 'messages')95 public function replace($messages, $domain = 'messages') 96 96 { 97 97 $this->messages[$domain] = array(); 98 98 99 $this->add Messages($messages, $domain);99 $this->add($messages, $domain); 100 100 } 101 101 … … 103 103 * {@inheritdoc} 104 104 */ 105 public function add Messages($messages, $domain = 'messages')105 public function add($messages, $domain = 'messages') 106 106 { 107 107 if (!isset($this->messages[$domain])) { … … 121 121 } 122 122 123 foreach ($catalogue-> getMessages() as $domain => $messages) {124 $this->add Messages($messages, $domain);123 foreach ($catalogue->all() as $domain => $messages) { 124 $this->add($messages, $domain); 125 125 } 126 126 … … 136 136 { 137 137 foreach ($catalogue->getDomains() as $domain) { 138 foreach ($catalogue-> getMessages($domain) as $id => $translation) {139 if (false === $this->has Message($id, $domain)) {140 $this->set Message($id, $translation, $domain);138 foreach ($catalogue->all($domain) as $id => $translation) { 139 if (false === $this->has($id, $domain)) { 140 $this->set($id, $translation, $domain); 141 141 } 142 142 } branches/2.0/src/Symfony/Component/Translation/MessageCatalogueInterface.php
r31317 r31539 44 44 * @return array An array of messages 45 45 */ 46 function getMessages($domain = null);46 function all($domain = null); 47 47 48 48 /** … … 53 53 * @param string $domain The domain name 54 54 */ 55 function set Message($id, $translation, $domain = 'messages');55 function set($id, $translation, $domain = 'messages'); 56 56 57 57 /** … … 63 63 * @return Boolean true if the message has a translation, false otherwise 64 64 */ 65 function has Message($id, $domain = 'messages');65 function has($id, $domain = 'messages'); 66 66 67 67 /** … … 73 73 * @return string The message translation 74 74 */ 75 function get Message($id, $domain = 'messages');75 function get($id, $domain = 'messages'); 76 76 77 77 /** … … 81 81 * @param string $domain The domain name 82 82 */ 83 function setMessages($messages, $domain = 'messages');83 function replace($messages, $domain = 'messages'); 84 84 85 85 /** … … 89 89 * @param string $domain The domain name 90 90 */ 91 function add Messages($messages, $domain = 'messages');91 function add($messages, $domain = 'messages'); 92 92 93 93 /** branches/2.0/src/Symfony/Component/Translation/Translator.php
r31317 r31539 113 113 } 114 114 115 return strtr($this->catalogues[$locale]->get Message($id, $domain), $parameters);115 return strtr($this->catalogues[$locale]->get($id, $domain), $parameters); 116 116 } 117 117 … … 129 129 } 130 130 131 return strtr($this->selector->choose($this->catalogues[$locale]->get Message($id, $domain), (int) $number, $locale), $parameters);131 return strtr($this->selector->choose($this->catalogues[$locale]->get($id, $domain), (int) $number, $locale), $parameters); 132 132 } 133 133 branches/2.0/tests/Symfony/Tests/Component/Console/ApplicationTest.php
r31463 r31539 39 39 $this->assertEquals('foo', $application->getName(), '__construct() takes the application name as its first argument'); 40 40 $this->assertEquals('bar', $application->getVersion(), '__construct() takes the application version as its first argument'); 41 $this->assertEquals(array('help', 'list'), array_keys($application-> getCommands()), '__construct() registered the help and list commands by default');41 $this->assertEquals(array('help', 'list'), array_keys($application->all()), '__construct() registered the help and list commands by default'); 42 42 } 43 43 … … 68 68 } 69 69 70 public function test GetCommands()71 { 72 $application = new Application(); 73 $commands = $application-> getCommands();74 $this->assertEquals('Symfony\\Component\\Console\\Command\\HelpCommand', get_class($commands['help']), '-> getCommands() returns the registered commands');75 76 $application->add Command(new \FooCommand());77 $commands = $application-> getCommands('foo');78 $this->assertEquals(1, count($commands), '-> getCommands() takes a namespace as its first argument');70 public function testAll() 71 { 72 $application = new Application(); 73 $commands = $application->all(); 74 $this->assertEquals('Symfony\\Component\\Console\\Command\\HelpCommand', get_class($commands['help']), '->all() returns the registered commands'); 75 76 $application->add(new \FooCommand()); 77 $commands = $application->all('foo'); 78 $this->assertEquals(1, count($commands), '->all() takes a namespace as its first argument'); 79 79 } 80 80 … … 86 86 } 87 87 88 public function testAdd Command()89 { 90 $application = new Application(); 91 $application->add Command($foo = new \FooCommand());92 $commands = $application-> getCommands();93 $this->assertEquals($foo, $commands['foo:bar'], '->add Command() registers a command');88 public function testAdd() 89 { 90 $application = new Application(); 91 $application->add($foo = new \FooCommand()); 92 $commands = $application->all(); 93 $this->assertEquals($foo, $commands['foo:bar'], '->add() registers a command'); 94 94 95 95 $application = new Application(); 96 96 $application->addCommands(array($foo = new \FooCommand(), $foo1 = new \Foo1Command())); 97 $commands = $application-> getCommands();97 $commands = $application->all(); 98 98 $this->assertEquals(array($foo, $foo1), array($commands['foo:bar'], $commands['foo:bar1']), '->addCommands() registers an array of commands'); 99 99 } 100 100 101 public function testHasGet Command()102 { 103 $application = new Application(); 104 $this->assertTrue($application->has Command('list'), '->hasCommand() returns true if a named command is registered');105 $this->assertFalse($application->has Command('afoobar'), '->hasCommand() returns false if a named command is not registered');106 107 $application->add Command($foo = new \FooCommand());108 $this->assertTrue($application->has Command('afoobar'), '->hasCommand() returns true if an alias is registered');109 $this->assertEquals($foo, $application->get Command('foo:bar'), '->getCommand() returns a command by name');110 $this->assertEquals($foo, $application->get Command('afoobar'), '->getCommand() returns a command by alias');111 112 try { 113 $application->get Command('foofoo');114 $this->fail('->get Command() throws an \InvalidArgumentException if the command does not exist');115 } catch (\Exception $e) { 116 $this->assertInstanceOf('\InvalidArgumentException', $e, '->get Command() throws an \InvalidArgumentException if the command does not exist');117 $this->assertEquals('The command "foofoo" does not exist.', $e->getMessage(), '->get Command() throws an \InvalidArgumentException if the command does not exist');101 public function testHasGet() 102 { 103 $application = new Application(); 104 $this->assertTrue($application->has('list'), '->has() returns true if a named command is registered'); 105 $this->assertFalse($application->has('afoobar'), '->has() returns false if a named command is not registered'); 106 107 $application->add($foo = new \FooCommand()); 108 $this->assertTrue($application->has('afoobar'), '->has() returns true if an alias is registered'); 109 $this->assertEquals($foo, $application->get('foo:bar'), '->get() returns a command by name'); 110 $this->assertEquals($foo, $application->get('afoobar'), '->get() returns a command by alias'); 111 112 try { 113 $application->get('foofoo'); 114 $this->fail('->get() throws an \InvalidArgumentException if the command does not exist'); 115 } catch (\Exception $e) { 116 $this->assertInstanceOf('\InvalidArgumentException', $e, '->get() throws an \InvalidArgumentException if the command does not exist'); 117 $this->assertEquals('The command "foofoo" does not exist.', $e->getMessage(), '->get() throws an \InvalidArgumentException if the command does not exist'); 118 118 } 119 119 120 120 $application = new TestApplication(); 121 $application->add Command($foo = new \FooCommand());121 $application->add($foo = new \FooCommand()); 122 122 $application->setWantHelps(); 123 $command = $application->get Command('foo:bar');124 $this->assertEquals('Symfony\Component\Console\Command\HelpCommand', get_class($command), '->get Command() returns the help command if --help is provided as the input');123 $command = $application->get('foo:bar'); 124 $this->assertEquals('Symfony\Component\Console\Command\HelpCommand', get_class($command), '->get() returns the help command if --help is provided as the input'); 125 125 } 126 126 … … 128 128 { 129 129 $application = new TestApplication(); 130 $application->add Command(new \FooCommand());131 $application->add Command(new \Foo1Command());130 $application->add(new \FooCommand()); 131 $application->add(new \Foo1Command()); 132 132 $this->assertEquals(array('foo'), $application->getNamespaces(), '->getNamespaces() returns an array of unique used namespaces'); 133 133 } … … 136 136 { 137 137 $application = new TestApplication(); 138 $application->add Command(new \FooCommand());138 $application->add(new \FooCommand()); 139 139 $this->assertEquals('foo', $application->findNamespace('foo'), '->findNamespace() returns the given namespace if it exists'); 140 140 $this->assertEquals('foo', $application->findNamespace('f'), '->findNamespace() finds a namespace given an abbreviation'); 141 $application->add Command(new \Foo2Command());141 $application->add(new \Foo2Command()); 142 142 $this->assertEquals('foo', $application->findNamespace('foo'), '->findNamespace() returns the given namespace if it exists'); 143 143 try { … … 158 158 } 159 159 160 public function testFind Command()160 public function testFind() 161 161 { 162 162 $application = new TestApplication(); 163 $application->add Command(new \FooCommand());164 $this->assertEquals('FooCommand', get_class($application->find Command('foo:bar')), '->findCommand() returns a command if its name exists');165 $this->assertEquals('Symfony\Component\Console\Command\HelpCommand', get_class($application->find Command('h')), '->findCommand() returns a command if its name exists');166 $this->assertEquals('FooCommand', get_class($application->find Command('f:bar')), '->findCommand() returns a command if the abbreviation for the namespace exists');167 $this->assertEquals('FooCommand', get_class($application->find Command('f:b')), '->findCommand() returns a command if the abbreviation for the namespace and the command name exist');168 $this->assertEquals('FooCommand', get_class($application->find Command('a')), '->findCommand() returns a command if the abbreviation exists for an alias');169 170 $application->add Command(new \Foo1Command());171 $application->add Command(new \Foo2Command());172 173 try { 174 $application->find Command('f');175 $this->fail('->find Command() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace');176 } catch (\Exception $e) { 177 $this->assertInstanceOf('\InvalidArgumentException', $e, '->find Command() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace');178 $this->assertEquals('Command "f" is not defined.', $e->getMessage(), '->find Command() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace');179 } 180 181 try { 182 $application->find Command('a');183 $this->fail('->find Command() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias');184 } catch (\Exception $e) { 185 $this->assertInstanceOf('\InvalidArgumentException', $e, '->find Command() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias');186 $this->assertEquals('Command "a" is ambiguous (afoobar, afoobar1 and 1 more).', $e->getMessage(), '->find Command() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias');187 } 188 189 try { 190 $application->find Command('foo:b');191 $this->fail('->find Command() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command');192 } catch (\Exception $e) { 193 $this->assertInstanceOf('\InvalidArgumentException', $e, '->find Command() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command');194 $this->assertEquals('Command "foo:b" is ambiguous (foo:bar, foo:bar1).', $e->getMessage(), '->find Command() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command');163 $application->add(new \FooCommand()); 164 $this->assertEquals('FooCommand', get_class($application->find('foo:bar')), '->find() returns a command if its name exists'); 165 $this->assertEquals('Symfony\Component\Console\Command\HelpCommand', get_class($application->find('h')), '->find() returns a command if its name exists'); 166 $this->assertEquals('FooCommand', get_class($application->find('f:bar')), '->find() returns a command if the abbreviation for the namespace exists'); 167 $this->assertEquals('FooCommand', get_class($application->find('f:b')), '->find() returns a command if the abbreviation for the namespace and the command name exist'); 168 $this->assertEquals('FooCommand', get_class($application->find('a')), '->find() returns a command if the abbreviation exists for an alias'); 169 170 $application->add(new \Foo1Command()); 171 $application->add(new \Foo2Command()); 172 173 try { 174 $application->find('f'); 175 $this->fail('->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace'); 176 } catch (\Exception $e) { 177 $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace'); 178 $this->assertEquals('Command "f" is not defined.', $e->getMessage(), '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace'); 179 } 180 181 try { 182 $application->find('a'); 183 $this->fail('->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias'); 184 } catch (\Exception $e) { 185 $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias'); 186 $this->assertEquals('Command "a" is ambiguous (afoobar, afoobar1 and 1 more).', $e->getMessage(), '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias'); 187 } 188 189 try { 190 $application->find('foo:b'); 191 $this->fail('->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command'); 192 } catch (\Exception $e) { 193 $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command'); 194 $this->assertEquals('Command "foo:b" is ambiguous (foo:bar, foo:bar1).', $e->getMessage(), '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command'); 195 195 } 196 196 } … … 219 219 { 220 220 $application = new Application(); 221 $application->add Command(new \FooCommand);221 $application->add(new \FooCommand); 222 222 $this->assertStringEqualsFile(self::$fixturesPath.'/application_astext1.txt', $application->asText(), '->asText() returns a text representation of the application'); 223 223 $this->assertStringEqualsFile(self::$fixturesPath.'/application_astext2.txt', $application->asText('foo'), '->asText() returns a text representation of the application'); … … 227 227 { 228 228 $application = new Application(); 229 $application->add Command(new \FooCommand);229 $application->add(new \FooCommand); 230 230 $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application'); 231 231 $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application'); … … 253 253 $application->setAutoExit(false); 254 254 $application->setCatchExceptions(false); 255 $application->add Command($command = new \Foo1Command());255 $application->add($command = new \Foo1Command()); 256 256 $_SERVER['argv'] = array('cli.php', 'foo:bar1'); 257 257 … … 329 329 $application->setAutoExit(false); 330 330 $application->setCatchExceptions(false); 331 $application->add Command(new \FooCommand());331 $application->add(new \FooCommand()); 332 332 $tester = new ApplicationTester($application); 333 333 $tester->run(array('command' => 'foo:bar', '--no-interaction' => true)); branches/2.0/tests/Symfony/Tests/Component/Console/Command/HelpCommandTest.php
r30721 r31539 31 31 32 32 $application = new Application(); 33 $commandTester = new CommandTester($application->get Command('help'));33 $commandTester = new CommandTester($application->get('help')); 34 34 $commandTester->execute(array('command_name' => 'list')); 35 35 $this->assertRegExp('/list \[--xml\] \[namespace\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command'); branches/2.0/tests/Symfony/Tests/Component/Console/Command/ListCommandTest.php
r30721 r31539 20 20 $application = new Application(); 21 21 22 $commandTester = new CommandTester($command = $application->get Command('list'));22 $commandTester = new CommandTester($command = $application->get('list')); 23 23 $commandTester->execute(array('command' => $command->getFullName())); 24 24 $this->assertRegExp('/help Displays help for a command/', $commandTester->getDisplay(), '->execute() returns a list of available commands'); branches/2.0/tests/Symfony/Tests/Component/DependencyInjection/Fixtures/php/services9.php
r31486 r31539 82 82 { 83 83 $class = $this->getParameter('foo_class'); 84 $this->services['foo_bar'] = $instance = new $class(); 85 86 return $instance; 84 return $this->services['foo_bar'] = new $class(); 87 85 } 88 86 … … 122 120 protected function getFactoryServiceService() 123 121 { 124 $this->services['factory_service'] = $instance = $this->get('foo.baz')->getInstance(); 125 126 return $instance; 122 return $this->services['factory_service'] = $this->get('foo.baz')->getInstance(); 127 123 } 128 124 branches/2.0/tests/Symfony/Tests/Component/DomCrawler/FormTest.php
r30885 r31539 61 61 { 62 62 $form = $this->createForm('<form>'.$form.'</form>'); 63 $this->assertEquals($values, array_map(function ($field) { return array(get_class($field), $field->getValue()); }, $form-> getFields()), '->getDefaultValues() '.$message);63 $this->assertEquals($values, array_map(function ($field) { return array(get_class($field), $field->getValue()); }, $form->all()), '->getDefaultValues() '.$message); 64 64 } 65 65 … … 337 337 } 338 338 339 public function testHas Field()339 public function testHas() 340 340 { 341 341 $form = $this->createForm('<form method="post"><input type="text" name="bar" value="bar" /><input type="submit" /></form>'); 342 342 343 $this->assertFalse($form->has Field('foo'), '->hasField() returns false if a field is not in the form');344 $this->assertTrue($form->has Field('bar'), '->hasField() returns true if a field is in the form');345 } 346 347 public function testGet Field()343 $this->assertFalse($form->has('foo'), '->has() returns false if a field is not in the form'); 344 $this->assertTrue($form->has('bar'), '->has() returns true if a field is in the form'); 345 } 346 347 public function testGet() 348 348 { 349 349 $form = $this->createForm('<form method="post"><input type="text" name="bar" value="bar" /><input type="submit" /></form>'); 350 350 351 $this->assertEquals('Symfony\\Component\\DomCrawler\\Field\\InputFormField', get_class($form->get Field('bar')), '->getField() returns the field object associated with the given name');352 353 try { 354 $form->get Field('foo');355 $this->fail('->get Field() throws an \InvalidArgumentException if the field does not exist');351 $this->assertEquals('Symfony\\Component\\DomCrawler\\Field\\InputFormField', get_class($form->get('bar')), '->get() returns the field object associated with the given name'); 352 353 try { 354 $form->get('foo'); 355 $this->fail('->get() throws an \InvalidArgumentException if the field does not exist'); 356 356 } catch (\InvalidArgumentException $e) { 357 $this->assertTrue(true, '->get Field() throws an \InvalidArgumentException if the field does not exist');358 } 359 } 360 361 public function test GetFields()357 $this->assertTrue(true, '->get() throws an \InvalidArgumentException if the field does not exist'); 358 } 359 } 360 361 public function testAll() 362 362 { 363 363 $form = $this->createForm('<form method="post"><input type="text" name="bar" value="bar" /><input type="submit" /></form>'); 364 364 365 $fields = $form-> getFields();366 $this->assertEquals(1, count($fields), '-> getFields() return an array of form field objects');367 $this->assertEquals('Symfony\\Component\\DomCrawler\\Field\\InputFormField', get_class($fields['bar']), '-> getFields() return an array of form field objects');365 $fields = $form->all(); 366 $this->assertEquals(1, count($fields), '->all() return an array of form field objects'); 367 $this->assertEquals('Symfony\\Component\\DomCrawler\\Field\\InputFormField', get_class($fields['bar']), '->all() return an array of form field objects'); 368 368 } 369 369 branches/2.0/tests/Symfony/Tests/Component/EventDispatcher/EventTest.php
r31147 r31539 33 33 $event = $this->createEvent(); 34 34 35 $this->assertEquals($this->parameters, $event-> getParameters(), '->getParameters() returns the event parameters');36 $this->assertEquals('bar', $event->get Parameter('foo'), '->getParameter() returns the value of a parameter');37 $event->set Parameter('foo', 'foo');38 $this->assertEquals('foo', $event->get Parameter('foo'), '->setParameter() changes the value of a parameter');39 $this->assertTrue($event->has Parameter('foo'), '->hasParameter() returns true if the parameter is defined');40 $this->assertFalse($event->has Parameter('oof'), '->hasParameter() returns false if the parameter is not defined');35 $this->assertEquals($this->parameters, $event->all(), '->all() returns the event parameters'); 36 $this->assertEquals('bar', $event->get('foo'), '->get() returns the value of a parameter'); 37 $event->set('foo', 'foo'); 38 $this->assertEquals('foo', $event->get('foo'), '->set() changes the value of a parameter'); 39 $this->assertTrue($event->has('foo'), '->has() returns true if the parameter is defined'); 40 $this->assertFalse($event->has('oof'), '->has() returns false if the parameter is not defined'); 41 41 42 42 try { 43 $event->get Parameter('foobar');44 $this->fail('->get Parameter() throws an \InvalidArgumentException exception when the parameter does not exist');43 $event->get('foobar'); 44 $this->fail('->get() throws an \InvalidArgumentException exception when the parameter does not exist'); 45 45 } catch (\Exception $e) { 46 $this->assertInstanceOf('\InvalidArgumentException', $e, '->get Parameter() throws an \InvalidArgumentException exception when the parameter does not exist');47 $this->assertEquals('The event "name" has no "foobar" parameter.', $e->getMessage(), '->get Parameter() throws an \InvalidArgumentException exception when the parameter does not exist');46 $this->assertInstanceOf('\InvalidArgumentException', $e, '->get() throws an \InvalidArgumentException exception when the parameter does not exist'); 47 $this->assertEquals('The event "name" has no "foobar" parameter.', $e->getMessage(), '->get() throws an \InvalidArgumentException exception when the parameter does not exist'); 48 48 } 49 49 $event = new Event($this->subject, 'name', $this->parameters); branches/2.0/tests/Symfony/Tests/Component/Form/FormTest.php
r31403 r31539 7 7 8 8 use Symfony\Component\Form\Form; 9 use Symfony\Component\Form\FormConfiguration; 9 10 use Symfony\Component\Form\Field; 10 11 use Symfony\Component\Form\HiddenField; … … 59 60 protected function setUp() 60 61 { 61 Form ::disableDefaultCsrfProtection();62 Form ::setDefaultCsrfSecret(null);62 FormConfiguration::disableDefaultCsrfProtection(); 63 FormConfiguration::setDefaultCsrfSecret(null); 63 64 $this->validator = $this->createMockValidator(); 64 65 $this->form = new Form('author', new Author(), $this->validator); … … 97 98 public function testDefaultCsrfProtectionCanBeEnabled() 98 99 { 99 Form ::enableDefaultCsrfProtection();100 FormConfiguration::enableDefaultCsrfProtection(); 100 101 $form = new Form('author', new Author(), $this->validator); 101 102 … … 113 114 public function testDefaultCsrfSecretCanBeSet() 114 115 { 115 Form ::setDefaultCsrfSecret('foobar');116 FormConfiguration::setDefaultCsrfSecret('foobar'); 116 117 $form = new Form('author', new Author(), $this->validator); 117 118 $form->enableCsrfProtection(); … … 122 123 public function testDefaultCsrfFieldNameCanBeSet() 123 124 { 124 Form ::setDefaultCsrfFieldName('foobar');125 FormConfiguration::setDefaultCsrfFieldName('foobar'); 125 126 $form = new Form('author', new Author(), $this->validator); 126 127 $form->enableCsrfProtection(); … … 173 174 public function testDefaultLocaleCanBeSet() 174 175 { 175 Form ::setDefaultLocale('de-DE-1996');176 FormConfiguration::setDefaultLocale('de-DE-1996'); 176 177 $form = new Form('author', new Author(), $this->validator); 177 178 branches/2.0/tests/Symfony/Tests/Component/HttpKernel/BaseHttpKernelTest.php
r31371 r31539 45 45 $dispatcher->connect('core.exception', function ($event) 46 46 { 47 $event->setReturnValue(new Response($event->get Parameter('exception')->getMessage()));47 $event->setReturnValue(new Response($event->get('exception')->getMessage())); 48 48 49 49 return true; branches/2.0/tests/Symfony/Tests/Component/HttpKernel/Cache/CacheTest.php
r31463 r31539 770 770 $response->setStatusCode(303); 771 771 $response->headers->set('Location', '/'); 772 $response->headers-> delete('Cache-Control');772 $response->headers->remove('Cache-Control'); 773 773 $response->setContent(''); 774 774 } branches/2.0/tests/Symfony/Tests/Component/Routing/Loader/ClosureLoaderTest.php
r30721 r31539 41 41 $routes = new RouteCollection(); 42 42 43 $routes->add Route('foo', $route);43 $routes->add('foo', $route); 44 44 45 45 return $routes; 46 46 }); 47 47 48 $this->assertEquals($route, $routes->get Route('foo'), '->load() loads a \Closure resource');48 $this->assertEquals($route, $routes->get('foo'), '->load() loads a \Closure resource'); 49 49 } 50 50 } branches/2.0/tests/Symfony/Tests/Component/Routing/Loader/DelegatingLoaderTest.php
r30721 r31539 72 72 $routes = new RouteCollection(); 73 73 74 $routes->add Route('foo', $route);74 $routes->add('foo', $route); 75 75 76 76 return $routes; 77 77 }); 78 78 79 $this->assertSame($route, $routes->get Route('foo'), '->load() loads a resource using the loaders from the resolver');79 $this->assertSame($route, $routes->get('foo'), '->load() loads a resource using the loaders from the resolver'); 80 80 81 81 try { branches/2.0/tests/Symfony/Tests/Component/Routing/Matcher/UrlMatcherTest.php
r30721 r31539 21 21 { 22 22 $collection = new RouteCollection(); 23 $collection->add Route('foo', new Route('/:foo'));23 $collection->add('foo', new Route('/:foo')); 24 24 25 25 $matcher = new UrlMatcherForTests($collection, array(), array()); branches/2.0/tests/Symfony/Tests/Component/Routing/RouteCollectionTest.php
r31229 r31539 22 22 $collection = new RouteCollection(); 23 23 $route = new Route('/foo'); 24 $collection->add Route('foo', $route);25 $this->assertEquals(array('foo' => $route), $collection-> getRoutes(), '->addRoute() adds a route');26 $this->assertEquals($route, $collection->get Route('foo'), '->getRoute() returns a route by name');27 $this->assertNull($collection->get Route('bar'), '->getRoute() returns null if a route does not exist');24 $collection->add('foo', $route); 25 $this->assertEquals(array('foo' => $route), $collection->all(), '->add() adds a route'); 26 $this->assertEquals($route, $collection->get('foo'), '->get() returns a route by name'); 27 $this->assertNull($collection->get('bar'), '->get() returns null if a route does not exist'); 28 28 } 29 29 30 30 /** 31 * @covers Symfony\Component\Routing\RouteCollection::add Route31 * @covers Symfony\Component\Routing\RouteCollection::add 32 32 * @expectedException InvalidArgumentException 33 33 */ … … 36 36 $collection = new RouteCollection(); 37 37 $route = new Route('/foo'); 38 $collection->add Route('f o o', $route);38 $collection->add('f o o', $route); 39 39 } 40 40 … … 42 42 { 43 43 $collection = new RouteCollection(); 44 $collection->add Route('foo', $foo = new Route('/foo'));44 $collection->add('foo', $foo = new Route('/foo')); 45 45 $collection1 = new RouteCollection(); 46 $collection1->add Route('foo', $foo1 = new Route('/foo1'));47 $collection1->add Route('bar', $bar1 = new Route('/bar1'));46 $collection1->add('foo', $foo1 = new Route('/foo1')); 47 $collection1->add('bar', $bar1 = new Route('/bar1')); 48 48 $collection->addCollection($collection1); 49 $this->assertEquals(array('foo' => $foo1, 'bar' => $bar1), $collection-> getRoutes(), '->addCollection() adds routes from another collection');49 $this->assertEquals(array('foo' => $foo1, 'bar' => $bar1), $collection->all(), '->addCollection() adds routes from another collection'); 50 50 51 51 $collection = new RouteCollection(); 52 $collection->add Route('foo', $foo = new Route('/foo'));52 $collection->add('foo', $foo = new Route('/foo')); 53 53 $collection1 = new RouteCollection(); 54 $collection1->add Route('foo', $foo1 = new Route('/foo1'));54 $collection1->add('foo', $foo1 = new Route('/foo1')); 55 55 $collection->addCollection($collection1, '/foo'); 56 $this->assertEquals('/foo/foo1', $collection->get Route('foo')->getPattern(), '->addCollection() can add a prefix to all merged routes');56 $this->assertEquals('/foo/foo1', $collection->get('foo')->getPattern(), '->addCollection() can add a prefix to all merged routes'); 57 57 58 58 $collection = new RouteCollection(); … … 67 67 { 68 68 $collection = new RouteCollection(); 69 $collection->add Route('foo', $foo = new Route('/foo'));70 $collection->add Route('bar', $bar = new Route('/bar'));69 $collection->add('foo', $foo = new Route('/foo')); 70 $collection->add('bar', $bar = new Route('/bar')); 71 71 $collection->addPrefix('/admin'); 72 $this->assertEquals('/admin/foo', $collection->get Route('foo')->getPattern(), '->addPrefix() adds a prefix to all routes');73 $this->assertEquals('/admin/bar', $collection->get Route('bar')->getPattern(), '->addPrefix() adds a prefix to all routes');72 $this->assertEquals('/admin/foo', $collection->get('foo')->getPattern(), '->addPrefix() adds a prefix to all routes'); 73 $this->assertEquals('/admin/bar', $collection->get('bar')->getPattern(), '->addPrefix() adds a prefix to all routes'); 74 74 } 75 75 branches/2.0/tests/Symfony/Tests/Component/Security/Authentication/AuthenticationProviderManagerTest.php
r31317 r31539 22 22 { 23 23 $manager = new AuthenticationProviderManager(); 24 $manager->add Provider($provider = $this->getMock('Symfony\Component\Security\Authentication\Provider\AuthenticationProviderInterface'));25 $this->assertSame(array($provider), $manager-> getProviders());24 $manager->add($provider = $this->getMock('Symfony\Component\Security\Authentication\Provider\AuthenticationProviderInterface')); 25 $this->assertSame(array($provider), $manager->all()); 26 26 27 27 $manager->setProviders($providers = array($this->getMock('Symfony\Component\Security\Authentication\Provider\AuthenticationProviderInterface'))); 28 $this->assertSame($providers, $manager-> getProviders());28 $this->assertSame($providers, $manager->all()); 29 29 } 30 30 branches/2.0/tests/Symfony/Tests/Component/Translation/Loader/PhpFileLoaderTest.php
r31317 r31539 23 23 $catalogue = $loader->load($resource, 'en', 'domain1'); 24 24 25 $this->assertEquals(array('foo' => 'bar'), $catalogue-> getMessages('domain1'));25 $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); 26 26 $this->assertEquals('en', $catalogue->getLocale()); 27 27 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); branches/2.0/tests/Symfony/Tests/Component/Translation/Loader/XliffFileLoaderTest.php
r31317 r31539 23 23 $catalogue = $loader->load($resource, 'en', 'domain1'); 24 24 25 $this->assertEquals(array('foo' => 'bar'), $catalogue-> getMessages('domain1'));25 $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); 26 26 $this->assertEquals('en', $catalogue->getLocale()); 27 27 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); branches/2.0/tests/Symfony/Tests/Component/Translation/Loader/YamlFileLoaderTest.php
r31403 r31539 23 23 $catalogue = $loader->load($resource, 'en', 'domain1'); 24 24 25 $this->assertEquals(array('foo' => 'bar'), $catalogue-> getMessages('domain1'));25 $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); 26 26 $this->assertEquals('en', $catalogue->getLocale()); 27 27 $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); branches/2.0/tests/Symfony/Tests/Component/Translation/MessageCatalogTest.php
r31317 r31539 30 30 } 31 31 32 public function test GetMessages()32 public function testAll() 33 33 { 34 34 $catalogue = new MessageCatalogue('en', $messages = array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); 35 35 36 $this->assertEquals(array('foo' => 'foo'), $catalogue-> getMessages('domain1'));37 $this->assertEquals(array(), $catalogue-> getMessages('domain88'));38 $this->assertEquals($messages, $catalogue-> getMessages());36 $this->assertEquals(array('foo' => 'foo'), $catalogue->all('domain1')); 37 $this->assertEquals(array(), $catalogue->all('domain88')); 38 $this->assertEquals($messages, $catalogue->all()); 39 39 } 40 40 41 public function testHas Message()41 public function testHas() 42 42 { 43 43 $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); 44 44 45 $this->assertTrue($catalogue->has Message('foo', 'domain1'));46 $this->assertFalse($catalogue->has Message('bar', 'domain1'));47 $this->assertFalse($catalogue->has Message('foo', 'domain88'));45 $this->assertTrue($catalogue->has('foo', 'domain1')); 46 $this->assertFalse($catalogue->has('bar', 'domain1')); 47 $this->assertFalse($catalogue->has('foo', 'domain88')); 48 48 } 49 49 50 public function testGetSet Message()50 public function testGetSet() 51 51 { 52 52 $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); 53 $catalogue->set Message('foo1', 'foo1', 'domain1');53 $catalogue->set('foo1', 'foo1', 'domain1'); 54 54 55 $this->assertEquals('foo', $catalogue->get Message('foo', 'domain1'));56 $this->assertEquals('foo1', $catalogue->get Message('foo1', 'domain1'));55 $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); 56 $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); 57 57 } 58 58 59 public function testAdd Messages()59 public function testAdd() 60 60 { 61 61 $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); 62 $catalogue->add Messages(array('foo1' => 'foo1'), 'domain1');62 $catalogue->add(array('foo1' => 'foo1'), 'domain1'); 63 63 64 $this->assertEquals('foo', $catalogue->get Message('foo', 'domain1'));65 $this->assertEquals('foo1', $catalogue->get Message('foo1', 'domain1'));64 $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); 65 $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); 66 66 67 $catalogue->add Messages(array('foo' => 'bar'), 'domain1');68 $this->assertEquals('bar', $catalogue->get Message('foo', 'domain1'));69 $this->assertEquals('foo1', $catalogue->get Message('foo1', 'domain1'));67 $catalogue->add(array('foo' => 'bar'), 'domain1'); 68 $this->assertEquals('bar', $catalogue->get('foo', 'domain1')); 69 $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); 70 70 71 $catalogue->add Messages(array('foo' => 'bar'), 'domain88');72 $this->assertEquals('bar', $catalogue->get Message('foo', 'domain88'));71 $catalogue->add(array('foo' => 'bar'), 'domain88'); 72 $this->assertEquals('bar', $catalogue->get('foo', 'domain88')); 73 73 } 74 74 75 public function test SetMessages()75 public function testReplace() 76 76 { 77 77 $catalogue = new MessageCatalogue('en', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar'))); 78 $catalogue-> setMessages($messages = array('foo1' => 'foo1'), 'domain1');78 $catalogue->replace($messages = array('foo1' => 'foo1'), 'domain1'); 79 79 80 $this->assertEquals($messages, $catalogue-> getMessages('domain1'));80 $this->assertEquals($messages, $catalogue->all('domain1')); 81 81 } 82 82 … … 97 97 $catalogue->addCatalogue($catalogue1); 98 98 99 $this->assertEquals('foo', $catalogue->get Message('foo', 'domain1'));100 $this->assertEquals('foo1', $catalogue->get Message('foo1', 'domain1'));99 $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); 100 $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); 101 101 102 102 $this->assertEquals(array($r, $r1), $catalogue->getResources()); … … 119 119 $catalogue->addFallbackCatalogue($catalogue1); 120 120 121 $this->assertEquals('foo', $catalogue->get Message('foo', 'domain1'));122 $this->assertEquals('foo1', $catalogue->get Message('foo1', 'domain1'));121 $this->assertEquals('foo', $catalogue->get('foo', 'domain1')); 122 $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1')); 123 123 124 124 $this->assertEquals(array($r, $r1), $catalogue->getResources());