private function findWebHook(Integration $integration, array $jsonResult)
    {
        $type = $integration->type;
        $hookUrl = $integration->getLink('#hook');
        if ($integration->type === 'bitbucket') {
            $hooks = $jsonResult['values'];
        } else {
            $hooks = $jsonResult;
        }
        foreach ($hooks as $hook) {
            if ($type === 'github' && $hook['config']['url'] === $hookUrl) {
                return $hook;
            }
            if ($type === 'gitlab' && $hook['url'] === $hookUrl) {
                return $hook;
            }
            if ($type === 'bitbucket' && $hook['url'] === $hookUrl) {
                return $hook;
            }
        }

        return false;
    }
private function findWebHook(Integration $integration, array $jsonResult)
    {
        $type = $integration->type;
        $hookUrl = $integration->getLink('#hook');
        if ($integration->type === 'bitbucket') {
            $hooks = $jsonResult['values'];
        } else {
            $hooks = $jsonResult;
        }
        foreach ($hooks as $hook) {
            if ($type === 'github' && $hook['config']['url'] === $hookUrl) {
                return $hook;
            }
            if ($type === 'gitlab' && $hook['url'] === $hookUrl) {
                return $hook;
            }
            if ($type === 'bitbucket' && $hook['url'] === $hookUrl) {
                return $hook;
            }
        }

        return false;
    }
private function findWebHook ( Integration $ integration , array $ jsonResult ) { $ type = $ integration -> type ; $ hookUrl = $ integration -> getLink ( '#hook' ) ; if ( $ integration -> type === 'bitbucket' ) { $ hooks = $ jsonResult [ 'values' ] ; } else { $ hooks = $ jsonResult ; } foreach ( $ hooks as $ hook ) { if ( $ type === 'github' && $ hook [ 'config' ] [ 'url' ] === $ hookUrl ) { return $ hook ; } if ( $ type === 'gitlab' && $ hook [ 'url' ] === $ hookUrl ) { return $ hook ; } if ( $ type === 'bitbucket' && $ hook [ 'url' ] === $ hookUrl ) { return $ hook ; } } return false ; }
Find if a valid webhook exists in a service's hooks list.

@param \Platformsh\Client\Model\Integration $integration
@param array                                $jsonResult

@return array|false
Find if a valid webhook exists in a service s hooks list .