예제 #1
0
 public static function setConnection(Connection_Interface $connection)
 {
     if ($connection == null) {
         throw new Exception("<null>");
     }
     self::$_connection = $connection;
 }
예제 #2
0
파일: test.php 프로젝트: nikelin/Direct-API
     */
    $forecastListResponse = API_Facade::getForecastReportsList();
    if (count($forecastListResponse) == 0) {
        /**
         * Create new forecast report request
         * @see API_Request_GetForecast
         */
        API_Facade::createNewForecastReport(array("Nikelin", "Redshape"));
        API_Facade::createNewForecastReport(array("Yandex", "Redshape23"));
        API_Facade::createNewForecastReport(array("Google Chrome", "Redshape"));
        sleep(5);
    }
    $forecastListResponse = null;
    do {
        $forecastListResponse = API_Facade::getForecastReportsList();
    } while (count($forecastListResponse) == 0);
    foreach ($forecastListResponse as $forecastReport) {
        $i = 0;
        $forecastResultResponse = null;
        do {
            $forecastResultResponse = API_Facade::getForecastReport($forecastReport->getForecastID());
        } while ($forecastResultResponse->isError() && $i++ < 10);
        foreach ($forecastResultResponse->getPhrases() as $phraseForecast) {
            echo sprintf("\nReport #%d\n" . "\n----------\n" . "\nLowCTR Warning: %s\n" . "\nCTR: %s\n" . "\nMax: %s\n" . "\nMin: %s\n" . "\nPremium min(): %s\n" . "\nPremium max(): %s\n", $forecastReport->getForecastID(), $phraseForecast->getLowCTRWarning(), $phraseForecast->getCTR(), $phraseForecast->getMax(), $phraseForecast->getMin(), $phraseForecast->getPremiumMin(), $phraseForecast->getPremiumMax());
        }
    }
    echo var_dump(API_Facade::getBanners(array(1)));
    echo var_dump(API_Facade::getBannerPhrases(array(1)));
} catch (Exception $e) {
    echo sprintf("\nError on line %d <'%s'> with code %s!\n", $e->getLine(), $e->getMessage(), Utils::ifsetor($e->getCode(), "<null>"));
}