private function committersFromFile($file, $module) {

        $curl_url = "https://api.github.com/repos/$module->github_owner/$module->github_repo/commits?path=$file";

        $output = $this->runCurl($curl_url, $module);

        //TODO: what to do if the output is invalid?
        $commits = json_decode($output);

        $contributors = array();
        $dates = array();

        foreach($commits as $commit) {
            if($module->generate_contributor_data) {
                $contributor = array();
                $contributor['login'] = $commit->author->login;
                $contributor['avatar_url'] = $commit->author->avatar_url;
                $contributor['html_url'] = $commit->author->html_url;
                $contributors[] = $contributor;
            }
            $dates[] = strtotime($commit->commit->author->date);
        }
        $unique_contributors = array();
        if($module->generate_contributor_data) {
            $unique_contributors = $this->unique_multidim_array($contributors, 'login');
            $this->createAvatar($unique_contributors, $module);
        }

        sort($dates, SORT_NUMERIC);
        return [$unique_contributors, $dates];
    }
private function committersFromFile($file, $module) {

        $curl_url = "https://api.github.com/repos/$module->github_owner/$module->github_repo/commits?path=$file";

        $output = $this->runCurl($curl_url, $module);

        //TODO: what to do if the output is invalid?
        $commits = json_decode($output);

        $contributors = array();
        $dates = array();

        foreach($commits as $commit) {
            if($module->generate_contributor_data) {
                $contributor = array();
                $contributor['login'] = $commit->author->login;
                $contributor['avatar_url'] = $commit->author->avatar_url;
                $contributor['html_url'] = $commit->author->html_url;
                $contributors[] = $contributor;
            }
            $dates[] = strtotime($commit->commit->author->date);
        }
        $unique_contributors = array();
        if($module->generate_contributor_data) {
            $unique_contributors = $this->unique_multidim_array($contributors, 'login');
            $this->createAvatar($unique_contributors, $module);
        }

        sort($dates, SORT_NUMERIC);
        return [$unique_contributors, $dates];
    }
private function committersFromFile ( $ file , $ module ) { $ curl_url = "https://api.github.com/repos/$module->github_owner/$module->github_repo/commits?path=$file" ; $ output = $ this -> runCurl ( $ curl_url , $ module ) ; //TODO: what to do if the output is invalid? $ commits = json_decode ( $ output ) ; $ contributors = array ( ) ; $ dates = array ( ) ; foreach ( $ commits as $ commit ) { if ( $ module -> generate_contributor_data ) { $ contributor = array ( ) ; $ contributor [ 'login' ] = $ commit -> author -> login ; $ contributor [ 'avatar_url' ] = $ commit -> author -> avatar_url ; $ contributor [ 'html_url' ] = $ commit -> author -> html_url ; $ contributors [ ] = $ contributor ; } $ dates [ ] = strtotime ( $ commit -> commit -> author -> date ) ; } $ unique_contributors = array ( ) ; if ( $ module -> generate_contributor_data ) { $ unique_contributors = $ this -> unique_multidim_array ( $ contributors , 'login' ) ; $ this -> createAvatar ( $ unique_contributors , $ module ) ; } sort ( $ dates , SORT_NUMERIC ) ; return [ $ unique_contributors , $ dates ] ; }
Asks Github for the list of contributors to a file
@param  string $file     The file to generate contributors list for
@param  Object $module   Handle to the active module
@return array            Unique list of contributors to the file in question including dates
Asks Github for the list of contributors to a file