public function create($account, $repo, $params = array())
    {
        $defaults = array(
            'title' => 'New pull request',
            'source' => array(
                'branch' => array(
                    'name'  => 'develop'
                )
            )
        );

        // allow developer to directly specify params as json if (s)he wants.
        if ('array' !== gettype($params)) {
            if (empty($params)) {
                throw new \InvalidArgumentException('Invalid JSON provided.');
            }

            $params = $this->decodeJSON($params);
        }

        $params = array_merge($defaults, $params);

        if (empty($params['title'])) {
            throw new \InvalidArgumentException('Pull request\'s title must be specified.');
        }

        if (empty($params['source']['branch']['name'])) {
            throw new \InvalidArgumentException('Pull request\'s source branch name must be specified.');
        }

        return $this->getClient()->setApiVersion('2.0')->post(
            sprintf('repositories/%s/%s/pullrequests', $account, $repo),
            json_encode($params),
            array('Content-Type' => 'application/json')
        );
    }
public function create($account, $repo, $params = array())
    {
        $defaults = array(
            'title' => 'New pull request',
            'source' => array(
                'branch' => array(
                    'name'  => 'develop'
                )
            )
        );

        // allow developer to directly specify params as json if (s)he wants.
        if ('array' !== gettype($params)) {
            if (empty($params)) {
                throw new \InvalidArgumentException('Invalid JSON provided.');
            }

            $params = $this->decodeJSON($params);
        }

        $params = array_merge($defaults, $params);

        if (empty($params['title'])) {
            throw new \InvalidArgumentException('Pull request\'s title must be specified.');
        }

        if (empty($params['source']['branch']['name'])) {
            throw new \InvalidArgumentException('Pull request\'s source branch name must be specified.');
        }

        return $this->getClient()->setApiVersion('2.0')->post(
            sprintf('repositories/%s/%s/pullrequests', $account, $repo),
            json_encode($params),
            array('Content-Type' => 'application/json')
        );
    }
public function create ( $ account , $ repo , $ params = array ( ) ) { $ defaults = array ( 'title' => 'New pull request' , 'source' => array ( 'branch' => array ( 'name' => 'develop' ) ) ) ; // allow developer to directly specify params as json if (s)he wants. if ( 'array' !== gettype ( $ params ) ) { if ( empty ( $ params ) ) { throw new \ InvalidArgumentException ( 'Invalid JSON provided.' ) ; } $ params = $ this -> decodeJSON ( $ params ) ; } $ params = array_merge ( $ defaults , $ params ) ; if ( empty ( $ params [ 'title' ] ) ) { throw new \ InvalidArgumentException ( 'Pull request\'s title must be specified.' ) ; } if ( empty ( $ params [ 'source' ] [ 'branch' ] [ 'name' ] ) ) { throw new \ InvalidArgumentException ( 'Pull request\'s source branch name must be specified.' ) ; } return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> post ( sprintf ( 'repositories/%s/%s/pullrequests' , $ account , $ repo ) , json_encode ( $ params ) , array ( 'Content-Type' => 'application/json' ) ) ; }
Create a new pull request

@access public
@param  string           $account The team or individual account owning the repository.
@param  string           $repo    The repository identifier.
@param  array|string     $params  Additional parameters as array or JSON string
@return MessageInterface

@throws \InvalidArgumentException
@see https://confluence.atlassian.com/x/XAZAGQ
Create a new pull request