-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.php
More file actions
executable file
·53 lines (48 loc) · 1.24 KB
/
helpers.php
File metadata and controls
executable file
·53 lines (48 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* Created by JetBrains PhpStorm.
* User: chris
* Date: 9/1/13
* Time: 8:53 PM
* To change this template use File | Settings | File Templates.
*/
?>
<?php
class pivotalTrackerHelpers {
public function tokenFile() {
$home = getenv("HOME");
$tokenfile =($home . "/" . '.pivotaltoken');
return $tokenfile;
}
public function createTokenFile($token) {
// $tokenfile = $this->tokenFile();
$pivotaltoken = fopen($this->tokenFile(), 'w');
fwrite($pivotaltoken, $token);
fclose($pivotaltoken);
return false;
}
public function getFileContents($file, $field)
{
$lines = file($file);
foreach ($lines as $line)
{
list ($key, $val) = explode('=', trim($line));
if (trim($key) == $field)
{
return $val;
}
}
return false;
}
public function displayToken($token){
echo ("\nTOKEN INFO:\n"
. " Token: " . $token . "\n"
. " Found in: " . $this->tokenFile() . "\n");
return false;
}
public function hookFile($pRoot) {
$hFile = $pRoot . "/" . '.git/hooks/prepare-commit-msg';
return $hFile;
}
}
?>