From 65e6275da9f34d9abb736b5e908a8cac8b453a84 Mon Sep 17 00:00:00 2001 From: Richard Miller Date: Sat, 24 Nov 2012 21:47:40 +0000 Subject: [PATCH 1/2] Reducing some code sample line lengths to stop horizontal scrolling --- components/dom_crawler.rst | 8 +++++-- components/event_dispatcher/introduction.rst | 6 ++--- components/http_foundation/introduction.rst | 25 ++++++++++++++++---- components/locale.rst | 6 +++-- components/yaml.rst | 7 ++++-- 5 files changed, 38 insertions(+), 14 deletions(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index 3ccfa91a969..843f5709db1 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -121,7 +121,10 @@ Access the attribute value of the first node of the current selection:: Extract attribute and/or node values from the list of nodes:: - $attributes = $crawler->filterXpath('//body/p')->extract(array('_text', 'class')); + $attributes = $crawler + ->filterXpath('//body/p') + ->extract(array('_text', 'class')) + ; .. note:: @@ -242,7 +245,8 @@ You can virtually set and get values on the form:: // get back an array of values - in the "flat" array like above $values = $form->getValues(); - // returns the values like PHP would see them, where "registration" is its own array + // returns the values like PHP would see them, + // where "registration" is its own array $values = $form->getPhpValues(); To work with multi-dimensional fields:: diff --git a/components/event_dispatcher/introduction.rst b/components/event_dispatcher/introduction.rst index 9d972deca55..dd025e58db3 100644 --- a/components/event_dispatcher/introduction.rst +++ b/components/event_dispatcher/introduction.rst @@ -241,8 +241,8 @@ that serves to define and document your event: * The store.order event is thrown each time an order is created * in the system. * - * The event listener receives an Acme\StoreBundle\Event\FilterOrderEvent - * instance. + * The event listener receives an + * Acme\StoreBundle\Event\FilterOrderEvent instance. * * @var string */ @@ -490,4 +490,4 @@ be called. .. _`Symfony2 HttpKernel component`: https://github.com/symfony/HttpKernel .. _Closures: http://php.net/manual/en/functions.anonymous.php .. _PHP callable: http://www.php.net/manual/en/language.pseudo-types.php#language.types.callback -.. _Packagist: https://packagist.org/packages/symfony/event-dispatcher \ No newline at end of file +.. _Packagist: https://packagist.org/packages/symfony/event-dispatcher diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index d4e7b1454fc..d933b6448b2 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -38,7 +38,14 @@ variables with which is almost equivalent to the more verbose, but also more flexible, :method:`Symfony\\Component\\HttpFoundation\\Request::__construct` call:: - $request = new Request($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); + $request = new Request( + $_GET, + $_POST, + array(), + $_COOKIE, + $_FILES, + $_SERVER) + ; Accessing Request Data ~~~~~~~~~~~~~~~~~~~~~~ @@ -184,7 +191,11 @@ Simulating a Request Instead of creating a Request based on the PHP globals, you can also simulate a Request:: - $request = Request::create('/hello-world', 'GET', array('name' => 'Fabien')); + $request = Request::create( + '/hello-world', + 'GET', + array('name' => 'Fabien') + ); The :method:`Symfony\\Component\\HttpFoundation\\Request::create` method creates a request based on a path info, a method and some parameters (the @@ -245,7 +256,11 @@ code, and an array of HTTP headers:: use Symfony\Component\HttpFoundation\Response; - $response = new Response('Content', 200, array('content-type' => 'text/html')); + $response = new Response( + 'Content', + 200, + array('content-type' => 'text/html') + ); These information can also be manipulated after the Response object creation:: @@ -358,7 +373,7 @@ Any type of response can be created via the right content and headers. A JSON response might look like this:: use Symfony\Component\HttpFoundation\Response; - + $response = new Response(); $response->setContent(json_encode(array( 'data' => 123 @@ -371,4 +386,4 @@ Session TBD -- This part has not been written yet as it will probably be refactored soon in Symfony 2.1. -.. _Packagist: https://packagist.org/packages/symfony/http-foundation \ No newline at end of file +.. _Packagist: https://packagist.org/packages/symfony/http-foundation diff --git a/components/locale.rst b/components/locale.rst index 53531e3b3ae..991e69f0b94 100644 --- a/components/locale.rst +++ b/components/locale.rst @@ -42,7 +42,9 @@ When using the ClassLoader component following code is sufficient to supplement if (!function_exists('intl_get_error_code')) { require __DIR__.'/path/to/src/Symfony/Component/Locale/Resources/stubs/functions.php'; - $loader->registerPrefixFallbacks(array(__DIR__.'/path/to/src/Symfony/Component/Locale/Resources/stubs')); + $loader->registerPrefixFallbacks( + array(__DIR__.'/path/to/src/Symfony/Component/Locale/Resources/stubs') + ); } :class:`Symfony\\Component\\Locale\\Locale` class enriches native :phpclass:`Locale` class with additional features: @@ -67,4 +69,4 @@ When using the ClassLoader component following code is sufficient to supplement $icuVersion = Locale::getIcuVersion(); $icuDataVersion = Locale::getIcuDataVersion(); -.. _Packagist: https://packagist.org/packages/symfony/locale \ No newline at end of file +.. _Packagist: https://packagist.org/packages/symfony/locale diff --git a/components/yaml.rst b/components/yaml.rst index 3be834e196a..9c6e88b2d09 100644 --- a/components/yaml.rst +++ b/components/yaml.rst @@ -146,7 +146,10 @@ array to its YAML representation: use Symfony\Component\Yaml\Dumper; - $array = array('foo' => 'bar', 'bar' => array('foo' => 'bar', 'bar' => 'baz')); + $array = array( + 'foo' => 'bar', + 'bar' => array('foo' => 'bar', 'bar' => 'baz') + ); $dumper = new Dumper(); @@ -472,4 +475,4 @@ Comments can be added in YAML by prefixing them with a hash mark (``#``): indented according to the current level of nesting in a collection. .. _YAML: http://yaml.org/ -.. _Packagist: https://packagist.org/packages/symfony/yaml \ No newline at end of file +.. _Packagist: https://packagist.org/packages/symfony/yaml From 41fb5fb1e26452ac46fb40b9c105cc207d9df57c Mon Sep 17 00:00:00 2001 From: Richard Miller Date: Sun, 25 Nov 2012 13:16:29 +0000 Subject: [PATCH 2/2] Minor CS fix --- components/http_foundation/introduction.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index d933b6448b2..ba525a02f69 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -44,8 +44,8 @@ which is almost equivalent to the more verbose, but also more flexible, array(), $_COOKIE, $_FILES, - $_SERVER) - ; + $_SERVER + ); Accessing Request Data ~~~~~~~~~~~~~~~~~~~~~~