The Symfony PHP framework
PHP HTML CSS C M4 Shell
Latest commit df8cf70 Aug 24, 2016 @nicolas-grekas nicolas-grekas minor #19722 [ExpressionLanguage] Move the ::dump method to the Node …
…classe to ease its usage (lyrixx)

This PR was merged into the 3.2-dev branch.

Discussion
----------

[ExpressionLanguage] Move the ::dump method to the Node classe to ease its usage

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Example (for @nicolas-grekas :trollface: )

```php
<?php

require __DIR__.'/vendor/autoload.php';

use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
use Symfony\Component\ExpressionLanguage\Node\NameNode;

$el = new ExpressionLanguage();

$expression = $el->parse('a + b + 12', ['a','b']);

function dump_with_highlight($node)
{
    $dump = '';

    foreach ($node->toArray() as $v) {
        if (is_scalar($v)) {
            $dump .= $v;
        } elseif ($v instanceof NameNode) {
            $dump .= sprintf('`%s`', dump_with_highlight($v));
        } else {
            $dump .= dump_with_highlight($v);
        }
    }

    return $dump;
}

echo dump_with_highlight($expression->getNodes());
```
Result:

```
((<strong>a</strong> + <strong>b</strong>) + 12)
```

Commits
-------

b6d0050 [ExpressionLanguage] Move the ::dump method to the Node classe to ease its usage

README.md

README

What is Symfony?

Symfony is a PHP full-stack web framework. It is written with speed and flexibility in mind. It allows developers to build better and easy to maintain websites with PHP.

Symfony can be used to develop all kind of websites, from your personal blog to high traffic ones like Dailymotion or Yahoo! Answers.

Installation

The best way to install Symfony is to use the official Symfony Installer. It allows you to start a new project based on the version you want.

Documentation

The "Quick Tour" tutorial gives you a first feeling of the framework. If, like us, you think that Symfony can help speed up your development and take the quality of your work to the next level, read the official Symfony documentation.

Contributing

Symfony is an open source, community-driven project. If you'd like to contribute, please read the Contributing Code part of the documentation. If you're submitting a pull request, please follow the guidelines in the Submitting a Patch section and use Pull Request Template.

Running Symfony Tests

Information on how to run the Symfony test suite can be found in the Running Symfony Tests section.