{"action":"created","comment":{"url":"https://api.github.com/repos/damejidlo/cargo-client/pulls/comments/26438033","id":26438033,"diff_hunk":"@@ -43,37 +91,45 @@ public function loadConfiguration()\n \t\t\tValidators::assertField($config, 'apiBaseUrl', 'pattern:https\\:\\/\\/.*', $message);\n \t\t}\n \n-\t\t$builder->addDefinition($this->prefix('consumer'))\n-\t\t\t->setClass(Consumer::class, [$config['appId'], $config['secret']]);\n+\t\t$consumerDefinition = $builder->addDefinition($consumerName = $this->prefix(\"consumer$name\"))\n+\t\t\t->setClass(Consumer::class, [$config['appId'], $config['secret']])\n+\t\t\t->setAutowired(FALSE);\n \n \t\tif (!array_key_exists('requestFactory', $config)) {\n-\t\t\t$builder->addDefinition($this->prefix('requestFactory'))\n-\t\t\t\t->setClass(RequestFactory::class)\n-\t\t\t\t->setArguments([$config['apiBaseUrl']]);\n+\t\t\t$requestFactoryDefinition = $builder->addDefinition($requestFactoryName = $this->prefix(\"requestFactory$name\"))\n+\t\t\t\t->setClass(RequestFactory::class, [$config['apiBaseUrl']])\n+\t\t\t\t->setAutowired(FALSE);\n \n \t\t} else {\n \t\t\t// touch reference to validate it\n-\t\t\tif (!$builder->getServiceName($config['requestFactory'])) {\n+\t\t\tif (!$builder->getServiceName($requestFactoryDefinition = $config['requestFactory'])) {\n \t\t\t\tthrow new InvalidConfigException(\"Invalid reference to service implementing IRequestFactory given: $config[requestFactory]\");\n \t\t\t}\n \t\t}\n \n-\t\tif (!array_key_exists('tokenStorage', $config)) {\n-\t\t\t$builder->addDefinition($this->prefix('tokenFactory'))\n-\t\t\t\t->setClass(MemoryTokenStorage::class);\n+\t\t$connectorDefinition = $builder->addDefinition($connectorName = $this->prefix(\"connector$name\"))\n+\t\t\t->setClass(Connector::class, [$consumerDefinition, $tokenStorageDefinition, $requestFactoryDefinition])\n+\t\t\t->setAutowired(FALSE);\n \n-\t\t} else {\n-\t\t\t// touch reference to validate it\n-\t\t\tif (!$builder->getServiceName($config['tokenStorage'])) {\n-\t\t\t\tthrow new InvalidConfigException(\"Invalid reference to service implementing ITokenStorage given: $config[tokenStorage]\");\n-\t\t\t}\n+\t\t$logisticsClientDefiniton = $builder->addDefinition($this->prefix(\"logisticsClient$name\"))\n+\t\t\t->setClass(LogisticsClient::class, [$connectorDefinition, $requestFactoryDefinition]);\n+\n+\t\tif ($name !== '') {\n+\t\t\t$logisticsClientDefiniton->setAutowired(FALSE);\n \t\t}\n \n-\t\t$builder->addDefinition($this->prefix('connector'))\n-\t\t\t->setClass(Connector::class);\n+\t\treturn $logisticsClientDefiniton;\n+\t}\n+\n \n-\t\t$builder->addDefinition($this->prefix('logisticsClient'))\n-\t\t\t->setClass(LogisticsClient::class);\n+\n+\t/**\n+\t * @param ServiceDefinition[] $clients\n+\t */\n+\tprotected function configureClientsPool(array $clients)\n+\t{\n+\t\t$this->getContainerBuilder()->addDefinition($this->prefix('logisticsClientsPool'))\n+\t\t\t->setClass(LogisticsClientsPool::class, [$clients]);","path":"src/Logistics/DI/LogisticsExtension.php","position":127,"original_position":127,"commit_id":"ba98c9bbbd399d166d8b59bd85e4f088ae5d98cd","original_commit_id":"ba98c9bbbd399d166d8b59bd85e4f088ae5d98cd","user":{"login":"stekycz","id":865447,"avatar_url":"https://avatars.githubusercontent.com/u/865447?v=3","gravatar_id":"","url":"https://api.github.com/users/stekycz","html_url":"https://github.com/stekycz","followers_url":"https://api.github.com/users/stekycz/followers","following_url":"https://api.github.com/users/stekycz/following{/other_user}","gists_url":"https://api.github.com/users/stekycz/gists{/gist_id}","starred_url":"https://api.github.com/users/stekycz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stekycz/subscriptions","organizations_url":"https://api.github.com/users/stekycz/orgs","repos_url":"https://api.github.com/users/stekycz/repos","events_url":"https://api.github.com/users/stekycz/events{/privacy}","received_events_url":"https://api.github.com/users/stekycz/received_events","type":"User","site_admin":false},"body":"Stále přemýšlím, jestli místo pole jako povinného parametru konstruktoru nepoužít spíše `addSetup` a volat veřejnou metodu pro přidání dalších clientů.","created_at":"2015-03-14T14:01:45Z","updated_at":"2015-03-14T14:01:45Z","html_url":"https://github.com/damejidlo/cargo-client/pull/16#discussion_r26438033","pull_request_url":"https://api.github.com/repos/damejidlo/cargo-client/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/damejidlo/cargo-client/pulls/comments/26438033"},"html":{"href":"https://github.com/damejidlo/cargo-client/pull/16#discussion_r26438033"},"pull_request":{"href":"https://api.github.com/repos/damejidlo/cargo-client/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/damejidlo/cargo-client/pulls/16","id":30995697,"html_url":"https://github.com/damejidlo/cargo-client/pull/16","diff_url":"https://github.com/damejidlo/cargo-client/pull/16.diff","patch_url":"https://github.com/damejidlo/cargo-client/pull/16.patch","issue_url":"https://api.github.com/repos/damejidlo/cargo-client/issues/16","number":16,"state":"open","locked":false,"title":"Multiple LogisticsClient instances via configuration file","user":{"login":"Tharos","id":866325,"avatar_url":"https://avatars.githubusercontent.com/u/866325?v=3","gravatar_id":"","url":"https://api.github.com/users/Tharos","html_url":"https://github.com/Tharos","followers_url":"https://api.github.com/users/Tharos/followers","following_url":"https://api.github.com/users/Tharos/following{/other_user}","gists_url":"https://api.github.com/users/Tharos/gists{/gist_id}","starred_url":"https://api.github.com/users/Tharos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tharos/subscriptions","organizations_url":"https://api.github.com/users/Tharos/orgs","repos_url":"https://api.github.com/users/Tharos/repos","events_url":"https://api.github.com/users/Tharos/events{/privacy}","received_events_url":"https://api.github.com/users/Tharos/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-11T23:29:21Z","updated_at":"2015-03-14T14:01:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cec46832e71cc96ed5653162b89b63c46f204ca3","assignee":{"login":"Tharos","id":866325,"avatar_url":"https://avatars.githubusercontent.com/u/866325?v=3","gravatar_id":"","url":"https://api.github.com/users/Tharos","html_url":"https://github.com/Tharos","followers_url":"https://api.github.com/users/Tharos/followers","following_url":"https://api.github.com/users/Tharos/following{/other_user}","gists_url":"https://api.github.com/users/Tharos/gists{/gist_id}","starred_url":"https://api.github.com/users/Tharos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tharos/subscriptions","organizations_url":"https://api.github.com/users/Tharos/orgs","repos_url":"https://api.github.com/users/Tharos/repos","events_url":"https://api.github.com/users/Tharos/events{/privacy}","received_events_url":"https://api.github.com/users/Tharos/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/damejidlo/cargo-client/pulls/16/commits","review_comments_url":"https://api.github.com/repos/damejidlo/cargo-client/pulls/16/comments","review_comment_url":"https://api.github.com/repos/damejidlo/cargo-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/damejidlo/cargo-client/issues/16/comments","statuses_url":"https://api.github.com/repos/damejidlo/cargo-client/statuses/ba98c9bbbd399d166d8b59bd85e4f088ae5d98cd","head":{"label":"Tharos:feature/multipleClients","ref":"feature/multipleClients","sha":"ba98c9bbbd399d166d8b59bd85e4f088ae5d98cd","user":{"login":"Tharos","id":866325,"avatar_url":"https://avatars.githubusercontent.com/u/866325?v=3","gravatar_id":"","url":"https://api.github.com/users/Tharos","html_url":"https://github.com/Tharos","followers_url":"https://api.github.com/users/Tharos/followers","following_url":"https://api.github.com/users/Tharos/following{/other_user}","gists_url":"https://api.github.com/users/Tharos/gists{/gist_id}","starred_url":"https://api.github.com/users/Tharos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tharos/subscriptions","organizations_url":"https://api.github.com/users/Tharos/orgs","repos_url":"https://api.github.com/users/Tharos/repos","events_url":"https://api.github.com/users/Tharos/events{/privacy}","received_events_url":"https://api.github.com/users/Tharos/received_events","type":"User","site_admin":false},"repo":{"id":32046667,"name":"cargo-client","full_name":"Tharos/cargo-client","owner":{"login":"Tharos","id":866325,"avatar_url":"https://avatars.githubusercontent.com/u/866325?v=3","gravatar_id":"","url":"https://api.github.com/users/Tharos","html_url":"https://github.com/Tharos","followers_url":"https://api.github.com/users/Tharos/followers","following_url":"https://api.github.com/users/Tharos/following{/other_user}","gists_url":"https://api.github.com/users/Tharos/gists{/gist_id}","starred_url":"https://api.github.com/users/Tharos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tharos/subscriptions","organizations_url":"https://api.github.com/users/Tharos/orgs","repos_url":"https://api.github.com/users/Tharos/repos","events_url":"https://api.github.com/users/Tharos/events{/privacy}","received_events_url":"https://api.github.com/users/Tharos/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Tharos/cargo-client","description":"","fork":true,"url":"https://api.github.com/repos/Tharos/cargo-client","forks_url":"https://api.github.com/repos/Tharos/cargo-client/forks","keys_url":"https://api.github.com/repos/Tharos/cargo-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tharos/cargo-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tharos/cargo-client/teams","hooks_url":"https://api.github.com/repos/Tharos/cargo-client/hooks","issue_events_url":"https://api.github.com/repos/Tharos/cargo-client/issues/events{/number}","events_url":"https://api.github.com/repos/Tharos/cargo-client/events","assignees_url":"https://api.github.com/repos/Tharos/cargo-client/assignees{/user}","branches_url":"https://api.github.com/repos/Tharos/cargo-client/branches{/branch}","tags_url":"https://api.github.com/repos/Tharos/cargo-client/tags","blobs_url":"https://api.github.com/repos/Tharos/cargo-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tharos/cargo-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tharos/cargo-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tharos/cargo-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tharos/cargo-client/statuses/{sha}","languages_url":"https://api.github.com/repos/Tharos/cargo-client/languages","stargazers_url":"https://api.github.com/repos/Tharos/cargo-client/stargazers","contributors_url":"https://api.github.com/repos/Tharos/cargo-client/contributors","subscribers_url":"https://api.github.com/repos/Tharos/cargo-client/subscribers","subscription_url":"https://api.github.com/repos/Tharos/cargo-client/subscription","commits_url":"https://api.github.com/repos/Tharos/cargo-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tharos/cargo-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tharos/cargo-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tharos/cargo-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/Tharos/cargo-client/contents/{+path}","compare_url":"https://api.github.com/repos/Tharos/cargo-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tharos/cargo-client/merges","archive_url":"https://api.github.com/repos/Tharos/cargo-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tharos/cargo-client/downloads","issues_url":"https://api.github.com/repos/Tharos/cargo-client/issues{/number}","pulls_url":"https://api.github.com/repos/Tharos/cargo-client/pulls{/number}","milestones_url":"https://api.github.com/repos/Tharos/cargo-client/milestones{/number}","notifications_url":"https://api.github.com/repos/Tharos/cargo-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tharos/cargo-client/labels{/name}","releases_url":"https://api.github.com/repos/Tharos/cargo-client/releases{/id}","created_at":"2015-03-11T23:28:33Z","updated_at":"2015-03-11T23:28:34Z","pushed_at":"2015-03-12T12:06:29Z","git_url":"git://github.com/Tharos/cargo-client.git","ssh_url":"git@github.com:Tharos/cargo-client.git","clone_url":"https://github.com/Tharos/cargo-client.git","svn_url":"https://github.com/Tharos/cargo-client","homepage":"https://magnum.travis-ci.com/damejidlo/cargo-client","size":214,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"damejidlo:master","ref":"master","sha":"d1d79121765d95261e94a27270ecf2e1d7f744eb","user":{"login":"damejidlo","id":2973131,"avatar_url":"https://avatars.githubusercontent.com/u/2973131?v=3","gravatar_id":"","url":"https://api.github.com/users/damejidlo","html_url":"https://github.com/damejidlo","followers_url":"https://api.github.com/users/damejidlo/followers","following_url":"https://api.github.com/users/damejidlo/following{/other_user}","gists_url":"https://api.github.com/users/damejidlo/gists{/gist_id}","starred_url":"https://api.github.com/users/damejidlo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damejidlo/subscriptions","organizations_url":"https://api.github.com/users/damejidlo/orgs","repos_url":"https://api.github.com/users/damejidlo/repos","events_url":"https://api.github.com/users/damejidlo/events{/privacy}","received_events_url":"https://api.github.com/users/damejidlo/received_events","type":"Organization","site_admin":false},"repo":{"id":22985227,"name":"cargo-client","full_name":"damejidlo/cargo-client","owner":{"login":"damejidlo","id":2973131,"avatar_url":"https://avatars.githubusercontent.com/u/2973131?v=3","gravatar_id":"","url":"https://api.github.com/users/damejidlo","html_url":"https://github.com/damejidlo","followers_url":"https://api.github.com/users/damejidlo/followers","following_url":"https://api.github.com/users/damejidlo/following{/other_user}","gists_url":"https://api.github.com/users/damejidlo/gists{/gist_id}","starred_url":"https://api.github.com/users/damejidlo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damejidlo/subscriptions","organizations_url":"https://api.github.com/users/damejidlo/orgs","repos_url":"https://api.github.com/users/damejidlo/repos","events_url":"https://api.github.com/users/damejidlo/events{/privacy}","received_events_url":"https://api.github.com/users/damejidlo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/damejidlo/cargo-client","description":"","fork":false,"url":"https://api.github.com/repos/damejidlo/cargo-client","forks_url":"https://api.github.com/repos/damejidlo/cargo-client/forks","keys_url":"https://api.github.com/repos/damejidlo/cargo-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/damejidlo/cargo-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/damejidlo/cargo-client/teams","hooks_url":"https://api.github.com/repos/damejidlo/cargo-client/hooks","issue_events_url":"https://api.github.com/repos/damejidlo/cargo-client/issues/events{/number}","events_url":"https://api.github.com/repos/damejidlo/cargo-client/events","assignees_url":"https://api.github.com/repos/damejidlo/cargo-client/assignees{/user}","branches_url":"https://api.github.com/repos/damejidlo/cargo-client/branches{/branch}","tags_url":"https://api.github.com/repos/damejidlo/cargo-client/tags","blobs_url":"https://api.github.com/repos/damejidlo/cargo-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/damejidlo/cargo-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/damejidlo/cargo-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/damejidlo/cargo-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/damejidlo/cargo-client/statuses/{sha}","languages_url":"https://api.github.com/repos/damejidlo/cargo-client/languages","stargazers_url":"https://api.github.com/repos/damejidlo/cargo-client/stargazers","contributors_url":"https://api.github.com/repos/damejidlo/cargo-client/contributors","subscribers_url":"https://api.github.com/repos/damejidlo/cargo-client/subscribers","subscription_url":"https://api.github.com/repos/damejidlo/cargo-client/subscription","commits_url":"https://api.github.com/repos/damejidlo/cargo-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/damejidlo/cargo-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/damejidlo/cargo-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/damejidlo/cargo-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/damejidlo/cargo-client/contents/{+path}","compare_url":"https://api.github.com/repos/damejidlo/cargo-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/damejidlo/cargo-client/merges","archive_url":"https://api.github.com/repos/damejidlo/cargo-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/damejidlo/cargo-client/downloads","issues_url":"https://api.github.com/repos/damejidlo/cargo-client/issues{/number}","pulls_url":"https://api.github.com/repos/damejidlo/cargo-client/pulls{/number}","milestones_url":"https://api.github.com/repos/damejidlo/cargo-client/milestones{/number}","notifications_url":"https://api.github.com/repos/damejidlo/cargo-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/damejidlo/cargo-client/labels{/name}","releases_url":"https://api.github.com/repos/damejidlo/cargo-client/releases{/id}","created_at":"2014-08-15T09:39:54Z","updated_at":"2015-01-06T14:15:12Z","pushed_at":"2015-01-06T14:15:11Z","git_url":"git://github.com/damejidlo/cargo-client.git","ssh_url":"git@github.com:damejidlo/cargo-client.git","clone_url":"https://github.com/damejidlo/cargo-client.git","svn_url":"https://github.com/damejidlo/cargo-client","homepage":"https://magnum.travis-ci.com/damejidlo/cargo-client","size":214,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":6,"forks":4,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/damejidlo/cargo-client/pulls/16"},"html":{"href":"https://github.com/damejidlo/cargo-client/pull/16"},"issue":{"href":"https://api.github.com/repos/damejidlo/cargo-client/issues/16"},"comments":{"href":"https://api.github.com/repos/damejidlo/cargo-client/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/damejidlo/cargo-client/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/damejidlo/cargo-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/damejidlo/cargo-client/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/damejidlo/cargo-client/statuses/ba98c9bbbd399d166d8b59bd85e4f088ae5d98cd"}}}}