protected function bitbucketWebhook($payload, $project)
    {
        $results = array();
        $status = 'failed';
        foreach ($payload['push']['changes'] as $commit) {
            try {
                $email = $commit['new']['target']['author']['raw'];
                $email = substr($email, 0, strpos($email, '>'));
                $email = substr($email, strpos($email, '<') + 1);

                $results[$commit['new']['target']['hash']] = $this->createBuild(
                    $project,
                    $commit['new']['target']['hash'],
                    $commit['new']['name'],
                    $email,
                    $commit['new']['target']['message']
                );
                $status = 'ok';
            } catch (Exception $ex) {
                $results[$commit['new']['target']['hash']] = array('status' => 'failed', 'error' => $ex->getMessage());
            }
        }

        return array('status' => $status, 'commits' => $results);
    }
protected function bitbucketWebhook($payload, $project)
    {
        $results = array();
        $status = 'failed';
        foreach ($payload['push']['changes'] as $commit) {
            try {
                $email = $commit['new']['target']['author']['raw'];
                $email = substr($email, 0, strpos($email, '>'));
                $email = substr($email, strpos($email, '<') + 1);

                $results[$commit['new']['target']['hash']] = $this->createBuild(
                    $project,
                    $commit['new']['target']['hash'],
                    $commit['new']['name'],
                    $email,
                    $commit['new']['target']['message']
                );
                $status = 'ok';
            } catch (Exception $ex) {
                $results[$commit['new']['target']['hash']] = array('status' => 'failed', 'error' => $ex->getMessage());
            }
        }

        return array('status' => $status, 'commits' => $results);
    }
protected function bitbucketWebhook ( $ payload , $ project ) { $ results = array ( ) ; $ status = 'failed' ; foreach ( $ payload [ 'push' ] [ 'changes' ] as $ commit ) { try { $ email = $ commit [ 'new' ] [ 'target' ] [ 'author' ] [ 'raw' ] ; $ email = substr ( $ email , 0 , strpos ( $ email , '>' ) ) ; $ email = substr ( $ email , strpos ( $ email , '<' ) + 1 ) ; $ results [ $ commit [ 'new' ] [ 'target' ] [ 'hash' ] ] = $ this -> createBuild ( $ project , $ commit [ 'new' ] [ 'target' ] [ 'hash' ] , $ commit [ 'new' ] [ 'name' ] , $ email , $ commit [ 'new' ] [ 'target' ] [ 'message' ] ) ; $ status = 'ok' ; } catch ( Exception $ ex ) { $ results [ $ commit [ 'new' ] [ 'target' ] [ 'hash' ] ] = array ( 'status' => 'failed' , 'error' => $ ex -> getMessage ( ) ) ; } } return array ( 'status' => $ status , 'commits' => $ results ) ; }
Bitbucket webhooks.
Bitbucket webhooks .