Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
e05d3196
Commit
e05d3196
authored
8 years ago
by
Stanley Cheung
Browse files
Options
Downloads
Patches
Plain Diff
php: add channel argument to BaseStub constructor
parent
55ca239b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/php/lib/Grpc/BaseStub.php
+11
-2
11 additions, 2 deletions
src/php/lib/Grpc/BaseStub.php
with
11 additions
and
2 deletions
src/php/lib/Grpc/BaseStub.php
+
11
−
2
View file @
e05d3196
...
...
@@ -52,8 +52,9 @@ class BaseStub
* - 'update_metadata': (optional) a callback function which takes in a
* metadata array, and returns an updated metadata array
* - 'grpc.primary_user_agent': (optional) a user-agent string
* @param $channel Channel An already created Channel object
*/
public
function
__construct
(
$hostname
,
$opts
)
public
function
__construct
(
$hostname
,
$opts
,
$channel
=
null
)
{
$this
->
hostname
=
$hostname
;
$this
->
update_metadata
=
null
;
...
...
@@ -77,7 +78,15 @@ class BaseStub
'required. Please see one of the '
.
'ChannelCredentials::create methods'
);
}
$this
->
channel
=
new
Channel
(
$hostname
,
$opts
);
if
(
$channel
)
{
if
(
!
is_a
(
$channel
,
'Channel'
))
{
throw
new
\Exception
(
"The channel argument is not a"
.
"Channel object"
);
}
$this
->
channel
=
$channel
;
}
else
{
$this
->
channel
=
new
Channel
(
$hostname
,
$opts
);
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment