public static function canCallAPI()
    {
        $lastCall = Setting::getSetting('twitter', 'last_api_call');

        if ($lastCall == null) {
            return true;
        } else {
            $lastCall = new \DateTime($lastCall);
        }

        $now = new \DateTime();
        $interval = $lastCall->diff($now);

        // Are we at least one minute ago?
        if ($interval->i >= 1) {
            return true;
        } else {
            return false;
        }
    }
public static function canCallAPI()
    {
        $lastCall = Setting::getSetting('twitter', 'last_api_call');

        if ($lastCall == null) {
            return true;
        } else {
            $lastCall = new \DateTime($lastCall);
        }

        $now = new \DateTime();
        $interval = $lastCall->diff($now);

        // Are we at least one minute ago?
        if ($interval->i >= 1) {
            return true;
        } else {
            return false;
        }
    }
public static function canCallAPI ( ) { $ lastCall = Setting :: getSetting ( 'twitter' , 'last_api_call' ) ; if ( $ lastCall == null ) { return true ; } else { $ lastCall = new \ DateTime ( $ lastCall ) ; } $ now = new \ DateTime ( ) ; $ interval = $ lastCall -> diff ( $ now ) ; // Are we at least one minute ago? if ( $ interval -> i >= 1 ) { return true ; } else { return false ; } }
Checks whether the API can be called

Returns false if the API was called less than a minute ago (which gets over 15 requests in
15 minute on Twitter API rate limiting)

@return bool
Checks whether the API can be called