Skip to content

Commit 8c14b13

Browse files
committed
Added a Settings class
Offers a simple object to hold all the configurable values that the GithubAdapter might need.
1 parent 91821bc commit 8c14b13

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

src/Settings.php

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
3+
namespace Potherca\Flysystem\Github;
4+
5+
use Github\Client;
6+
7+
class Settings
8+
{
9+
const AUTHENTICATE_USING_TOKEN = Client::AUTH_URL_TOKEN;
10+
const AUTHENTICATE_USING_PASSWORD = Client::AUTH_HTTP_PASSWORD;
11+
12+
const REFERENCE_HEAD = 'HEAD';
13+
const BRANCH_MASTER = 'master';
14+
15+
/** @var string */
16+
private $repository;
17+
/** @var string */
18+
private $reference = self::REFERENCE_HEAD;
19+
/** @var array */
20+
private $credentials;
21+
/** @var string */
22+
private $branch = self::BRANCH_MASTER;
23+
24+
final public function __construct(
25+
$repository,
26+
array $credentials = [],
27+
$branch = self::BRANCH_MASTER,
28+
$reference = self::REFERENCE_HEAD
29+
) {
30+
$this->branch = $branch;
31+
$this->credentials = $credentials;
32+
$this->reference = $reference;
33+
$this->repository = $repository;
34+
}
35+
36+
37+
/**
38+
* @return string
39+
*/
40+
final public function getRepository()
41+
{
42+
return $this->repository;
43+
}
44+
45+
/**
46+
* @return string
47+
*/
48+
final public function getReference()
49+
{
50+
return $this->reference;
51+
}
52+
53+
/**
54+
* @return array
55+
*/
56+
final public function getCredentials()
57+
{
58+
return $this->credentials;
59+
}
60+
61+
/**
62+
* @return string
63+
*/
64+
final public function getBranch()
65+
{
66+
return $this->branch;
67+
}
68+
}
69+
70+
/*EOF*/

0 commit comments

Comments
 (0)