Skip to content

Commit 7f6db6a

Browse files
committed
Finishing, but not using, secret support
1 parent 4abebd9 commit 7f6db6a

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

app/config/github.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ parameters:
1111
symfony/symfony:
1212
subscribers:
1313
- app.subscriber.issue_subscriber
14-
secret: change_me
14+
# secret: change_me
1515
symfony/symfony-docs:
1616
subscribers:
1717
- app.subscriber.issue_subscriber

src/AppBundle/Repository/Provider/InMemoryRepositoryProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ public function __construct(array $repositories)
2828
throw new \InvalidArgumentException(sprintf('The repository "%s" has no subscribers configured.', $repositoryFullName));
2929
}
3030

31+
$secret = isset($repositoryData['secret']) ? $repositoryData['secret'] : null;
32+
3133
$this->addRepository(new Repository(
3234
$vendorName,
3335
$repositoryName,
34-
$repositoryData['subscribers']
36+
$repositoryData['subscribers'],
37+
$secret
3538
));
3639
}
3740
}

src/AppBundle/Repository/Repository.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,19 @@ class Repository
2424
*/
2525
private $subscribers;
2626

27-
public function __construct($vendor, $name, array $subscribers)
27+
/**
28+
* The webhook secret used by GitHub
29+
*
30+
* @var string
31+
*/
32+
private $secret;
33+
34+
public function __construct($vendor, $name, array $subscribers, $secret)
2835
{
2936
$this->vendor = $vendor;
3037
$this->name = $name;
3138
$this->subscribers = $subscribers;
39+
$this->secret = $secret;
3240
}
3341

3442
/**
@@ -73,6 +81,6 @@ public function getSubscribers()
7381
*/
7482
public function getSecret()
7583
{
76-
// todo - implement setting a secret
84+
return $this->secret;
7785
}
7886
}

0 commit comments

Comments
 (0)