|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Puli; |
| 4 | + |
| 5 | +use Puli\Discovery\Api\Discovery; |
| 6 | +use Puli\Discovery\Binding\Initializer\ResourceBindingInitializer; |
| 7 | +use Puli\Discovery\JsonDiscovery; |
| 8 | +use Puli\Manager\Api\Server\ServerCollection; |
| 9 | +use Puli\Repository\Api\ResourceRepository; |
| 10 | +use Puli\Repository\JsonRepository; |
| 11 | +use Puli\UrlGenerator\Api\UrlGenerator; |
| 12 | +use Puli\UrlGenerator\DiscoveryUrlGenerator; |
| 13 | +use RuntimeException; |
| 14 | + |
| 15 | +/** |
| 16 | + * Creates Puli's core services. |
| 17 | + * |
| 18 | + * This class was auto-generated by Puli. |
| 19 | + * |
| 20 | + * IMPORTANT: Before modifying the code below, set the "factory.auto-generate" |
| 21 | + * configuration key to false: |
| 22 | + * |
| 23 | + * $ puli config factory.auto-generate false |
| 24 | + * |
| 25 | + * Otherwise any modifications will be overwritten! |
| 26 | + */ |
| 27 | +class GeneratedPuliFactory |
| 28 | +{ |
| 29 | + /** |
| 30 | + * Creates the resource repository. |
| 31 | + * |
| 32 | + * @return ResourceRepository The created resource repository. |
| 33 | + */ |
| 34 | + public function createRepository() |
| 35 | + { |
| 36 | + if (!interface_exists('Puli\Repository\Api\ResourceRepository')) { |
| 37 | + throw new RuntimeException('Please install puli/repository to create ResourceRepository instances.'); |
| 38 | + } |
| 39 | + |
| 40 | + $repo = new JsonRepository(__DIR__.'/path-mappings.json', __DIR__.'/..', true); |
| 41 | + |
| 42 | + return $repo; |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * Creates the resource discovery. |
| 47 | + * |
| 48 | + * @param ResourceRepository $repo The resource repository to read from. |
| 49 | + * |
| 50 | + * @return Discovery The created discovery. |
| 51 | + */ |
| 52 | + public function createDiscovery(ResourceRepository $repo) |
| 53 | + { |
| 54 | + if (!interface_exists('Puli\Discovery\Api\Discovery')) { |
| 55 | + throw new RuntimeException('Please install puli/discovery to create Discovery instances.'); |
| 56 | + } |
| 57 | + |
| 58 | + $discovery = new JsonDiscovery(__DIR__.'/bindings.json', array( |
| 59 | + new ResourceBindingInitializer($repo), |
| 60 | + )); |
| 61 | + |
| 62 | + return $discovery; |
| 63 | + } |
| 64 | + |
| 65 | + /** |
| 66 | + * Creates the URL generator. |
| 67 | + * |
| 68 | + * @param Discovery $discovery The discovery to read from. |
| 69 | + * |
| 70 | + * @return UrlGenerator The created URL generator. |
| 71 | + */ |
| 72 | + public function createUrlGenerator(Discovery $discovery) |
| 73 | + { |
| 74 | + if (!interface_exists('Puli\UrlGenerator\Api\UrlGenerator')) { |
| 75 | + throw new RuntimeException('Please install puli/url-generator to create UrlGenerator instances.'); |
| 76 | + } |
| 77 | + |
| 78 | + $generator = new DiscoveryUrlGenerator($discovery, array()); |
| 79 | + |
| 80 | + return $generator; |
| 81 | + } |
| 82 | + |
| 83 | + /** |
| 84 | + * Returns the order in which the installed packages should be loaded |
| 85 | + * according to the override statements. |
| 86 | + * |
| 87 | + * @return string[] The sorted package names. |
| 88 | + */ |
| 89 | + public function getPackageOrder() |
| 90 | + { |
| 91 | + $order = array( |
| 92 | + 'swader/diffbot-php-client', |
| 93 | + 'clue/stream-filter', |
| 94 | + 'doctrine/annotations', |
| 95 | + 'doctrine/instantiator', |
| 96 | + 'doctrine/lexer', |
| 97 | + 'guzzle/guzzle', |
| 98 | + 'guzzlehttp/guzzle', |
| 99 | + 'guzzlehttp/promises', |
| 100 | + 'guzzlehttp/psr7', |
| 101 | + 'jms/metadata', |
| 102 | + 'jms/parser-lib', |
| 103 | + 'jms/serializer', |
| 104 | + 'justinrainbow/json-schema', |
| 105 | + 'myclabs/deep-copy', |
| 106 | + 'nesbot/carbon', |
| 107 | + 'php-http/client-common', |
| 108 | + 'php-http/discovery', |
| 109 | + 'php-http/guzzle6-adapter', |
| 110 | + 'php-http/httplug', |
| 111 | + 'php-http/message', |
| 112 | + 'php-http/message-factory', |
| 113 | + 'php-http/promise', |
| 114 | + 'phpcollection/phpcollection', |
| 115 | + 'phpdocumentor/reflection-docblock', |
| 116 | + 'phpoption/phpoption', |
| 117 | + 'phpspec/prophecy', |
| 118 | + 'phpunit/php-code-coverage', |
| 119 | + 'phpunit/php-file-iterator', |
| 120 | + 'phpunit/php-text-template', |
| 121 | + 'phpunit/php-timer', |
| 122 | + 'phpunit/php-token-stream', |
| 123 | + 'phpunit/phpunit', |
| 124 | + 'phpunit/phpunit-mock-objects', |
| 125 | + 'psr/http-message', |
| 126 | + 'psr/log', |
| 127 | + 'puli/composer-plugin', |
| 128 | + 'puli/discovery', |
| 129 | + 'puli/repository', |
| 130 | + 'puli/url-generator', |
| 131 | + 'ramsey/uuid', |
| 132 | + 'scrutinizer/ocular', |
| 133 | + 'sebastian/code-unit-reverse-lookup', |
| 134 | + 'sebastian/comparator', |
| 135 | + 'sebastian/diff', |
| 136 | + 'sebastian/environment', |
| 137 | + 'sebastian/exporter', |
| 138 | + 'sebastian/global-state', |
| 139 | + 'sebastian/recursion-context', |
| 140 | + 'sebastian/resource-operations', |
| 141 | + 'sebastian/version', |
| 142 | + 'seld/jsonlint', |
| 143 | + 'symfony/console', |
| 144 | + 'symfony/event-dispatcher', |
| 145 | + 'symfony/polyfill-mbstring', |
| 146 | + 'symfony/process', |
| 147 | + 'symfony/translation', |
| 148 | + 'symfony/var-dumper', |
| 149 | + 'symfony/yaml', |
| 150 | + 'webmozart/assert', |
| 151 | + 'webmozart/expression', |
| 152 | + 'webmozart/glob', |
| 153 | + 'webmozart/json', |
| 154 | + 'webmozart/path-util', |
| 155 | + ); |
| 156 | + |
| 157 | + return $order; |
| 158 | + } |
| 159 | +} |
0 commit comments