Plugin Directory

Changeset 1098219


Ignore:
Timestamp:
02/24/2015 03:33:12 PM (11 years ago)
Author:
mgrt
Message:

Fixed wordpress site url

Location:
mgrt/trunk
Files:
1 added
6 deleted
45 edited

Legend:

Unmodified
Added
Removed
  • mgrt/trunk/Mgrt/Wordpress/Sync/ImportSyncProcessor.php

    r988019 r1098219  
    7070        }
    7171
    72         if ($contact->getEmail() == 'alexandre@yzalis.com') {
    73             return $wp_id;
    74         }
    7572        if ($wp_id == 0) {
    7673            return false;
     
    9794        $user_meta['basic']['ID'] = $wp_id;
    9895
    99         foreach ($user_meta['custom'] as $meta_key => $meta_value) {
    100             $this->getDataManager()->insertOrUpdateCustomField($wp_id, $meta_key, $meta_value);
     96        if (!empty($user_meta['custom'])) {
     97            foreach ($user_meta['custom'] as $meta_key => $meta_value) {
     98                $this->getDataManager()->insertOrUpdateCustomField($wp_id, $meta_key, $meta_value);
     99            }
    101100        }
    102101
  • mgrt/trunk/Mgrt/Wordpress/View/Start.php

    r1014718 r1098219  
    141141    {
    142142        $webhooks = $this->getDataManager()->makeApiCall('getWebhooks');
    143         $seek_url = site_url() . '/?webhook';
     143        $seek_url = get_home_url() . '/?webhook';
    144144        $require_events = $this->getSyncManager()->getListenedEvents();
    145145        $require_sources = $this->getSyncManager()->getListenedSources();
  • mgrt/trunk/readme.txt

    r1014718 r1098219  
    2727
    2828== Changelog ==
     291.1.3   Fixed webhook url
     30
    29311.1.2   Fixed problems with forced sync
    3032
  • mgrt/trunk/vendor/autoload.php

    r1014718 r1098219  
    55require_once __DIR__ . '/composer' . '/autoload_real.php';
    66
    7 return ComposerAutoloaderInit4b969deb73820b2beb3fdade65609360::getLoader();
     7return ComposerAutoloaderInite21f9a30a804b41259f1bea07d031610::getLoader();
  • mgrt/trunk/vendor/composer/ClassLoader.php

    r986149 r1098219  
    5555    private $classMap = array();
    5656
     57    private $classMapAuthoritative = false;
     58
    5759    public function getPrefixes()
    5860    {
    59         return call_user_func_array('array_merge', $this->prefixesPsr0);
     61        if (!empty($this->prefixesPsr0)) {
     62            return call_user_func_array('array_merge', $this->prefixesPsr0);
     63        }
     64
     65        return array();
    6066    }
    6167
     
    246252
    247253    /**
     254     * Turns off searching the prefix and fallback directories for classes
     255     * that have not been registered with the class map.
     256     *
     257     * @param bool $classMapAuthoritative
     258     */
     259    public function setClassMapAuthoritative($classMapAuthoritative)
     260    {
     261        $this->classMapAuthoritative = $classMapAuthoritative;
     262    }
     263
     264    /**
     265     * Should class lookup fail if not found in the current class map?
     266     *
     267     * @return bool
     268     */
     269    public function isClassMapAuthoritative()
     270    {
     271        return $this->classMapAuthoritative;
     272    }
     273
     274    /**
    248275     * Registers this instance as an autoloader.
    249276     *
     
    295322        if (isset($this->classMap[$class])) {
    296323            return $this->classMap[$class];
     324        }
     325        if ($this->classMapAuthoritative) {
     326            return false;
    297327        }
    298328
  • mgrt/trunk/vendor/composer/autoload_real.php

    r1014718 r1098219  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit4b969deb73820b2beb3fdade65609360
     5class ComposerAutoloaderInite21f9a30a804b41259f1bea07d031610
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInit4b969deb73820b2beb3fdade65609360', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInite21f9a30a804b41259f1bea07d031610', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInit4b969deb73820b2beb3fdade65609360', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInite21f9a30a804b41259f1bea07d031610', 'loadClassLoader'));
    2525
    2626        $map = require __DIR__ . '/autoload_namespaces.php';
     
    4545}
    4646
    47 function composerRequire4b969deb73820b2beb3fdade65609360($file)
     47function composerRequiree21f9a30a804b41259f1bea07d031610($file)
    4848{
    4949    require $file;
  • mgrt/trunk/vendor/composer/installed.json

    r1014718 r1098219  
    22    {
    33        "name": "symfony/yaml",
    4         "version": "v2.5.6",
    5         "version_normalized": "2.5.6.0",
     4        "version": "v2.6.4",
     5        "version_normalized": "2.6.4.0",
    66        "target-dir": "Symfony/Component/Yaml",
    77        "source": {
    88            "type": "git",
    99            "url": "https://github.com/symfony/Yaml.git",
    10             "reference": "2d9f527449cabfa8543dd7fa3a466d6ae83d6726"
    11         },
    12         "dist": {
    13             "type": "zip",
    14             "url": "https://api.github.com/repos/symfony/Yaml/zipball/2d9f527449cabfa8543dd7fa3a466d6ae83d6726",
    15             "reference": "2d9f527449cabfa8543dd7fa3a466d6ae83d6726",
     10            "reference": "60ed7751671113cf1ee7d7778e691642c2e9acd8"
     11        },
     12        "dist": {
     13            "type": "zip",
     14            "url": "https://api.github.com/repos/symfony/Yaml/zipball/60ed7751671113cf1ee7d7778e691642c2e9acd8",
     15            "reference": "60ed7751671113cf1ee7d7778e691642c2e9acd8",
    1616            "shasum": ""
    1717        },
     
    1919            "php": ">=5.3.3"
    2020        },
    21         "time": "2014-10-01 05:50:18",
     21        "time": "2015-01-25 04:39:26",
    2222        "type": "library",
    2323        "extra": {
    2424            "branch-alias": {
    25                 "dev-master": "2.5-dev"
     25                "dev-master": "2.6-dev"
    2626            }
    2727        },
     
    117117    {
    118118        "name": "symfony/event-dispatcher",
    119         "version": "v2.5.6",
    120         "version_normalized": "2.5.6.0",
     119        "version": "v2.6.4",
     120        "version_normalized": "2.6.4.0",
    121121        "target-dir": "Symfony/Component/EventDispatcher",
    122122        "source": {
    123123            "type": "git",
    124124            "url": "https://github.com/symfony/EventDispatcher.git",
    125             "reference": "804eb28dbbfba9ffdab21fe2066744906cea2212"
    126         },
    127         "dist": {
    128             "type": "zip",
    129             "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/804eb28dbbfba9ffdab21fe2066744906cea2212",
    130             "reference": "804eb28dbbfba9ffdab21fe2066744906cea2212",
     125            "reference": "f75989f3ab2743a82fe0b03ded2598a2b1546813"
     126        },
     127        "dist": {
     128            "type": "zip",
     129            "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/f75989f3ab2743a82fe0b03ded2598a2b1546813",
     130            "reference": "f75989f3ab2743a82fe0b03ded2598a2b1546813",
    131131            "shasum": ""
    132132        },
     
    136136        "require-dev": {
    137137            "psr/log": "~1.0",
    138             "symfony/config": "~2.0",
    139             "symfony/dependency-injection": "~2.0,<2.6.0",
    140             "symfony/stopwatch": "~2.2"
     138            "symfony/config": "~2.0,>=2.0.5",
     139            "symfony/dependency-injection": "~2.6",
     140            "symfony/expression-language": "~2.6",
     141            "symfony/stopwatch": "~2.3"
    141142        },
    142143        "suggest": {
     
    144145            "symfony/http-kernel": ""
    145146        },
    146         "time": "2014-10-01 15:43:05",
     147        "time": "2015-02-01 16:10:57",
    147148        "type": "library",
    148149        "extra": {
    149150            "branch-alias": {
    150                 "dev-master": "2.5-dev"
     151                "dev-master": "2.6-dev"
    151152            }
    152153        },
     
    270271    {
    271272        "name": "mgrt/mgrt-php",
    272         "version": "2.1.0",
    273         "version_normalized": "2.1.0.0",
     273        "version": "2.1.1",
     274        "version_normalized": "2.1.1.0",
    274275        "source": {
    275276            "type": "git",
    276277            "url": "https://github.com/mgrt/mgrt-php.git",
    277             "reference": "b2e9da3d5e6193d93ceedca2330cc6cf3d592fb5"
    278         },
    279         "dist": {
    280             "type": "zip",
    281             "url": "https://api.github.com/repos/mgrt/mgrt-php/zipball/b2e9da3d5e6193d93ceedca2330cc6cf3d592fb5",
    282             "reference": "b2e9da3d5e6193d93ceedca2330cc6cf3d592fb5",
     278            "reference": "4cc755e42c854d4342980453e2a3d29117f0b06d"
     279        },
     280        "dist": {
     281            "type": "zip",
     282            "url": "https://api.github.com/repos/mgrt/mgrt-php/zipball/4cc755e42c854d4342980453e2a3d29117f0b06d",
     283            "reference": "4cc755e42c854d4342980453e2a3d29117f0b06d",
    283284            "shasum": ""
    284285        },
     
    289290            "symfony/yaml": "~2.1"
    290291        },
    291         "time": "2014-10-02 14:33:25",
     292        "time": "2014-11-04 10:25:44",
    292293        "type": "library",
    293294        "extra": {
  • mgrt/trunk/vendor/mgrt/mgrt-php/src/Mgrt/Model/WebhookCallInput.php

    r986149 r1098219  
    1313    protected $event;
    1414    protected $event_name;
     15    protected $event_type;
    1516    protected $source;
    1617    protected $payload;
    1718    protected $valid;
    1819    protected $secret_key;
     20    protected $is_test = false;
    1921
    2022    public function fromInputs($input = null)
     
    4244        if ($parsedBody['payload'] == 'Hello World!') {
    4345            // this request is a test call; exit now
    44             exit();
     46            $is_test = true;
     47
     48            return $this->fromArray(compact('id', 'signature', 'valid', 'is_test'));
    4549        }
    4650
     
    5458        $exp        = explode('.', $event, 2);
    5559
     60        $event_type = Inflector::camelize($exp[0]);
    5661        $event_name = Inflector::camelize('on_'.$exp[1]);
    5762
     
    6166        $payload    = $result->fromArrayWithObject($parsedBody['payload'], $objectName);
    6267
    63         return $this->fromArray(compact('id', 'signature', 'event', 'event_name', 'source', 'payload', 'valid'));
     68        return $this->fromArray(compact('id', 'signature', 'event', 'event_type', 'event_name', 'source', 'payload', 'valid'));
    6469    }
    6570
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php

    r986149 r1098219  
    1616/**
    1717 * Lazily loads listeners and subscribers from the dependency injection
    18  * container
     18 * container.
    1919 *
    2020 * @author Fabien Potencier <fabien@symfony.com>
     
    2525{
    2626    /**
    27      * The container from where services are loaded
     27     * The container from where services are loaded.
     28     *
    2829     * @var ContainerInterface
    2930     */
     
    3132
    3233    /**
    33      * The service IDs of the event listeners and subscribers
     34     * The service IDs of the event listeners and subscribers.
     35     *
    3436     * @var array
    3537     */
     
    3739
    3840    /**
    39      * The services registered as listeners
     41     * The services registered as listeners.
     42     *
    4043     * @var array
    4144     */
     
    5356
    5457    /**
    55      * Adds a service as event listener
     58     * Adds a service as event listener.
    5659     *
    5760     * @param string $eventName Event for which the listener is added
    5861     * @param array  $callback  The service ID of the listener service & the method
    59      *                            name that has to be called
    60      * @param int     $priority The higher this value, the earlier an event listener
    61      *                            will be triggered in the chain.
    62      *                            Defaults to 0.
     62     *                          name that has to be called
     63     * @param int    $priority The higher this value, the earlier an event listener
     64     *                          will be triggered in the chain.
     65     *                          Defaults to 0.
    6366     *
    6467     * @throws \InvalidArgumentException
     
    7780        $this->lazyLoad($eventName);
    7881
    79         if (isset($this->listeners[$eventName])) {
    80             foreach ($this->listeners[$eventName] as $key => $l) {
    81                 foreach ($this->listenerIds[$eventName] as $i => $args) {
    82                     list($serviceId, $method, $priority) = $args;
    83                     if ($key === $serviceId.'.'.$method) {
    84                         if ($listener === array($l, $method)) {
    85                             unset($this->listeners[$eventName][$key]);
    86                             if (empty($this->listeners[$eventName])) {
    87                                 unset($this->listeners[$eventName]);
    88                             }
    89                             unset($this->listenerIds[$eventName][$i]);
    90                             if (empty($this->listenerIds[$eventName])) {
    91                                 unset($this->listenerIds[$eventName]);
    92                             }
    93                         }
     82        if (isset($this->listenerIds[$eventName])) {
     83            foreach ($this->listenerIds[$eventName] as $i => $args) {
     84                list($serviceId, $method, $priority) = $args;
     85                $key = $serviceId.'.'.$method;
     86                if (isset($this->listeners[$eventName][$key]) && $listener === array($this->listeners[$eventName][$key], $method)) {
     87                    unset($this->listeners[$eventName][$key]);
     88                    if (empty($this->listeners[$eventName])) {
     89                        unset($this->listeners[$eventName]);
     90                    }
     91                    unset($this->listenerIds[$eventName][$i]);
     92                    if (empty($this->listenerIds[$eventName])) {
     93                        unset($this->listenerIds[$eventName]);
    9494                    }
    9595                }
     
    101101
    102102    /**
    103      * @see EventDispatcherInterface::hasListeners
     103     * @see EventDispatcherInterface::hasListeners()
    104104     */
    105105    public function hasListeners($eventName = null)
     
    117117
    118118    /**
    119      * @see EventDispatcherInterface::getListeners
     119     * @see EventDispatcherInterface::getListeners()
    120120     */
    121121    public function getListeners($eventName = null)
     
    133133
    134134    /**
    135      * Adds a service as event subscriber
     135     * Adds a service as event subscriber.
    136136     *
    137137     * @param string $serviceId The service ID of the subscriber service
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php

    r1000678 r1098219  
    217217            $info = $this->getListenerInfo($listener, $eventName);
    218218            $name = isset($info['class']) ? $info['class'] : $info['type'];
    219             $this->dispatcher->addListener($eventName, new WrappedListener($listener, $name, $this->stopwatch));
     219            $this->dispatcher->addListener($eventName, new WrappedListener($listener, $name, $this->stopwatch, $this));
    220220        }
    221221    }
     
    225225        $skipped = false;
    226226        foreach ($this->dispatcher->getListeners($eventName) as $listener) {
     227            if (!$listener instanceof WrappedListener) { // #12845: a new listener was added during dispatch.
     228                continue;
     229            }
    227230            // Unwrap listener
    228231            $this->dispatcher->removeListener($eventName, $listener);
     
    284287            }
    285288            $info += array(
    286                 'type'  => 'Function',
     289                'type' => 'Function',
    287290                'function' => $listener,
    288                 'file'  => $file,
    289                 'line'  => $line,
     291                'file' => $file,
     292                'line' => $line,
    290293                'pretty' => $listener,
    291294            );
     
    304307            }
    305308            $info += array(
    306                 'type'  => 'Method',
     309                'type' => 'Method',
    307310                'class' => $class,
    308311                'method' => $listener[1],
    309                 'file'  => $file,
    310                 'line'  => $line,
     312                'file' => $file,
     313                'line' => $line,
    311314                'pretty' => $class.'::'.$listener[1],
    312315            );
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/WrappedListener.php

    r986149 r1098219  
    2626    private $stoppedPropagation;
    2727    private $stopwatch;
     28    private $dispatcher;
    2829
    29     public function __construct($listener, $name, Stopwatch $stopwatch)
     30    public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null)
    3031    {
    3132        $this->listener = $listener;
    3233        $this->name = $name;
    3334        $this->stopwatch = $stopwatch;
     35        $this->dispatcher = $dispatcher;
    3436        $this->called = false;
    3537        $this->stoppedPropagation = false;
     
    5759        $e = $this->stopwatch->start($this->name, 'event_listener');
    5860
    59         call_user_func($this->listener, $event, $eventName, $dispatcher);
     61        call_user_func($this->listener, $event, $eventName, $this->dispatcher ?: $dispatcher);
    6062
    6163        if ($e->isStarted()) {
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php

    r986149 r1098219  
    9292            }
    9393
     94            if ($def->isAbstract()) {
     95                throw new \InvalidArgumentException(sprintf('The service "%s" must not be abstract as event subscribers are lazy-loaded.', $id));
     96            }
     97
    9498            // We must assume that the class value has been correctly filled, even if the service is created by a factory
    95             $class = $def->getClass();
     99            $class = $container->getParameterBag()->resolveValue($def->getClass());
    96100
    97101            $refClass = new \ReflectionClass($class);
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Event.php

    r986149 r1098219  
    2121 * further listeners in your event listener.
    2222 *
    23  * @author  Guilherme Blanco <guilhermeblanco@hotmail.com>
    24  * @author  Jonathan Wage <jonwage@gmail.com>
    25  * @author  Roman Borschel <roman@code-factory.org>
    26  * @author  Bernhard Schussek <bschussek@gmail.com>
     23 * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
     24 * @author Jonathan Wage <jonwage@gmail.com>
     25 * @author Roman Borschel <roman@code-factory.org>
     26 * @author Bernhard Schussek <bschussek@gmail.com>
    2727 *
    2828 * @api
     
    3131{
    3232    /**
    33      * @var bool    Whether no further event listeners should be triggered
     33     * @var bool Whether no further event listeners should be triggered
    3434     */
    3535    private $propagationStopped = false;
     
    4848     * Returns whether further event listeners should be triggered.
    4949     *
    50      * @see Event::stopPropagation
    51      * @return bool    Whether propagation was already stopped for this event.
     50     * @see Event::stopPropagation()
     51     *
     52     * @return bool Whether propagation was already stopped for this event.
    5253     *
    5354     * @api
     
    7374
    7475    /**
    75      * Stores the EventDispatcher that dispatches this Event
     76     * Stores the EventDispatcher that dispatches this Event.
    7677     *
    7778     * @param EventDispatcherInterface $dispatcher
     
    8788
    8889    /**
    89      * Returns the EventDispatcher that dispatches this Event
     90     * Returns the EventDispatcher that dispatches this Event.
    9091     *
    9192     * @return EventDispatcherInterface
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php

    r986149 r1098219  
    1818 * manager.
    1919 *
    20  * @author  Guilherme Blanco <guilhermeblanco@hotmail.com>
    21  * @author  Jonathan Wage <jonwage@gmail.com>
    22  * @author  Roman Borschel <roman@code-factory.org>
    23  * @author  Bernhard Schussek <bschussek@gmail.com>
    24  * @author  Fabien Potencier <fabien@symfony.com>
    25  * @author  Jordi Boggiano <j.boggiano@seld.be>
    26  * @author  Jordan Alliot <jordan.alliot@gmail.com>
     20 * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
     21 * @author Jonathan Wage <jonwage@gmail.com>
     22 * @author Roman Borschel <roman@code-factory.org>
     23 * @author Bernhard Schussek <bschussek@gmail.com>
     24 * @author Fabien Potencier <fabien@symfony.com>
     25 * @author Jordi Boggiano <j.boggiano@seld.be>
     26 * @author Jordan Alliot <jordan.alliot@gmail.com>
    2727 *
    2828 * @api
     
    3434
    3535    /**
    36      * @see EventDispatcherInterface::dispatch
     36     * @see EventDispatcherInterface::dispatch()
    3737     *
    3838     * @api
     
    5757
    5858    /**
    59      * @see EventDispatcherInterface::getListeners
     59     * @see EventDispatcherInterface::getListeners()
    6060     */
    6161    public function getListeners($eventName = null)
     
    7979
    8080    /**
    81      * @see EventDispatcherInterface::hasListeners
     81     * @see EventDispatcherInterface::hasListeners()
    8282     */
    8383    public function hasListeners($eventName = null)
     
    8787
    8888    /**
    89      * @see EventDispatcherInterface::addListener
     89     * @see EventDispatcherInterface::addListener()
    9090     *
    9191     * @api
     
    9898
    9999    /**
    100      * @see EventDispatcherInterface::removeListener
     100     * @see EventDispatcherInterface::removeListener()
    101101     */
    102102    public function removeListener($eventName, $listener)
     
    114114
    115115    /**
    116      * @see EventDispatcherInterface::addSubscriber
     116     * @see EventDispatcherInterface::addSubscriber()
    117117     *
    118118     * @api
     
    134134
    135135    /**
    136      * @see EventDispatcherInterface::removeSubscriber
     136     * @see EventDispatcherInterface::removeSubscriber()
    137137     */
    138138    public function removeSubscriber(EventSubscriberInterface $subscriber)
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php

    r1014718 r1098219  
    2929     *                          the event is the name of the method that is
    3030     *                          invoked on listeners.
    31      * @param Event $event The event to pass to the event handlers/listeners.
     31     * @param Event  $event    The event to pass to the event handlers/listeners.
    3232     *                          If not supplied, an empty Event instance is created.
    3333     *
     
    9191     * @param string $eventName The name of the event
    9292     *
    93      * @return bool    true if the specified event has any listeners, false otherwise
     93     * @return bool true if the specified event has any listeners, false otherwise
    9494     */
    9595    public function hasListeners($eventName = null);
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventSubscriberInterface.php

    r986149 r1098219  
    1818 * returned events.
    1919 *
    20  * @author  Guilherme Blanco <guilhermeblanco@hotmail.com>
    21  * @author  Jonathan Wage <jonwage@gmail.com>
    22  * @author  Roman Borschel <roman@code-factory.org>
    23  * @author  Bernhard Schussek <bschussek@gmail.com>
     20 * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
     21 * @author Jonathan Wage <jonwage@gmail.com>
     22 * @author Roman Borschel <roman@code-factory.org>
     23 * @author Bernhard Schussek <bschussek@gmail.com>
    2424 *
    2525 * @api
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/GenericEvent.php

    r986149 r1098219  
    176176
    177177    /**
    178      * IteratorAggregate for iterating over the object like an array
     178     * IteratorAggregate for iterating over the object like an array.
    179179     *
    180180     * @return \ArrayIterator
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php

    r986149 r1098219  
    2121    /**
    2222     * The proxied dispatcher.
     23     *
    2324     * @var EventDispatcherInterface
    2425     */
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/LICENSE

    r986149 r1098219  
    1 Copyright (c) 2004-2014 Fabien Potencier
     1Copyright (c) 2004-2015 Fabien Potencier
    22
    33Permission is hereby granted, free of charge, to any person obtaining a copy
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/README.md

    r1014718 r1098219  
    22=========================
    33
    4 The Symfony2 EventDispatcher component implements the Mediator pattern in a
     4The Symfony EventDispatcher component implements the Mediator pattern in a
    55simple and effective way to make your projects truly extensible.
    66
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php

    r986149 r1098219  
    1818use Symfony\Component\EventDispatcher\EventSubscriberInterface;
    1919
    20 class ContainerAwareEventDispatcherTest extends \PHPUnit_Framework_TestCase
     20class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
    2121{
     22    protected function createEventDispatcher()
     23    {
     24        $container = new Container();
     25
     26        return new ContainerAwareEventDispatcher($container);
     27    }
     28
    2229    public function testAddAListenerService()
    2330    {
     
    233240    {
    234241        return array(
    235             'onEvent' => 'onEvent',
    236             'onEvent' => array('onEvent', 10),
    237242            'onEvent' => array('onEvent'),
    238243        );
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/Debug/TraceableEventDispatcherTest.php

    r1000678 r1098219  
    8787    }
    8888
     89    public function testGetCalledListenersNested()
     90    {
     91        $tdispatcher = null;
     92        $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
     93        $dispatcher->addListener('foo', function (Event $event, $eventName, $dispatcher) use (&$tdispatcher) {
     94            $tdispatcher = $dispatcher;
     95            $dispatcher->dispatch('bar');
     96        });
     97        $dispatcher->addListener('bar', function (Event $event) {});
     98        $dispatcher->dispatch('foo');
     99        $this->assertSame($dispatcher, $tdispatcher);
     100        $this->assertCount(2, $dispatcher->getCalledListeners());
     101    }
     102
    89103    public function testLogger()
    90104    {
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/DependencyInjection/RegisterListenersPassTest.php

    r1014718 r1098219  
    139139        $registerListenersPass->process($container);
    140140    }
     141
     142    /**
     143     * @expectedException \InvalidArgumentException
     144     * @expectedExceptionMessage The service "foo" must not be abstract as event subscribers are lazy-loaded.
     145     */
     146    public function testAbstractEventSubscriber()
     147    {
     148        $container = new ContainerBuilder();
     149        $container->register('foo', 'stdClass')->setAbstract(true)->addTag('kernel.event_subscriber', array());
     150        $container->register('event_dispatcher', 'stdClass');
     151
     152        $registerListenersPass = new RegisterListenersPass();
     153        $registerListenersPass->process($container);
     154    }
     155
     156    public function testEventSubscriberResolvableClassName()
     157    {
     158        $container = new ContainerBuilder();
     159
     160        $container->setParameter('subscriber.class', 'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService');
     161        $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', array());
     162        $container->register('event_dispatcher', 'stdClass');
     163
     164        $registerListenersPass = new RegisterListenersPass();
     165        $registerListenersPass->process($container);
     166
     167        $definition = $container->getDefinition('event_dispatcher');
     168        $expected_calls = array(
     169            array(
     170                'addSubscriberService',
     171                array(
     172                    'foo',
     173                    'Symfony\Component\EventDispatcher\Tests\DependencyInjection\SubscriberService',
     174                ),
     175            ),
     176        );
     177        $this->assertSame($expected_calls, $definition->getMethodCalls());
     178    }
     179
     180    /**
     181     * @expectedException \InvalidArgumentException
     182     * @expectedExceptionMessage You have requested a non-existent parameter "subscriber.class"
     183     */
     184    public function testEventSubscriberUnresolvableClassName()
     185    {
     186        $container = new ContainerBuilder();
     187        $container->register('foo', '%subscriber.class%')->addTag('kernel.event_subscriber', array());
     188        $container->register('event_dispatcher', 'stdClass');
     189
     190        $registerListenersPass = new RegisterListenersPass();
     191        $registerListenersPass->process($container);
     192    }
    141193}
    142194
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php

    r1000678 r1098219  
    1212namespace Symfony\Component\EventDispatcher\Tests;
    1313
    14 use Symfony\Component\EventDispatcher\Event;
    1514use Symfony\Component\EventDispatcher\EventDispatcher;
    16 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
    1715
    18 class EventDispatcherTest extends \PHPUnit_Framework_TestCase
     16class EventDispatcherTest extends AbstractEventDispatcherTest
    1917{
    20     /* Some pseudo events */
    21     const preFoo = 'pre.foo';
    22     const postFoo = 'post.foo';
    23     const preBar = 'pre.bar';
    24     const postBar = 'post.bar';
    25 
    26     /**
    27      * @var EventDispatcher
    28      */
    29     private $dispatcher;
    30 
    31     private $listener;
    32 
    33     protected function setUp()
     18    protected function createEventDispatcher()
    3419    {
    35         $this->dispatcher = new EventDispatcher();
    36         $this->listener = new TestEventListener();
    37     }
    38 
    39     protected function tearDown()
    40     {
    41         $this->dispatcher = null;
    42         $this->listener = null;
    43     }
    44 
    45     public function testInitialState()
    46     {
    47         $this->assertEquals(array(), $this->dispatcher->getListeners());
    48         $this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
    49         $this->assertFalse($this->dispatcher->hasListeners(self::postFoo));
    50     }
    51 
    52     public function testAddListener()
    53     {
    54         $this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo'));
    55         $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'));
    56         $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
    57         $this->assertTrue($this->dispatcher->hasListeners(self::postFoo));
    58         $this->assertCount(1, $this->dispatcher->getListeners(self::preFoo));
    59         $this->assertCount(1, $this->dispatcher->getListeners(self::postFoo));
    60         $this->assertCount(2, $this->dispatcher->getListeners());
    61     }
    62 
    63     public function testGetListenersSortsByPriority()
    64     {
    65         $listener1 = new TestEventListener();
    66         $listener2 = new TestEventListener();
    67         $listener3 = new TestEventListener();
    68         $listener1->name = '1';
    69         $listener2->name = '2';
    70         $listener3->name = '3';
    71 
    72         $this->dispatcher->addListener('pre.foo', array($listener1, 'preFoo'), -10);
    73         $this->dispatcher->addListener('pre.foo', array($listener2, 'preFoo'), 10);
    74         $this->dispatcher->addListener('pre.foo', array($listener3, 'preFoo'));
    75 
    76         $expected = array(
    77             array($listener2, 'preFoo'),
    78             array($listener3, 'preFoo'),
    79             array($listener1, 'preFoo'),
    80         );
    81 
    82         $this->assertSame($expected, $this->dispatcher->getListeners('pre.foo'));
    83     }
    84 
    85     public function testGetAllListenersSortsByPriority()
    86     {
    87         $listener1 = new TestEventListener();
    88         $listener2 = new TestEventListener();
    89         $listener3 = new TestEventListener();
    90         $listener4 = new TestEventListener();
    91         $listener5 = new TestEventListener();
    92         $listener6 = new TestEventListener();
    93 
    94         $this->dispatcher->addListener('pre.foo', $listener1, -10);
    95         $this->dispatcher->addListener('pre.foo', $listener2);
    96         $this->dispatcher->addListener('pre.foo', $listener3, 10);
    97         $this->dispatcher->addListener('post.foo', $listener4, -10);
    98         $this->dispatcher->addListener('post.foo', $listener5);
    99         $this->dispatcher->addListener('post.foo', $listener6, 10);
    100 
    101         $expected = array(
    102             'pre.foo'  => array($listener3, $listener2, $listener1),
    103             'post.foo' => array($listener6, $listener5, $listener4),
    104         );
    105 
    106         $this->assertSame($expected, $this->dispatcher->getListeners());
    107     }
    108 
    109     public function testDispatch()
    110     {
    111         $this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo'));
    112         $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'));
    113         $this->dispatcher->dispatch(self::preFoo);
    114         $this->assertTrue($this->listener->preFooInvoked);
    115         $this->assertFalse($this->listener->postFooInvoked);
    116         $this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $this->dispatcher->dispatch('noevent'));
    117         $this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $this->dispatcher->dispatch(self::preFoo));
    118         $event = new Event();
    119         $return = $this->dispatcher->dispatch(self::preFoo, $event);
    120         $this->assertEquals('pre.foo', $event->getName());
    121         $this->assertSame($event, $return);
    122     }
    123 
    124     public function testDispatchForClosure()
    125     {
    126         $invoked = 0;
    127         $listener = function () use (&$invoked) {
    128             $invoked++;
    129         };
    130         $this->dispatcher->addListener('pre.foo', $listener);
    131         $this->dispatcher->addListener('post.foo', $listener);
    132         $this->dispatcher->dispatch(self::preFoo);
    133         $this->assertEquals(1, $invoked);
    134     }
    135 
    136     public function testStopEventPropagation()
    137     {
    138         $otherListener = new TestEventListener();
    139 
    140         // postFoo() stops the propagation, so only one listener should
    141         // be executed
    142         // Manually set priority to enforce $this->listener to be called first
    143         $this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'), 10);
    144         $this->dispatcher->addListener('post.foo', array($otherListener, 'preFoo'));
    145         $this->dispatcher->dispatch(self::postFoo);
    146         $this->assertTrue($this->listener->postFooInvoked);
    147         $this->assertFalse($otherListener->postFooInvoked);
    148     }
    149 
    150     public function testDispatchByPriority()
    151     {
    152         $invoked = array();
    153         $listener1 = function () use (&$invoked) {
    154             $invoked[] = '1';
    155         };
    156         $listener2 = function () use (&$invoked) {
    157             $invoked[] = '2';
    158         };
    159         $listener3 = function () use (&$invoked) {
    160             $invoked[] = '3';
    161         };
    162         $this->dispatcher->addListener('pre.foo', $listener1, -10);
    163         $this->dispatcher->addListener('pre.foo', $listener2);
    164         $this->dispatcher->addListener('pre.foo', $listener3, 10);
    165         $this->dispatcher->dispatch(self::preFoo);
    166         $this->assertEquals(array('3', '2', '1'), $invoked);
    167     }
    168 
    169     public function testRemoveListener()
    170     {
    171         $this->dispatcher->addListener('pre.bar', $this->listener);
    172         $this->assertTrue($this->dispatcher->hasListeners(self::preBar));
    173         $this->dispatcher->removeListener('pre.bar', $this->listener);
    174         $this->assertFalse($this->dispatcher->hasListeners(self::preBar));
    175         $this->dispatcher->removeListener('notExists', $this->listener);
    176     }
    177 
    178     public function testAddSubscriber()
    179     {
    180         $eventSubscriber = new TestEventSubscriber();
    181         $this->dispatcher->addSubscriber($eventSubscriber);
    182         $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
    183         $this->assertTrue($this->dispatcher->hasListeners(self::postFoo));
    184     }
    185 
    186     public function testAddSubscriberWithPriorities()
    187     {
    188         $eventSubscriber = new TestEventSubscriber();
    189         $this->dispatcher->addSubscriber($eventSubscriber);
    190 
    191         $eventSubscriber = new TestEventSubscriberWithPriorities();
    192         $this->dispatcher->addSubscriber($eventSubscriber);
    193 
    194         $listeners = $this->dispatcher->getListeners('pre.foo');
    195         $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
    196         $this->assertCount(2, $listeners);
    197         $this->assertInstanceOf('Symfony\Component\EventDispatcher\Tests\TestEventSubscriberWithPriorities', $listeners[0][0]);
    198     }
    199 
    200     public function testAddSubscriberWithMultipleListeners()
    201     {
    202         $eventSubscriber = new TestEventSubscriberWithMultipleListeners();
    203         $this->dispatcher->addSubscriber($eventSubscriber);
    204 
    205         $listeners = $this->dispatcher->getListeners('pre.foo');
    206         $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
    207         $this->assertCount(2, $listeners);
    208         $this->assertEquals('preFoo2', $listeners[0][1]);
    209     }
    210 
    211     public function testRemoveSubscriber()
    212     {
    213         $eventSubscriber = new TestEventSubscriber();
    214         $this->dispatcher->addSubscriber($eventSubscriber);
    215         $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
    216         $this->assertTrue($this->dispatcher->hasListeners(self::postFoo));
    217         $this->dispatcher->removeSubscriber($eventSubscriber);
    218         $this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
    219         $this->assertFalse($this->dispatcher->hasListeners(self::postFoo));
    220     }
    221 
    222     public function testRemoveSubscriberWithPriorities()
    223     {
    224         $eventSubscriber = new TestEventSubscriberWithPriorities();
    225         $this->dispatcher->addSubscriber($eventSubscriber);
    226         $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
    227         $this->dispatcher->removeSubscriber($eventSubscriber);
    228         $this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
    229     }
    230 
    231     public function testRemoveSubscriberWithMultipleListeners()
    232     {
    233         $eventSubscriber = new TestEventSubscriberWithMultipleListeners();
    234         $this->dispatcher->addSubscriber($eventSubscriber);
    235         $this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
    236         $this->assertCount(2, $this->dispatcher->getListeners(self::preFoo));
    237         $this->dispatcher->removeSubscriber($eventSubscriber);
    238         $this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
    239     }
    240 
    241     public function testEventReceivesTheDispatcherInstance()
    242     {
    243         $dispatcher = null;
    244         $this->dispatcher->addListener('test', function ($event) use (&$dispatcher) {
    245             $dispatcher = $event->getDispatcher();
    246         });
    247         $this->dispatcher->dispatch('test');
    248         $this->assertSame($this->dispatcher, $dispatcher);
    249     }
    250 
    251     public function testEventReceivesTheDispatcherInstanceAsArgument()
    252     {
    253         $listener = new TestWithDispatcher();
    254         $this->dispatcher->addListener('test', array($listener, 'foo'));
    255         $this->assertNull($listener->name);
    256         $this->assertNull($listener->dispatcher);
    257         $this->dispatcher->dispatch('test');
    258         $this->assertEquals('test', $listener->name);
    259         $this->assertSame($this->dispatcher, $listener->dispatcher);
    260     }
    261 
    262     /**
    263      * @see https://bugs.php.net/bug.php?id=62976
    264      *
    265      * This bug affects:
    266      *  - The PHP 5.3 branch for versions < 5.3.18
    267      *  - The PHP 5.4 branch for versions < 5.4.8
    268      *  - The PHP 5.5 branch is not affected
    269      */
    270     public function testWorkaroundForPhpBug62976()
    271     {
    272         $dispatcher = new EventDispatcher();
    273         $dispatcher->addListener('bug.62976', new CallableClass());
    274         $dispatcher->removeListener('bug.62976', function () {});
    275         $this->assertTrue($dispatcher->hasListeners('bug.62976'));
    276     }
    277 
    278     public function testHasListenersWhenAddedCallbackListenerIsRemoved()
    279     {
    280         $listener = function () {};
    281         $this->dispatcher->addListener('foo', $listener);
    282         $this->dispatcher->removeListener('foo', $listener);
    283         $this->assertFalse($this->dispatcher->hasListeners());
    284     }
    285 
    286     public function testGetListenersWhenAddedCallbackListenerIsRemoved()
    287     {
    288         $listener = function () {};
    289         $this->dispatcher->addListener('foo', $listener);
    290         $this->dispatcher->removeListener('foo', $listener);
    291         $this->assertSame(array(), $this->dispatcher->getListeners());
    292     }
    293 
    294     public function testHasListenersWithoutEventsReturnsFalseAfterHasListenersWithEventHasBeenCalled()
    295     {
    296         $this->assertFalse($this->dispatcher->hasListeners('foo'));
    297         $this->assertFalse($this->dispatcher->hasListeners());
     20        return new EventDispatcher();
    29821    }
    29922}
    300 
    301 class CallableClass
    302 {
    303     public function __invoke()
    304     {
    305     }
    306 }
    307 
    308 class TestEventListener
    309 {
    310     public $preFooInvoked = false;
    311     public $postFooInvoked = false;
    312 
    313     /* Listener methods */
    314 
    315     public function preFoo(Event $e)
    316     {
    317         $this->preFooInvoked = true;
    318     }
    319 
    320     public function postFoo(Event $e)
    321     {
    322         $this->postFooInvoked = true;
    323 
    324         $e->stopPropagation();
    325     }
    326 }
    327 
    328 class TestWithDispatcher
    329 {
    330     public $name;
    331     public $dispatcher;
    332 
    333     public function foo(Event $e, $name, $dispatcher)
    334     {
    335         $this->name = $name;
    336         $this->dispatcher = $dispatcher;
    337     }
    338 }
    339 
    340 class TestEventSubscriber implements EventSubscriberInterface
    341 {
    342     public static function getSubscribedEvents()
    343     {
    344         return array('pre.foo' => 'preFoo', 'post.foo' => 'postFoo');
    345     }
    346 }
    347 
    348 class TestEventSubscriberWithPriorities implements EventSubscriberInterface
    349 {
    350     public static function getSubscribedEvents()
    351     {
    352         return array(
    353             'pre.foo' => array('preFoo', 10),
    354             'post.foo' => array('postFoo'),
    355             );
    356     }
    357 }
    358 
    359 class TestEventSubscriberWithMultipleListeners implements EventSubscriberInterface
    360 {
    361     public static function getSubscribedEvents()
    362     {
    363         return array('pre.foo' => array(
    364             array('preFoo1'),
    365             array('preFoo2', 10),
    366         ));
    367     }
    368 }
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventTest.php

    r986149 r1098219  
    6161    }
    6262
    63     public function testSetDispatcher()
     63    public function testLegacySetDispatcher()
    6464    {
     65        $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
    6566        $this->event->setDispatcher($this->dispatcher);
    6667        $this->assertSame($this->dispatcher, $this->event->getDispatcher());
    6768    }
    6869
    69     public function testGetDispatcher()
     70    public function testLegacyGetDispatcher()
    7071    {
     72        $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
    7173        $this->assertNull($this->event->getDispatcher());
    7274    }
    7375
    74     public function testGetName()
     76    public function testLegacyGetName()
    7577    {
     78        $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
    7679        $this->assertNull($this->event->getName());
    7780    }
    7881
    79     public function testSetName()
     82    public function testLegacySetName()
    8083    {
     84        $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
    8185        $this->event->setName('foo');
    8286        $this->assertEquals('foo', $this->event->getName());
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php

    r1000678 r1098219  
    5454
    5555    /**
    56      * Tests Event->getArgs()
     56     * Tests Event->getArgs().
    5757     */
    5858    public function testGetArguments()
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/composer.json

    r1000678 r1098219  
    2020    },
    2121    "require-dev": {
    22         "symfony/dependency-injection": "~2.0,<2.6.0",
    23         "symfony/config": "~2.0",
    24         "symfony/stopwatch": "~2.2",
     22        "symfony/dependency-injection": "~2.6",
     23        "symfony/expression-language": "~2.6",
     24        "symfony/config": "~2.0,>=2.0.5",
     25        "symfony/stopwatch": "~2.3",
    2526        "psr/log": "~1.0"
    2627    },
     
    3637    "extra": {
    3738        "branch-alias": {
    38             "dev-master": "2.5-dev"
     39            "dev-master": "2.6-dev"
    3940        }
    4041    }
  • mgrt/trunk/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/phpunit.xml.dist

    r986149 r1098219  
    77         bootstrap="vendor/autoload.php"
    88>
     9    <php>
     10        <!-- Silence E_USER_DEPRECATED (-16385 == -1 & ~E_USER_DEPRECATED) -->
     11        <ini name="error_reporting" value="-16385"/>
     12    </php>
    913    <testsuites>
    1014        <testsuite name="Symfony EventDispatcher Component Test Suite">
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php

    r986149 r1098219  
    2929     * Sets the indentation.
    3030     *
    31      * @param int     $num The amount of spaces to use for indentation of nested nodes.
     31     * @param int $num The amount of spaces to use for indentation of nested nodes.
    3232     */
    3333    public function setIndentation($num)
     
    3939     * Dumps a PHP value to YAML.
    4040     *
    41      * @param mixed   $input                  The PHP value
    42      * @param int     $inline                 The level where you switch to inline YAML
    43      * @param int     $indent                 The level of indentation (used internally)
    44      * @param bool    $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
    45      * @param bool    $objectSupport          true if object support is enabled, false otherwise
     41     * @param mixed $input                  The PHP value
     42     * @param int   $inline                 The level where you switch to inline YAML
     43     * @param int   $indent                 The level of indentation (used internally)
     44     * @param bool  $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
     45     * @param bool  $objectSupport          true if object support is enabled, false otherwise
    4646     *
    47      * @return string  The YAML representation of the PHP value
     47     * @return string The YAML representation of the PHP value
    4848     */
    4949    public function dump($input, $inline = 0, $indent = 0, $exceptionOnInvalidType = false, $objectSupport = false)
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php

    r1000678 r1098219  
    3333                                     "\x18",  "\x19",  "\x1a",  "\x1b",  "\x1c",  "\x1d",  "\x1e",  "\x1f",
    3434                                     "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9",);
    35     private static $escaped  = array('\\\\', '\\"', '\\\\', '\\"',
     35    private static $escaped = array('\\\\', '\\"', '\\\\', '\\"',
    3636                                     "\\0",   "\\x01", "\\x02", "\\x03", "\\x04", "\\x05", "\\x06", "\\a",
    3737                                     "\\b",   "\\t",   "\\n",   "\\v",   "\\f",   "\\r",   "\\x0e", "\\x0f",
     
    4545     * @param string $value A PHP value
    4646     *
    47      * @return bool    True if the value would require double quotes.
     47     * @return bool True if the value would require double quotes.
    4848     */
    4949    public static function requiresDoubleQuoting($value)
     
    6969     * @param string $value A PHP value
    7070     *
    71      * @return bool    True if the value would require single quotes.
     71     * @return bool True if the value would require single quotes.
    7272     */
    7373    public static function requiresSingleQuoting($value)
    7474    {
     75        // Determines if a PHP value is entirely composed of a value that would
     76        // require single quoting in YAML.
     77        if (in_array(strtolower($value), array('null', '~', 'true', 'false', 'y', 'n', 'yes', 'no', 'on', 'off'))) {
     78            return true;
     79        }
     80
     81        // Determines if the PHP value contains any single characters that would
     82        // cause it to require single quoting in YAML.
    7583        return preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ \- ? | < > = ! % @ ` ]/x', $value);
    7684    }
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/ParseException.php

    r986149 r1098219  
    1111
    1212namespace Symfony\Component\Yaml\Exception;
    13 
    14 if (!defined('JSON_UNESCAPED_UNICODE')) {
    15     define('JSON_UNESCAPED_SLASHES', 64);
    16     define('JSON_UNESCAPED_UNICODE', 256);
    17 }
    1813
    1914/**
     
    3429     * Constructor.
    3530     *
    36      * @param string    $message    The error message
    37      * @param int       $parsedLine The line where the error occurred
    38      * @param int       $snippet    The snippet of code near the problem
    39      * @param string    $parsedFile The file name where the error occurred
     31     * @param string     $message    The error message
     32     * @param int        $parsedLine The line where the error occurred
     33     * @param int        $snippet    The snippet of code near the problem
     34     * @param string     $parsedFile The file name where the error occurred
    4035     * @param \Exception $previous   The previous exception
    4136     */
     
    10196     * Gets the line where the error occurred.
    10297     *
    103      * @return int     The file line
     98     * @return int The file line
    10499     */
    105100    public function getParsedLine()
     
    111106     * Sets the line where the error occurred.
    112107     *
    113      * @param int     $parsedLine The file line
     108     * @param int $parsedLine The file line
    114109     */
    115110    public function setParsedLine($parsedLine)
     
    131126
    132127        if (null !== $this->parsedFile) {
    133             $this->message .= sprintf(' in %s', json_encode($this->parsedFile, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
     128            if (PHP_VERSION_ID >= 50400) {
     129                $jsonOptions = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
     130            } else {
     131                $jsonOptions = 0;
     132            }
     133            $this->message .= sprintf(' in %s', json_encode($this->parsedFile, $jsonOptions));
    134134        }
    135135
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php

    r1000678 r1098219  
    2626    private static $exceptionOnInvalidType = false;
    2727    private static $objectSupport = false;
     28    private static $objectForMap = false;
    2829
    2930    /**
    3031     * Converts a YAML string to a PHP array.
    3132     *
    32      * @param string  $value                  A YAML string
    33      * @param bool    $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
    34      * @param bool    $objectSupport          true if object support is enabled, false otherwise
    35      * @param array   $references             Mapping of variable names to values
     33     * @param string $value                  A YAML string
     34     * @param bool   $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
     35     * @param bool   $objectSupport          true if object support is enabled, false otherwise
     36     * @param bool   $objectForMap           true if maps should return a stdClass instead of array()
     37     * @param array  $references             Mapping of variable names to values
    3638     *
    3739     * @return array A PHP array representing the YAML string
     
    3941     * @throws ParseException
    4042     */
    41     public static function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $references = array())
     43    public static function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false, $references = array())
    4244    {
    4345        self::$exceptionOnInvalidType = $exceptionOnInvalidType;
    4446        self::$objectSupport = $objectSupport;
     47        self::$objectForMap = $objectForMap;
    4548
    4649        $value = trim($value);
     
    8487     * Dumps a given PHP variable to a YAML string.
    8588     *
    86      * @param mixed   $value                  The PHP variable to convert
    87      * @param bool    $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
    88      * @param bool    $objectSupport          true if object support is enabled, false otherwise
     89     * @param mixed $value                  The PHP variable to convert
     90     * @param bool  $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
     91     * @param bool  $objectSupport          true if object support is enabled, false otherwise
    8992     *
    9093     * @return string The YAML string representing the PHP array
     
    126129                    setlocale(LC_NUMERIC, 'C');
    127130                }
    128                 $repr = is_string($value) ? "'$value'" : (is_infinite($value) ? str_ireplace('INF', '.Inf', strval($value)) : strval($value));
    129 
     131                if (is_float($value)) {
     132                    $repr = strval($value);
     133                    if (is_infinite($value)) {
     134                        $repr = str_ireplace('INF', '.Inf', $repr);
     135                    } elseif (floor($value) == $value && $repr == $value) {
     136                        // Preserve float data type since storing a whole number will result in integer value.
     137                        $repr = '!!float '.$repr;
     138                    }
     139                } else {
     140                    $repr = is_string($value) ? "'$value'" : strval($value);
     141                }
    130142                if (false !== $locale) {
    131143                    setlocale(LC_NUMERIC, $locale);
     
    133145
    134146                return $repr;
     147            case '' == $value:
     148                return "''";
    135149            case Escaper::requiresDoubleQuoting($value):
    136150                return Escaper::escapeWithDoubleQuotes($value);
    137151            case Escaper::requiresSingleQuoting($value):
     152            case preg_match(self::getTimestampRegex(), $value):
    138153                return Escaper::escapeWithSingleQuotes($value);
    139             case '' == $value:
    140                 return "''";
    141             case preg_match(self::getTimestampRegex(), $value):
    142             case in_array(strtolower($value), array('null', '~', 'true', 'false')):
    143                 return "'$value'";
    144154            default:
    145155                return $value;
     
    150160     * Dumps a PHP array to a YAML string.
    151161     *
    152      * @param array   $value                  The PHP array to dump
    153      * @param bool    $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
    154      * @param bool    $objectSupport          true if object support is enabled, false otherwise
     162     * @param array $value                  The PHP array to dump
     163     * @param bool  $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
     164     * @param bool  $objectSupport          true if object support is enabled, false otherwise
    155165     *
    156166     * @return string The YAML string representing the PHP array
     
    183193     * Parses a scalar to a YAML string.
    184194     *
    185      * @param scalar $scalar
     195     * @param string $scalar
    186196     * @param string $delimiters
    187197     * @param array  $stringDelimiters
     
    235245     *
    236246     * @param string $scalar
    237      * @param int     &$i
     247     * @param int    &$i
    238248     *
    239249     * @return string A YAML string
     
    345355                    continue 2;
    346356                case '}':
     357                    if (self::$objectForMap) {
     358                        return (object) $output;
     359                    }
     360
    347361                    return $output;
    348362            }
     
    353367            // value
    354368            $done = false;
     369
    355370            while ($i < $len) {
    356371                switch ($mapping[$i]) {
     
    463478
    464479                        return;
     480                    case 0 === strpos($scalar, '!!float '):
     481                        return (float) substr($scalar, 8);
    465482                    case ctype_digit($scalar):
    466483                        $raw = $scalar;
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/LICENSE

    r986149 r1098219  
    1 Copyright (c) 2004-2014 Fabien Potencier
     1Copyright (c) 2004-2015 Fabien Potencier
    22
    33Permission is hereby granted, free of charge, to any person obtaining a copy
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php

    r1000678 r1098219  
    2323    const FOLDED_SCALAR_PATTERN = '(?P<separator>\||>)(?P<modifiers>\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P<comments> +#.*)?';
    2424
    25     private $offset         = 0;
    26     private $lines          = array();
    27     private $currentLineNb  = -1;
    28     private $currentLine    = '';
    29     private $refs           = array();
    30 
    31     /**
    32      * Constructor
    33      *
    34      * @param int     $offset The offset of YAML document (used for line numbers in error messages)
     25    private $offset = 0;
     26    private $lines = array();
     27    private $currentLineNb = -1;
     28    private $currentLine = '';
     29    private $refs = array();
     30
     31    /**
     32     * Constructor.
     33     *
     34     * @param int $offset The offset of YAML document (used for line numbers in error messages)
    3535     */
    3636    public function __construct($offset = 0)
     
    4242     * Parses a YAML string to a PHP value.
    4343     *
    44      * @param string  $value                  A YAML string
    45      * @param bool    $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
    46      * @param bool    $objectSupport          true if object support is enabled, false otherwise
    47      *
    48      * @return mixed  A PHP value
     44     * @param string $value                  A YAML string
     45     * @param bool   $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
     46     * @param bool   $objectSupport          true if object support is enabled, false otherwise
     47     * @param bool   $objectForMap           true if maps should return a stdClass instead of array()
     48     *
     49     * @return mixed A PHP value
    4950     *
    5051     * @throws ParseException If the YAML is not valid
    5152     */
    52     public function parse($value, $exceptionOnInvalidType = false, $objectSupport = false)
     53    public function parse($value, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false)
    5354    {
    5455        $this->currentLineNb = -1;
     
    9596                    $parser = new Parser($c);
    9697                    $parser->refs = & $this->refs;
    97                     $data[] = $parser->parse($this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport);
     98                    $data[] = $parser->parse($this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport, $objectForMap);
    9899                } else {
    99100                    if (isset($values['leadspaces'])
    100                         && ' ' == $values['leadspaces']
    101101                        && preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $values['value'], $matches)
    102102                    ) {
     
    108108                        $block = $values['value'];
    109109                        if ($this->isNextLineIndented()) {
    110                             $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + 2);
    111                         }
    112 
    113                         $data[] = $parser->parse($block, $exceptionOnInvalidType, $objectSupport);
     110                            $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + strlen($values['leadspaces']) + 1);
     111                        }
     112
     113                        $data[] = $parser->parse($block, $exceptionOnInvalidType, $objectSupport, $objectForMap);
    114114                    } else {
    115                         $data[] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport);
     115                        $data[] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport, $objectForMap);
    116116                    }
    117117                }
    118             } elseif (preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'],' #') || in_array($values['key'][0], array('"', "'")))) {
     118            } elseif (preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'")))) {
    119119                if ($context && 'sequence' == $context) {
    120120                    throw new ParseException('You cannot define a mapping item when in a sequence');
     
    123123
    124124                // force correct settings
    125                 Inline::parse(null, $exceptionOnInvalidType, $objectSupport, $this->refs);
     125                Inline::parse(null, $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs);
    126126                try {
    127127                    $key = Inline::parseScalar($values['key']);
     
    162162                        $parser = new Parser($c);
    163163                        $parser->refs = & $this->refs;
    164                         $parsed = $parser->parse($value, $exceptionOnInvalidType, $objectSupport);
     164                        $parsed = $parser->parse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap);
    165165
    166166                        if (!is_array($parsed)) {
     
    213213                        $parser = new Parser($c);
    214214                        $parser->refs = & $this->refs;
    215                         $value = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport);
     215                        $value = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport, $objectForMap);
    216216                        // Spec: Keys MUST be unique; first one wins.
    217217                        // But overwriting is allowed when a merge node is used in current block.
     
    221221                    }
    222222                } else {
    223                     $value = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport);
     223                    $value = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport, $objectForMap);
    224224                    // Spec: Keys MUST be unique; first one wins.
    225225                    // But overwriting is allowed when a merge node is used in current block.
     
    229229                }
    230230            } else {
     231                // multiple documents are not supported
     232                if ('---' === $this->currentLine) {
     233                    throw new ParseException('Multiple documents are not supported.');
     234                }
     235
    231236                // 1-liner optionally followed by newline
    232237                $lineCount = count($this->lines);
    233238                if (1 === $lineCount || (2 === $lineCount && empty($this->lines[1]))) {
    234239                    try {
    235                         $value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport, $this->refs);
     240                        $value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs);
    236241                    } catch (ParseException $e) {
    237242                        $e->setParsedLine($this->getRealCurrentLineNb() + 1);
     
    297302     * Returns the current line number (takes the offset into account).
    298303     *
    299      * @return int     The current line number
     304     * @return int The current line number
    300305     */
    301306    private function getRealCurrentLineNb()
     
    307312     * Returns the current line indentation.
    308313     *
    309      * @return int     The current line indentation
     314     * @return int The current line indentation
    310315     */
    311316    private function getCurrentLineIndentation()
     
    344349        }
    345350
    346         $data = array(substr($this->currentLine, $newIndent));
     351        $data = array();
     352        if ($this->getCurrentLineIndentation() >= $newIndent) {
     353            $data[] = substr($this->currentLine, $newIndent);
     354        } else {
     355            $this->moveToPreviousLine();
     356
     357            return;
     358        }
    347359
    348360        if ($inSequence && $oldLineIndentation === $newIndent && '-' === $data[0][0]) {
     
    367379            }
    368380
    369             if ($isItUnindentedCollection && !$this->isStringUnIndentedCollectionItem($this->currentLine)) {
     381            if ($isItUnindentedCollection && !$this->isStringUnIndentedCollectionItem($this->currentLine) && $newIndent === $indent) {
    370382                $this->moveToPreviousLine();
    371383                break;
     
    422434     * Parses a YAML value.
    423435     *
    424      * @param string  $value                  A YAML value
    425      * @param bool    $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise
    426      * @param bool    $objectSupport          True if object support is enabled, false otherwise
    427      *
    428      * @return mixed  A PHP value
     436     * @param string $value                  A YAML value
     437     * @param bool   $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise
     438     * @param bool   $objectSupport          True if object support is enabled, false otherwise
     439     * @param bool   $objectForMap           true if maps should return a stdClass instead of array()
     440     *
     441     * @return mixed A PHP value
    429442     *
    430443     * @throws ParseException When reference does not exist
    431444     */
    432     private function parseValue($value, $exceptionOnInvalidType, $objectSupport)
     445    private function parseValue($value, $exceptionOnInvalidType, $objectSupport, $objectForMap)
    433446    {
    434447        if (0 === strpos($value, '*')) {
     
    453466
    454467        try {
    455             return Inline::parse($value, $exceptionOnInvalidType, $objectSupport, $this->refs);
     468            return Inline::parse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs);
    456469        } catch (ParseException $e) {
    457470            $e->setParsedLine($this->getRealCurrentLineNb() + 1);
     
    465478     * Parses a folded scalar.
    466479     *
    467      * @param string  $separator   The separator that was used to begin this folded scalar (| or >)
    468      * @param string  $indicator   The indicator that was used to begin this folded scalar (+ or -)
    469      * @param int     $indentation The indentation that was used to begin this folded scalar
    470      *
    471      * @return string  The text value
     480     * @param string $separator   The separator that was used to begin this folded scalar (| or >)
     481     * @param string $indicator   The indicator that was used to begin this folded scalar (+ or -)
     482     * @param int    $indentation The indentation that was used to begin this folded scalar
     483     *
     484     * @return string The text value
    472485     */
    473486    private function parseFoldedScalar($separator, $indicator = '', $indentation = 0)
     
    546559     * Returns true if the next line is indented.
    547560     *
    548      * @return bool    Returns true if the next line is indented, false otherwise
     561     * @return bool Returns true if the next line is indented, false otherwise
    549562     */
    550563    private function isNextLineIndented()
     
    574587     * Returns true if the current line is blank or if it is a comment line.
    575588     *
    576      * @return bool    Returns true if the current line is empty or if it is a comment line, false otherwise
     589     * @return bool Returns true if the current line is empty or if it is a comment line, false otherwise
    577590     */
    578591    private function isCurrentLineEmpty()
     
    584597     * Returns true if the current line is blank.
    585598     *
    586      * @return bool    Returns true if the current line is blank, false otherwise
     599     * @return bool Returns true if the current line is blank, false otherwise
    587600     */
    588601    private function isCurrentLineBlank()
     
    594607     * Returns true if the current line is a comment line.
    595608     *
    596      * @return bool    Returns true if the current line is a comment line, false otherwise
     609     * @return bool Returns true if the current line is a comment line, false otherwise
    597610     */
    598611    private function isCurrentLineComment()
     
    617630        // strip YAML header
    618631        $count = 0;
    619         $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#su', '', $value, -1, $count);
     632        $value = preg_replace('#^\%YAML[: ][\d\.]+.*\n#u', '', $value, -1, $count);
    620633        $this->offset += $count;
    621634
     
    643656
    644657    /**
    645      * Returns true if the next line starts unindented collection
    646      *
    647      * @return bool    Returns true if the next line starts unindented collection, false otherwise
     658     * Returns true if the next line starts unindented collection.
     659     *
     660     * @return bool Returns true if the next line starts unindented collection, false otherwise
    648661     */
    649662    private function isNextLineUnIndentedCollection()
     
    675688
    676689    /**
    677      * Returns true if the string is un-indented collection item
    678      *
    679      * @return bool    Returns true if the string is un-indented collection item, false otherwise
     690     * Returns true if the string is un-indented collection item.
     691     *
     692     * @return bool Returns true if the string is un-indented collection item, false otherwise
    680693     */
    681694    private function isStringUnIndentedCollectionItem()
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/README.md

    r1014718 r1098219  
    77use Symfony\Component\Yaml\Yaml;
    88
    9 $array = Yaml::parse($file);
     9$array = Yaml::parse(file_get_contents(filename));
    1010
    1111print Yaml::dump($array);
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/DumperTest.php

    r1000678 r1098219  
    1212namespace Symfony\Component\Yaml\Tests;
    1313
    14 use Symfony\Component\Yaml\Yaml;
    1514use Symfony\Component\Yaml\Parser;
    1615use Symfony\Component\Yaml\Dumper;
     
    9796                } else {
    9897                    eval('$expected = '.trim($test['php']).';');
    99 
    100                     $this->assertEquals($expected, $this->parser->parse($this->dumper->dump($expected, 10)), $test['test']);
     98                    $this->assertSame($expected, $this->parser->parse($this->dumper->dump($expected, 10)), $test['test']);
    10199                }
    102100            }
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsSpecificationExamples.yml

    r986149 r1098219  
    464464php: |
    465465  array(
    466     'name'           => 'Mark McGwire',
     466    'name' => 'Mark McGwire',
    467467    'accomplishment' => "Mark set a major league home run record in 1998.\n",
    468     'stats'          => "65 Home Runs\n0.278 Batting Average\n"
     468    'stats' => "65 Home Runs\n0.278 Batting Average\n"
    469469  )
    470470---
     
    530530  negative infinity: -.inf
    531531  not a number: .NaN
     532  float as whole number: !!float 1
    532533php: |
    533534  array(
     
    537538    'negative infinity' => log(0),
    538539    'not a number' => -log(0),
     540    'float as whole number' => (float) 1
    539541  )
    540542---
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/unindentedCollections.yml

    r986149 r1098219  
    6161php: |
    6262    array('collection' => array('key' => array('a', 'b', 'c'), 'foo' => 'bar'))
     63---
     64test: Shortcut Key after unindented collection
     65brief: >
     66    Key/value after unindented collection
     67yaml: |
     68    collection:
     69    - key: foo
     70      foo: bar
     71php: |
     72    array('collection' => array(array('key' => 'foo', 'foo' => 'bar')))
     73---
     74test: Shortcut Key after unindented collection with custom spaces
     75brief: >
     76    Key/value after unindented collection
     77yaml: |
     78    collection:
     79    -  key: foo
     80       foo: bar
     81php: |
     82    array('collection' => array(array('key' => 'foo', 'foo' => 'bar')))
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php

    r1000678 r1098219  
    1616class InlineTest extends \PHPUnit_Framework_TestCase
    1717{
    18     public function testParse()
    19     {
    20         foreach ($this->getTestsForParse() as $yaml => $value) {
    21             $this->assertSame($value, Inline::parse($yaml), sprintf('::parse() converts an inline YAML to a PHP structure (%s)', $yaml));
    22         }
    23     }
    24 
    25     public function testDump()
    26     {
    27         $testsForDump = $this->getTestsForDump();
    28 
    29         foreach ($testsForDump as $yaml => $value) {
    30             $this->assertEquals($yaml, Inline::dump($value), sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml));
    31         }
    32 
    33         foreach ($this->getTestsForParse() as $value) {
    34             $this->assertEquals($value, Inline::parse(Inline::dump($value)), 'check consistency');
    35         }
    36 
    37         foreach ($testsForDump as $value) {
    38             $this->assertEquals($value, Inline::parse(Inline::dump($value)), 'check consistency');
    39         }
     18    /**
     19     * @dataProvider getTestsForParse
     20     */
     21    public function testParse($yaml, $value)
     22    {
     23        $this->assertSame($value, Inline::parse($yaml), sprintf('::parse() converts an inline YAML to a PHP structure (%s)', $yaml));
     24    }
     25
     26    /**
     27     * @dataProvider getTestsForParseWithMapObjects
     28     */
     29    public function testParseWithMapObjects($yaml, $value)
     30    {
     31        $actual = Inline::parse($yaml, false, false, true);
     32
     33        $this->assertSame(serialize($value), serialize($actual));
     34    }
     35
     36    /**
     37     * @dataProvider getTestsForDump
     38     */
     39    public function testDump($yaml, $value)
     40    {
     41        $this->assertEquals($yaml, Inline::dump($value), sprintf('::dump() converts a PHP structure to an inline YAML (%s)', $yaml));
     42
     43        $this->assertSame($value, Inline::parse(Inline::dump($value)), 'check consistency');
    4044    }
    4145
     
    121125    public function testParseReferences($yaml, $expected)
    122126    {
    123         $this->assertSame($expected, Inline::parse($yaml, false, false, array('var' => 'var-value')));
     127        $this->assertSame($expected, Inline::parse($yaml, false, false, false, array('var' => 'var-value')));
    124128    }
    125129
     
    145149            'c' => 'Brian',
    146150        );
    147         $this->assertSame(array($foo), Inline::parse('[*foo]', false, false, array('foo' => $foo)));
     151        $this->assertSame(array($foo), Inline::parse('[*foo]', false, false, false, array('foo' => $foo)));
    148152    }
    149153
     
    166170    }
    167171
    168     protected function getTestsForParse()
     172    public function getTestsForParse()
    169173    {
    170174        return array(
    171             '' => '',
    172             'null' => null,
    173             'false' => false,
    174             'true' => true,
    175             '12' => 12,
    176             '-12' => -12,
    177             '"quoted string"' => 'quoted string',
    178             "'quoted string'" => 'quoted string',
    179             '12.30e+02' => 12.30e+02,
    180             '0x4D2' => 0x4D2,
    181             '02333' => 02333,
    182             '.Inf' => -log(0),
    183             '-.Inf' => log(0),
    184             "'686e444'" => '686e444',
    185             '686e444' => 646e444,
    186             '123456789123456789123456789123456789' => '123456789123456789123456789123456789',
    187             '"foo\r\nbar"' => "foo\r\nbar",
    188             "'foo#bar'" => 'foo#bar',
    189             "'foo # bar'" => 'foo # bar',
    190             "'#cfcfcf'" => '#cfcfcf',
    191             '::form_base.html.twig' => '::form_base.html.twig',
    192 
    193             '2007-10-30' => mktime(0, 0, 0, 10, 30, 2007),
    194             '2007-10-30T02:59:43Z' => gmmktime(2, 59, 43, 10, 30, 2007),
    195             '2007-10-30 02:59:43 Z' => gmmktime(2, 59, 43, 10, 30, 2007),
    196             '1960-10-30 02:59:43 Z' => gmmktime(2, 59, 43, 10, 30, 1960),
    197             '1730-10-30T02:59:43Z' => gmmktime(2, 59, 43, 10, 30, 1730),
    198 
    199             '"a \\"string\\" with \'quoted strings inside\'"' => 'a "string" with \'quoted strings inside\'',
    200             "'a \"string\" with ''quoted strings inside'''" => 'a "string" with \'quoted strings inside\'',
     175            array('', ''),
     176            array('null', null),
     177            array('false', false),
     178            array('true', true),
     179            array('12', 12),
     180            array('-12', -12),
     181            array('"quoted string"', 'quoted string'),
     182            array("'quoted string'", 'quoted string'),
     183            array('12.30e+02', 12.30e+02),
     184            array('0x4D2', 0x4D2),
     185            array('02333', 02333),
     186            array('.Inf', -log(0)),
     187            array('-.Inf', log(0)),
     188            array("'686e444'", '686e444'),
     189            array('686e444', 646e444),
     190            array('123456789123456789123456789123456789', '123456789123456789123456789123456789'),
     191            array('"foo\r\nbar"', "foo\r\nbar"),
     192            array("'foo#bar'", 'foo#bar'),
     193            array("'foo # bar'", 'foo # bar'),
     194            array("'#cfcfcf'", '#cfcfcf'),
     195            array('::form_base.html.twig', '::form_base.html.twig'),
     196
     197            // Pre-YAML-1.2 booleans
     198            array("'y'", 'y'),
     199            array("'n'", 'n'),
     200            array("'yes'", 'yes'),
     201            array("'no'", 'no'),
     202            array("'on'", 'on'),
     203            array("'off'", 'off'),
     204
     205            array('2007-10-30', mktime(0, 0, 0, 10, 30, 2007)),
     206            array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
     207            array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
     208            array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
     209            array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)),
     210
     211            array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''),
     212            array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
    201213
    202214            // sequences
    203215            // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon
    204             '[foo, http://urls.are/no/mappings, false, null, 12]' => array('foo', 'http://urls.are/no/mappings', false, null, 12),
    205             '[  foo  ,   bar , false  ,  null     ,  12  ]' => array('foo', 'bar', false, null, 12),
    206             '[\'foo,bar\', \'foo bar\']' => array('foo,bar', 'foo bar'),
     216            array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)),
     217            array('[  foo  ,   bar , false  ,  null     ,  12  ]', array('foo', 'bar', false, null, 12)),
     218            array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
    207219
    208220            // mappings
    209             '{foo:bar,bar:foo,false:false,null:null,integer:12}' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12),
    210             '{ foo  : bar, bar : foo,  false  :   false,  null  :   null,  integer :  12  }' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12),
    211             '{foo: \'bar\', bar: \'foo: bar\'}' => array('foo' => 'bar', 'bar' => 'foo: bar'),
    212             '{\'foo\': \'bar\', "bar": \'foo: bar\'}' => array('foo' => 'bar', 'bar' => 'foo: bar'),
    213             '{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}' => array('foo\'' => 'bar', "bar\"" => 'foo: bar'),
    214             '{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}' => array('foo: ' => 'bar', "bar: " => 'foo: bar'),
     221            array('{foo:bar,bar:foo,false:false,null:null,integer:12}', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
     222            array('{ foo  : bar, bar : foo,  false  :   false,  null  :   null,  integer :  12  }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
     223            array('{foo: \'bar\', bar: \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),
     224            array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', array('foo' => 'bar', 'bar' => 'foo: bar')),
     225            array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', array('foo\'' => 'bar', "bar\"" => 'foo: bar')),
     226            array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', array('foo: ' => 'bar', "bar: " => 'foo: bar')),
    215227
    216228            // nested sequences and mappings
    217             '[foo, [bar, foo]]' => array('foo', array('bar', 'foo')),
    218             '[foo, {bar: foo}]' => array('foo', array('bar' => 'foo')),
    219             '{ foo: {bar: foo} }' => array('foo' => array('bar' => 'foo')),
    220             '{ foo: [bar, foo] }' => array('foo' => array('bar', 'foo')),
    221 
    222             '[  foo, [  bar, foo  ]  ]' => array('foo', array('bar', 'foo')),
    223 
    224             '[{ foo: {bar: foo} }]' => array(array('foo' => array('bar' => 'foo'))),
    225 
    226             '[foo, [bar, [foo, [bar, foo]], foo]]' => array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo')),
    227 
    228             '[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]' => array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo'))),
    229 
    230             '[foo, bar: { foo: bar }]' => array('foo', '1' => array('bar' => array('foo' => 'bar'))),
    231             '[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']' => array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container'),
    232         );
    233     }
    234 
    235     protected function getTestsForDump()
     229            array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
     230            array('[foo, {bar: foo}]', array('foo', array('bar' => 'foo'))),
     231            array('{ foo: {bar: foo} }', array('foo' => array('bar' => 'foo'))),
     232            array('{ foo: [bar, foo] }', array('foo' => array('bar', 'foo'))),
     233
     234            array('[  foo, [  bar, foo  ]  ]', array('foo', array('bar', 'foo'))),
     235
     236            array('[{ foo: {bar: foo} }]', array(array('foo' => array('bar' => 'foo')))),
     237
     238            array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
     239
     240            array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))),
     241
     242            array('[foo, bar: { foo: bar }]', array('foo', '1' => array('bar' => array('foo' => 'bar')))),
     243            array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
     244        );
     245    }
     246
     247    public function getTestsForParseWithMapObjects()
    236248    {
    237249        return array(
    238             'null' => null,
    239             'false' => false,
    240             'true' => true,
    241             '12' => 12,
    242             "'quoted string'" => 'quoted string',
    243             '12.30e+02' => 12.30e+02,
    244             '1234' => 0x4D2,
    245             '1243' => 02333,
    246             '.Inf' => -log(0),
    247             '-.Inf' => log(0),
    248             "'686e444'" => '686e444',
    249             '"foo\r\nbar"' => "foo\r\nbar",
    250             "'foo#bar'" => 'foo#bar',
    251             "'foo # bar'" => 'foo # bar',
    252             "'#cfcfcf'" => '#cfcfcf',
    253 
    254             "'a \"string\" with ''quoted strings inside'''" => 'a "string" with \'quoted strings inside\'',
    255 
    256             "'-dash'" => '-dash',
    257             "'-'" => '-',
     250            array('', ''),
     251            array('null', null),
     252            array('false', false),
     253            array('true', true),
     254            array('12', 12),
     255            array('-12', -12),
     256            array('"quoted string"', 'quoted string'),
     257            array("'quoted string'", 'quoted string'),
     258            array('12.30e+02', 12.30e+02),
     259            array('0x4D2', 0x4D2),
     260            array('02333', 02333),
     261            array('.Inf', -log(0)),
     262            array('-.Inf', log(0)),
     263            array("'686e444'", '686e444'),
     264            array('686e444', 646e444),
     265            array('123456789123456789123456789123456789', '123456789123456789123456789123456789'),
     266            array('"foo\r\nbar"', "foo\r\nbar"),
     267            array("'foo#bar'", 'foo#bar'),
     268            array("'foo # bar'", 'foo # bar'),
     269            array("'#cfcfcf'", '#cfcfcf'),
     270            array('::form_base.html.twig', '::form_base.html.twig'),
     271
     272            array('2007-10-30', mktime(0, 0, 0, 10, 30, 2007)),
     273            array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
     274            array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
     275            array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
     276            array('1730-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 1730)),
     277
     278            array('"a \\"string\\" with \'quoted strings inside\'"', 'a "string" with \'quoted strings inside\''),
     279            array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
    258280
    259281            // sequences
    260             '[foo, bar, false, null, 12]' => array('foo', 'bar', false, null, 12),
    261             '[\'foo,bar\', \'foo bar\']' => array('foo,bar', 'foo bar'),
     282            // urls are no key value mapping. see #3609. Valid yaml "key: value" mappings require a space after the colon
     283            array('[foo, http://urls.are/no/mappings, false, null, 12]', array('foo', 'http://urls.are/no/mappings', false, null, 12)),
     284            array('[  foo  ,   bar , false  ,  null     ,  12  ]', array('foo', 'bar', false, null, 12)),
     285            array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
    262286
    263287            // mappings
    264             '{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }' => array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12),
    265             '{ foo: bar, bar: \'foo: bar\' }' => array('foo' => 'bar', 'bar' => 'foo: bar'),
     288            array('{foo:bar,bar:foo,false:false,null:null,integer:12}', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
     289            array('{ foo  : bar, bar : foo,  false  :   false,  null  :   null,  integer :  12  }', (object) array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
     290            array('{foo: \'bar\', bar: \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),
     291            array('{\'foo\': \'bar\', "bar": \'foo: bar\'}', (object) array('foo' => 'bar', 'bar' => 'foo: bar')),
     292            array('{\'foo\'\'\': \'bar\', "bar\"": \'foo: bar\'}', (object) array('foo\'' => 'bar', "bar\"" => 'foo: bar')),
     293            array('{\'foo: \': \'bar\', "bar: ": \'foo: bar\'}', (object) array('foo: ' => 'bar', "bar: " => 'foo: bar')),
    266294
    267295            // nested sequences and mappings
    268             '[foo, [bar, foo]]' => array('foo', array('bar', 'foo')),
    269 
    270             '[foo, [bar, [foo, [bar, foo]], foo]]' => array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo')),
    271 
    272             '{ foo: { bar: foo } }' => array('foo' => array('bar' => 'foo')),
    273 
    274             '[foo, { bar: foo }]' => array('foo', array('bar' => 'foo')),
    275 
    276             '[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]' => array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo'))),
    277 
    278             '[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']' => array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container'),
     296            array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
     297            array('[foo, {bar: foo}]', array('foo', (object) array('bar' => 'foo'))),
     298            array('{ foo: {bar: foo} }', (object) array('foo' => (object) array('bar' => 'foo'))),
     299            array('{ foo: [bar, foo] }', (object) array('foo' => array('bar', 'foo'))),
     300
     301            array('[  foo, [  bar, foo  ]  ]', array('foo', array('bar', 'foo'))),
     302
     303            array('[{ foo: {bar: foo} }]', array((object) array('foo' => (object) array('bar' => 'foo')))),
     304
     305            array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
     306
     307            array('[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]', array('foo', (object) array('bar' => 'foo', 'foo' => array('foo', (object) array('bar' => 'foo'))), array('foo', (object) array('bar' => 'foo')))),
     308
     309            array('[foo, bar: { foo: bar }]', array('foo', '1' => (object) array('bar' => (object) array('foo' => 'bar')))),
     310            array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', (object) array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
     311
     312            array('{}', new \stdClass()),
     313            array('{ foo  : bar, bar : {}  }', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
     314            array('{ foo  : [], bar : {}  }', (object) array('foo' => array(), 'bar' => new \stdClass())),
     315            array('{foo: \'bar\', bar: {} }', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
     316            array('{\'foo\': \'bar\', "bar": {}}', (object) array('foo' => 'bar', 'bar' => new \stdClass())),
     317            array('{\'foo\': \'bar\', "bar": \'{}\'}', (object) array('foo' => 'bar', 'bar' => '{}')),
     318
     319            array('[foo, [{}, {}]]', array('foo', array(new \stdClass(), new \stdClass()))),
     320            array('[foo, [[], {}]]', array('foo', array(array(), new \stdClass()))),
     321            array('[foo, [[{}, {}], {}]]', array('foo', array(array(new \stdClass(), new \stdClass()), new \stdClass()))),
     322            array('[foo, {bar: {}}]', array('foo', '1' => (object) array('bar' => new \stdClass()))),
     323        );
     324    }
     325
     326    public function getTestsForDump()
     327    {
     328        return array(
     329            array('null', null),
     330            array('false', false),
     331            array('true', true),
     332            array('12', 12),
     333            array("'quoted string'", 'quoted string'),
     334            array('!!float 1230', 12.30e+02),
     335            array('1234', 0x4D2),
     336            array('1243', 02333),
     337            array('.Inf', -log(0)),
     338            array('-.Inf', log(0)),
     339            array("'686e444'", '686e444'),
     340            array('"foo\r\nbar"', "foo\r\nbar"),
     341            array("'foo#bar'", 'foo#bar'),
     342            array("'foo # bar'", 'foo # bar'),
     343            array("'#cfcfcf'", '#cfcfcf'),
     344
     345            array("'a \"string\" with ''quoted strings inside'''", 'a "string" with \'quoted strings inside\''),
     346
     347            array("'-dash'", '-dash'),
     348            array("'-'", '-'),
     349
     350            // Pre-YAML-1.2 booleans
     351            array("'y'", 'y'),
     352            array("'n'", 'n'),
     353            array("'yes'", 'yes'),
     354            array("'no'", 'no'),
     355            array("'on'", 'on'),
     356            array("'off'", 'off'),
     357
     358            // sequences
     359            array('[foo, bar, false, null, 12]', array('foo', 'bar', false, null, 12)),
     360            array('[\'foo,bar\', \'foo bar\']', array('foo,bar', 'foo bar')),
     361
     362            // mappings
     363            array('{ foo: bar, bar: foo, \'false\': false, \'null\': null, integer: 12 }', array('foo' => 'bar', 'bar' => 'foo', 'false' => false, 'null' => null, 'integer' => 12)),
     364            array('{ foo: bar, bar: \'foo: bar\' }', array('foo' => 'bar', 'bar' => 'foo: bar')),
     365
     366            // nested sequences and mappings
     367            array('[foo, [bar, foo]]', array('foo', array('bar', 'foo'))),
     368
     369            array('[foo, [bar, [foo, [bar, foo]], foo]]', array('foo', array('bar', array('foo', array('bar', 'foo')), 'foo'))),
     370
     371            array('{ foo: { bar: foo } }', array('foo' => array('bar' => 'foo'))),
     372
     373            array('[foo, { bar: foo }]', array('foo', array('bar' => 'foo'))),
     374
     375            array('[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))),
     376
     377            array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')),
    279378        );
    280379    }
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParseExceptionTest.php

    r986149 r1098219  
    1313
    1414use Symfony\Component\Yaml\Exception\ParseException;
    15 use Symfony\Component\Yaml\Yaml;
    1615
    1716class ParseExceptionTest extends \PHPUnit_Framework_TestCase
     
    2019    {
    2120        $exception = new ParseException('Error message', 42, 'foo: bar', '/var/www/app/config.yml');
    22         if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
     21        if (PHP_VERSION_ID >= 50400) {
    2322            $message = 'Error message in "/var/www/app/config.yml" at line 42 (near "foo: bar")';
    2423        } else {
     
    2827        $this->assertEquals($message, $exception->getMessage());
    2928    }
     29
     30    public function testGetMessageWithUnicodeInFilename()
     31    {
     32        $exception = new ParseException('Error message', 42, 'foo: bar', 'äöü.yml');
     33        if (PHP_VERSION_ID >= 50400) {
     34            $message = 'Error message in "äöü.yml" at line 42 (near "foo: bar")';
     35        } else {
     36            $message = 'Error message in "\u00e4\u00f6\u00fc.yml" at line 42 (near "foo: bar")';
     37        }
     38
     39        $this->assertEquals($message, $exception->getMessage());
     40    }
    3041}
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php

    r1000678 r1098219  
    465465
    466466    /**
    467      *
    468467     * @expectedException \Symfony\Component\Yaml\Exception\ParseException
    469      *
    470468     */
    471469    public function testUnindentedCollectionException()
     
    481479
    482480        $this->parser->parse($yaml);
     481    }
     482
     483    /**
     484     * @expectedException \Symfony\Component\Yaml\Exception\ParseException
     485     */
     486    public function testShortcutKeyUnindentedCollectionException()
     487    {
     488        $yaml = <<<EOF
     489
     490collection:
     491-  key: foo
     492  foo: bar
     493
     494EOF;
     495
     496        $this->parser->parse($yaml);
     497    }
     498
     499    /**
     500     * @expectedException \Symfony\Component\Yaml\Exception\ParseException
     501     * @expectedExceptionMessage Multiple documents are not supported.
     502     */
     503    public function testMultipleDocumentsNotSupportedException()
     504    {
     505        Yaml::parse(<<<EOL
     506# Ranking of 1998 home runs
     507---
     508- Mark McGwire
     509- Sammy Sosa
     510- Ken Griffey
     511
     512# Team ranking
     513---
     514- Chicago Cubs
     515- St Louis Cardinals
     516EOL
     517        );
    483518    }
    484519
     
    625660    {
    626661        $this->assertEquals(array(array(
    627             'title'   => 'some title',
     662            'title' => 'some title',
    628663            'content' => <<<EOT
    629664# comment 1
     
    679714        ));
    680715    }
     716
     717    public function testYamlDirective()
     718    {
     719        $yaml = <<<EOF
     720%YAML 1.2
     721---
     722foo: 1
     723bar: 2
     724EOF;
     725        $this->assertEquals(array('foo' => 1, 'bar' => 2), $this->parser->parse($yaml));
     726    }
    681727}
    682728
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php

    r1000678 r1098219  
    6060
    6161    /**
    62      * Unescapes a character that was found in a double-quoted string
     62     * Unescapes a character that was found in a double-quoted string.
    6363     *
    6464     * @param string $value An escaped character
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php

    r986149 r1098219  
    3939     * as an input is a deprecated feature and will be removed in 3.0.
    4040     *
    41      * @param string  $input                  Path to a YAML file or a string containing YAML
    42      * @param bool    $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise
    43      * @param bool    $objectSupport          True if object support is enabled, false otherwise
     41     * @param string $input                  Path to a YAML file or a string containing YAML
     42     * @param bool   $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise
     43     * @param bool   $objectSupport          True if object support is enabled, false otherwise
    4444     *
    4545     * @return array The YAML converted to a PHP array
     
    8181     * to convert the array into friendly YAML.
    8282     *
    83      * @param array   $array                  PHP array
    84      * @param int     $inline                 The level where you switch to inline YAML
    85      * @param int     $indent                 The amount of spaces to use for indentation of nested nodes.
    86      * @param bool    $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
    87      * @param bool    $objectSupport          true if object support is enabled, false otherwise
     83     * @param array $array                  PHP array
     84     * @param int   $inline                 The level where you switch to inline YAML
     85     * @param int   $indent                 The amount of spaces to use for indentation of nested nodes.
     86     * @param bool  $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise
     87     * @param bool  $objectSupport          true if object support is enabled, false otherwise
    8888     *
    8989     * @return string A YAML string representing the original PHP array
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/composer.json

    r986149 r1098219  
    2626    "extra": {
    2727        "branch-alias": {
    28             "dev-master": "2.5-dev"
     28            "dev-master": "2.6-dev"
    2929        }
    3030    }
  • mgrt/trunk/vendor/symfony/yaml/Symfony/Component/Yaml/phpunit.xml.dist

    r986149 r1098219  
    77         bootstrap="vendor/autoload.php"
    88>
     9    <php>
     10        <!-- php -r 'echo -1 & ~E_USER_DEPRECATED;' -->
     11        <ini name="error_reporting" value="-16385"/>
     12    </php>
    913    <testsuites>
    1014        <testsuite name="Symfony Yaml Component Test Suite">
Note: See TracChangeset for help on using the changeset viewer.