dumpCollection example

if ($definition->isSynthetic()) {
      $service['synthetic'] = TRUE;
    }

    if ($definition->isLazy()) {
      $service['lazy'] = TRUE;
    }

    if ($definition->getArguments()) {
      $arguments = $definition->getArguments();
      $service['arguments'] = $this->dumpCollection($arguments);
      $service['arguments_count'] = count($arguments);
    }
    else {
      $service['arguments_count'] = 0;
    }

    if ($definition->getProperties()) {
      $service['properties'] = $this->dumpCollection($definition->getProperties());
    }

    if ($definition->getMethodCalls()) {
      
return parent::getArray();
  }

  /** * {@inheritdoc} */
  protected function dumpCollection($collection, &$resolve = FALSE) {
    $code = [];

    foreach ($collection as $key => $value) {
      if (is_array($value)) {
        $code[$key] = $this->dumpCollection($value);
      }
      else {
        $code[$key] = $this->dumpValue($value);
      }
    }

    return $code;
  }

  /** * {@inheritdoc} */

    public function testGrouping(array $routes$expected)
    {
        $collection = new StaticPrefixCollection('/');

        foreach ($routes as $route) {
            [$path$name] = $route;
            $staticPrefix = (new Route($path))->compile()->getStaticPrefix();
            $collection->addRoute($staticPrefix[$name]);
        }

        $dumped = $this->dumpCollection($collection);
        $this->assertEquals($expected$dumped);
    }

    public static function routeProvider()
    {
        return [
            'Simple - not nested' => [
                [
                    ['/', 'root'],
                    ['/prefix/segment/', 'prefix_segment'],
                    ['/leading/segment/', 'leading_segment'],
                ],
Home | Imprint | This part of the site doesn't use cookies.