@@ 53-90 (lines=38) @@ | ||
50 | * @param array $commit |
|
51 | * @return array |
|
52 | */ |
|
53 | public function arrangeCommit($commit) |
|
54 | { |
|
55 | $new_commit = []; |
|
56 | ||
57 | $new_commit['repo'] = $this->getRepo(); |
|
58 | $new_commit['branch'] = $this->getBranch(); |
|
59 | $new_commit['pusher'] = $this->getPusher(); |
|
60 | $new_commit['pushed_at'] = time(); |
|
61 | ||
62 | $new_commit['sha'] = isset($commit['id']) ? $commit['id'] : ''; |
|
63 | $new_commit['url'] = isset($commit['url']) ? $commit['url'] : ''; |
|
64 | $new_commit['message'] = isset($commit['message']) ? trim($commit['message']) : ''; |
|
65 | $new_commit['added'] = isset($commit['added']) ? $commit['added'] : []; |
|
66 | $new_commit['modified'] = isset($commit['modified']) ? $commit['modified'] : []; |
|
67 | $new_commit['removed'] = isset($commit['removed']) ? $commit['removed'] : []; |
|
68 | $new_commit['committed_at'] = isset($commit['timestamp']) ? strtotime($commit['timestamp']) : ''; |
|
69 | ||
70 | if (isset($commit['author'])) { |
|
71 | $new_commit['author'] = $commit['author']; |
|
72 | if (isset($commit['author']['email']) && $commit['author']['email']) { |
|
73 | $new_author = EloquentUser::where('email', $commit['author']['email'])->first(); |
|
74 | if ($new_author) { |
|
75 | $new_commit['author']['id'] = $new_author->id; |
|
76 | $new_commit['author']['name'] = $new_author->first_name; |
|
77 | $new_commit['author']['email'] = $new_author->email; |
|
78 | } |
|
79 | } |
|
80 | } |
|
81 | else |
|
82 | { |
|
83 | $new_commit['author'] = []; |
|
84 | } |
|
85 | ||
86 | return $new_commit; |
|
87 | } |
|
88 | } |
|
89 |
@@ 53-90 (lines=38) @@ | ||
50 | * @param array $commit |
|
51 | * @return array |
|
52 | */ |
|
53 | public function arrangeCommit($commit) |
|
54 | { |
|
55 | $new_commit = []; |
|
56 | ||
57 | $new_commit['repo'] = $this->getRepo(); |
|
58 | $new_commit['branch'] = $this->getBranch(); |
|
59 | $new_commit['pusher'] = $this->getPusher(); |
|
60 | $new_commit['pushed_at'] = time(); |
|
61 | ||
62 | $new_commit['sha'] = isset($commit['id']) ? $commit['id'] : ''; |
|
63 | $new_commit['url'] = isset($commit['url']) ? $commit['url'] : ''; |
|
64 | $new_commit['message'] = isset($commit['message']) ? trim($commit['message']) : ''; |
|
65 | $new_commit['added'] = isset($commit['added']) ? $commit['added'] : []; |
|
66 | $new_commit['modified'] = isset($commit['modified']) ? $commit['modified'] : []; |
|
67 | $new_commit['removed'] = isset($commit['removed']) ? $commit['removed'] : []; |
|
68 | $new_commit['committed_at'] = isset($commit['timestamp']) ? strtotime($commit['timestamp']) : ''; |
|
69 | ||
70 | if (isset($commit['author'])) { |
|
71 | $new_commit['author'] = $commit['author']; |
|
72 | if (isset($commit['author']['email']) && $commit['author']['email']) { |
|
73 | $new_author = EloquentUser::where('email', $commit['author']['email'])->first(); |
|
74 | if ($new_author) { |
|
75 | $new_commit['author']['id'] = $new_author->id; |
|
76 | $new_commit['author']['name'] = $new_author->first_name; |
|
77 | $new_commit['author']['email'] = $new_author->email; |
|
78 | } |
|
79 | } |
|
80 | } |
|
81 | else |
|
82 | { |
|
83 | $new_commit['author'] = []; |
|
84 | } |
|
85 | ||
86 | return $new_commit; |
|
87 | } |
|
88 | } |
|
89 |