Merging   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A performMerge() 0 9 1
1
<?php
2
namespace FlexyProject\GitHub\Receiver\Repositories;
3
4
use Symfony\Component\HttpFoundation\Request;
5
6
/**
7
 * The Merging API class provides access to repository's merging.
8
 *
9
 * @link    https://developer.github.com/v3/repos/merging/
10
 * @package FlexyProject\GitHub\Receiver\Repositories
11
 */
12
class Merging extends AbstractRepositories
13
{
14
15
    /**
16
     * Perform a merge
17
     *
18
     * @link https://developer.github.com/v3/repos/merging/#perform-a-merge
19
     *
20
     * @param string      $base
21
     * @param string      $head
22
     * @param string|null $commitMessage
23
     *
24
     * @return array
25
     */
26
    public function performMerge(string $base, string $head, string $commitMessage = null): array
27
    {
28
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/merges',
29
            $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()), Request::METHOD_POST, [
30
                'base'           => $base,
31
                'head'           => $head,
32
                'commit_message' => $commitMessage
33
            ]);
34
    }
35
}