From 473969fdaad2b45b7c3e6a766717456fb42221fe Mon Sep 17 00:00:00 2001 From: Andrew M Date: Sat, 8 Feb 2014 10:26:01 +0200 Subject: [PATCH] Minimize horizontal scrolling in code blocks to improve readability --- book/controller.rst | 8 ++++-- book/doctrine.rst | 27 ++++++++++++--------- components/form/introduction.rst | 13 +++++++--- components/http_foundation/introduction.rst | 13 +++++++--- components/http_kernel/introduction.rst | 4 ++- components/intl.rst | 7 +++++- 6 files changed, 50 insertions(+), 22 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 661d7838dab..7692b7e59ae 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -508,7 +508,10 @@ value to each variable. $subRequest = $request->duplicate(array(), null, $path); $httpKernel = $this->container->get('http_kernel'); - $response = $httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST); + $response = $httpKernel->handle( + $subRequest, + HttpKernelInterface::SUB_REQUEST + ); .. index:: single: Controller; Rendering templates @@ -574,7 +577,8 @@ The Symfony templating engine is explained in great detail in the 'AcmeHelloBundle:Hello/Greetings:index.html.twig', array('name' => $name) ); - // index.html.twig found in Resources/views/Hello/Greetings is rendered. + // index.html.twig found in Resources/views/Hello/Greetings + // is rendered. .. index:: single: Controller; Accessing services diff --git a/book/doctrine.rst b/book/doctrine.rst index fbed31f7b31..b4ffafdbfa7 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -622,8 +622,10 @@ Once you have your repository, you have access to all sorts of helpful methods:: You can also take advantage of the useful ``findBy`` and ``findOneBy`` methods to easily fetch objects based on multiple conditions:: - // query for one product matching by name and price - $product = $repository->findOneBy(array('name' => 'foo', 'price' => 19.99)); + // query for one product matching be name and price + $product = $repository->findOneBy( + array('name' => 'foo', 'price' => 19.99) + ); // query for all products matching the name, ordered by price $products = $repository->findBy( @@ -1144,7 +1146,8 @@ Now you can see this new code in action! Imagine you're inside a controller:: $em->flush(); return new Response( - 'Created product id: '.$product->getId().' and category id: '.$category->getId() + 'Created product id: '.$product->getId() + .' and category id: '.$category->getId() ); } } @@ -1478,8 +1481,8 @@ and ``nullable``. Take a few examples: protected $name; /** - * A string field of length 150 that persists to an "email_address" column - * and has a unique index. + * A string field of length 150 that persists to an + * "email_address" column and has a unique index. * * @ORM\Column(name="email_address", unique=true, length=150) */ @@ -1489,13 +1492,14 @@ and ``nullable``. Take a few examples: fields: # A string field length 255 that cannot be null - # (reflecting the default values for the "length" and *nullable* options) - # type attribute is necessary in YAML definitions + # (reflecting the default values for the "length" + # and *nullable* options) type attribute is + # necessary in YAML definitions name: type: string - # A string field of length 150 that persists to an "email_address" column - # and has a unique index. + # A string field of length 150 that persists to + # an "email_address" column and has a unique index. email: type: string column: email_address @@ -1506,8 +1510,9 @@ and ``nullable``. Take a few examples: setEnvironment($twig); // add the FormExtension to Twig - $twig->addExtension(new FormExtension(new TwigRenderer($formEngine, $csrfProvider))); + $twig->addExtension( + new FormExtension(new TwigRenderer($formEngine, $csrfProvider)) + ); // create your form factory as normal $formFactory = Forms::createFormFactoryBuilder() @@ -307,7 +311,8 @@ Your integration with the Validation component will look something like this:: $vendorDir = realpath(__DIR__ . '/../vendor'); $vendorFormDir = $vendorDir . '/symfony/form/Symfony/Component/Form'; - $vendorValidatorDir = $vendorDir . '/symfony/validator/Symfony/Component/Validator'; + $vendorValidatorDir = + $vendorDir . '/symfony/validator/Symfony/Component/Validator'; // create the validator - details will vary $validator = Validation::createValidator(); diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 8497a09e530..a93ce40eb58 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -259,7 +259,8 @@ If you need to get full access to parsed data from ``Accept``, ``Accept-Language } // accepts items are sorted by descending quality - $accepts = AcceptHeader::fromString($request->headers->get('Accept'))->all(); + $accepts = AcceptHeader::fromString($request->headers->get('Accept')) + ->all(); Accessing other Data ~~~~~~~~~~~~~~~~~~~~ @@ -432,7 +433,10 @@ abstracts the hard work behind a simple API:: use Symfony\Component\HttpFoundation\ResponseHeaderBag; - $d = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'foo.pdf'); + $d = $response->headers->makeDisposition( + ResponseHeaderBag::DISPOSITION_ATTACHMENT, + 'foo.pdf' + ); $response->headers->set('Content-Disposition', $d); @@ -460,7 +464,10 @@ if it should:: You can still set the ``Content-Type`` of the sent file, or change its ``Content-Disposition``:: $response->headers->set('Content-Type', 'text/plain'); - $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'filename.txt'); + $response->setContentDisposition( + ResponseHeaderBag::DISPOSITION_ATTACHMENT, + 'filename.txt' + ); .. _component-http-foundation-json-response: diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index 5b2b180b0e8..7e40b393078 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -610,7 +610,9 @@ a built-in ControllerResolver that can be used to create a working example:: $routes = new RouteCollection(); $routes->add('hello', new Route('/hello/{name}', array( '_controller' => function (Request $request) { - return new Response(sprintf("Hello %s", $request->get('name'))); + return new Response( + sprintf("Hello %s", $request->get('name')) + ); } ) )); diff --git a/components/intl.rst b/components/intl.rst index 34ed07448e7..eff57495c25 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -282,7 +282,12 @@ multi-valued entries (arrays), the values of the more specific and the fallback locale will be merged. In order to suppress this behavior, the last parameter ``$fallback`` can be set to ``false``:: - echo $reader->readEntry('/path/to/bundle', 'en', array('Data', 'entry1'), false); + echo $reader->readEntry( + '/path/to/bundle', + 'en', + array('Data', 'entry1'), + false + ); Accessing ICU Data ------------------