diff options
author | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-04 17:50:34 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas.loeuillet@gmail.com> | 2013-08-04 17:50:34 +0200 |
commit | 46b77928f746a4231d064774b5b67fd892c7ce86 (patch) | |
tree | e3ea690b3f0def1744ddae758923cf92171ef985 /vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper | |
parent | 68abd9c71b1d2f7bb2e9d21819584d1d15005b25 (diff) | |
download | wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.tar.gz wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.tar.zst wallabag-46b77928f746a4231d064774b5b67fd892c7ce86.zip |
rm vendor
Diffstat (limited to 'vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper')
3 files changed, 0 insertions, 209 deletions
diff --git a/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php b/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php deleted file mode 100644 index 4739bd83..00000000 --- a/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Routing\Generator\Dumper; | ||
13 | |||
14 | use Symfony\Component\Routing\RouteCollection; | ||
15 | |||
16 | /** | ||
17 | * GeneratorDumper is the base class for all built-in generator dumpers. | ||
18 | * | ||
19 | * @author Fabien Potencier <fabien@symfony.com> | ||
20 | */ | ||
21 | abstract class GeneratorDumper implements GeneratorDumperInterface | ||
22 | { | ||
23 | /** | ||
24 | * @var RouteCollection | ||
25 | */ | ||
26 | private $routes; | ||
27 | |||
28 | /** | ||
29 | * Constructor. | ||
30 | * | ||
31 | * @param RouteCollection $routes The RouteCollection to dump | ||
32 | */ | ||
33 | public function __construct(RouteCollection $routes) | ||
34 | { | ||
35 | $this->routes = $routes; | ||
36 | } | ||
37 | |||
38 | /** | ||
39 | * {@inheritdoc} | ||
40 | */ | ||
41 | public function getRoutes() | ||
42 | { | ||
43 | return $this->routes; | ||
44 | } | ||
45 | } | ||
diff --git a/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php b/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php deleted file mode 100644 index deb0c0a2..00000000 --- a/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Routing\Generator\Dumper; | ||
13 | |||
14 | use Symfony\Component\Routing\RouteCollection; | ||
15 | |||
16 | /** | ||
17 | * GeneratorDumperInterface is the interface that all generator dumper classes must implement. | ||
18 | * | ||
19 | * @author Fabien Potencier <fabien@symfony.com> | ||
20 | * | ||
21 | * @api | ||
22 | */ | ||
23 | interface GeneratorDumperInterface | ||
24 | { | ||
25 | /** | ||
26 | * Dumps a set of routes to a string representation of executable code | ||
27 | * that can then be used to generate a URL of such a route. | ||
28 | * | ||
29 | * @param array $options An array of options | ||
30 | * | ||
31 | * @return string Executable code | ||
32 | */ | ||
33 | public function dump(array $options = array()); | ||
34 | |||
35 | /** | ||
36 | * Gets the routes to dump. | ||
37 | * | ||
38 | * @return RouteCollection A RouteCollection instance | ||
39 | */ | ||
40 | public function getRoutes(); | ||
41 | } | ||
diff --git a/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php b/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php deleted file mode 100644 index 42cd9108..00000000 --- a/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Routing\Generator\Dumper; | ||
13 | |||
14 | /** | ||
15 | * PhpGeneratorDumper creates a PHP class able to generate URLs for a given set of routes. | ||
16 | * | ||
17 | * @author Fabien Potencier <fabien@symfony.com> | ||
18 | * @author Tobias Schultze <http://tobion.de> | ||
19 | * | ||
20 | * @api | ||
21 | */ | ||
22 | class PhpGeneratorDumper extends GeneratorDumper | ||
23 | { | ||
24 | /** | ||
25 | * Dumps a set of routes to a PHP class. | ||
26 | * | ||
27 | * Available options: | ||
28 | * | ||
29 | * * class: The class name | ||
30 | * * base_class: The base class name | ||
31 | * | ||
32 | * @param array $options An array of options | ||
33 | * | ||
34 | * @return string A PHP class representing the generator class | ||
35 | * | ||
36 | * @api | ||
37 | */ | ||
38 | public function dump(array $options = array()) | ||
39 | { | ||
40 | $options = array_merge(array( | ||
41 | 'class' => 'ProjectUrlGenerator', | ||
42 | 'base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator', | ||
43 | ), $options); | ||
44 | |||
45 | return <<<EOF | ||
46 | <?php | ||
47 | |||
48 | use Symfony\Component\Routing\RequestContext; | ||
49 | use Symfony\Component\Routing\Exception\RouteNotFoundException; | ||
50 | use Psr\Log\LoggerInterface; | ||
51 | |||
52 | /** | ||
53 | * {$options['class']} | ||
54 | * | ||
55 | * This class has been auto-generated | ||
56 | * by the Symfony Routing Component. | ||
57 | */ | ||
58 | class {$options['class']} extends {$options['base_class']} | ||
59 | { | ||
60 | static private \$declaredRoutes = {$this->generateDeclaredRoutes()}; | ||
61 | |||
62 | /** | ||
63 | * Constructor. | ||
64 | */ | ||
65 | public function __construct(RequestContext \$context, LoggerInterface \$logger = null) | ||
66 | { | ||
67 | \$this->context = \$context; | ||
68 | \$this->logger = \$logger; | ||
69 | } | ||
70 | |||
71 | {$this->generateGenerateMethod()} | ||
72 | } | ||
73 | |||
74 | EOF; | ||
75 | } | ||
76 | |||
77 | /** | ||
78 | * Generates PHP code representing an array of defined routes | ||
79 | * together with the routes properties (e.g. requirements). | ||
80 | * | ||
81 | * @return string PHP code | ||
82 | */ | ||
83 | private function generateDeclaredRoutes() | ||
84 | { | ||
85 | $routes = "array(\n"; | ||
86 | foreach ($this->getRoutes()->all() as $name => $route) { | ||
87 | $compiledRoute = $route->compile(); | ||
88 | |||
89 | $properties = array(); | ||
90 | $properties[] = $compiledRoute->getVariables(); | ||
91 | $properties[] = $route->getDefaults(); | ||
92 | $properties[] = $route->getRequirements(); | ||
93 | $properties[] = $compiledRoute->getTokens(); | ||
94 | $properties[] = $compiledRoute->getHostTokens(); | ||
95 | |||
96 | $routes .= sprintf(" '%s' => %s,\n", $name, str_replace("\n", '', var_export($properties, true))); | ||
97 | } | ||
98 | $routes .= ' )'; | ||
99 | |||
100 | return $routes; | ||
101 | } | ||
102 | |||
103 | /** | ||
104 | * Generates PHP code representing the `generate` method that implements the UrlGeneratorInterface. | ||
105 | * | ||
106 | * @return string PHP code | ||
107 | */ | ||
108 | private function generateGenerateMethod() | ||
109 | { | ||
110 | return <<<EOF | ||
111 | public function generate(\$name, \$parameters = array(), \$referenceType = self::ABSOLUTE_PATH) | ||
112 | { | ||
113 | if (!isset(self::\$declaredRoutes[\$name])) { | ||
114 | throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', \$name)); | ||
115 | } | ||
116 | |||
117 | list(\$variables, \$defaults, \$requirements, \$tokens, \$hostTokens) = self::\$declaredRoutes[\$name]; | ||
118 | |||
119 | return \$this->doGenerate(\$variables, \$defaults, \$requirements, \$tokens, \$parameters, \$name, \$referenceType, \$hostTokens); | ||
120 | } | ||
121 | EOF; | ||
122 | } | ||
123 | } | ||