PHP 클래스 Factual

This is a refactoring of the Factual Driver by Aaron: https://github.com/Factual/factual-java-driver
저자: Tyler
파일 보기 프로젝트 열기: factual/factual-php-driver 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$config OAuthStore object
$configPath geocoder object (unsupported, experimental)
$connectTimeout maximum number of seconds for the network function to execute (0 = no timeout)
$curlTimeout debug flag
$debug array of queries teed up for multi
$factHome
$fetchQueue last table queried
$geocoder array from config.ini file on construct
$lastTable where the config file is found: path + file
$signer string assigned from config

공개 메소드들

메소드 설명
__construct ( $key, $secret ) Constructor. Creates authenticated access to Factual.
boost ( $factualBoost ) : object Improves search results by associating query with selected record
buildQuery ( $tableName, $query ) : string Build query string without running fetch
clear ( $clear ) : object Clear a/n attribute/s from a Factual entity
debug ( ) Turns on debugging for output to stderr
factualAutoload ( $className ) Autoloader for file dependencies Called by spl_autoload_register() to avoid conflicts with autoload() methods from other libs
factualReverseGeocode ( $point, $tableName = "places" ) : the Reverse geocodes by returning a response containing the address nearest a given point.
fetch ( $tableName, $query ) : object Factual Fetch Abstraction
fetchRow ( string $tableName, $factualID ) : the Runs a read query against the specified Factual table.
flag ( $flagger ) : object Flags entties as problematic
geocode ( $address ) : array Geocodes address string or placename
geocoderDiagnostics ( )
match ( $tableName, $vars ) : object Matches entity to Factual ID (shortcut method)
multiFetch ( ) : response Use this to send all queued reads as a multi request
multiQueue ( $table, $query, $handle ) Queue a request for inclusion in a multi request.
rawGet ( $path, $params ) : string Runs a GET request against the specified endpoint path, using the given parameters and your OAuth credentials. Returns the raw response body returned by Factual. The necessary URL base will be automatically prepended to path. If you need to change it, e.g. to make requests against a development instance of the Factual service, use Factual::setFactHome().
rawPost ( $path, $body, $params = null ) : string Runs a GET request against the specified endpoint path, using the given parameters and your OAuth credentials. Returns the raw response body returned by Factual. The necessary URL base will be automatically prepended to path. If you need to change it, e.g. to make requests against a development instance of the Factual service, use Factual::setFactHome().
resolve ( $tableName, $vars ) : object Resolves and returns resolved entity or null (shortcut method)
reverseGeocode ( $lon, $lat ) : array Reverse geocodes long/lat to the smallest bounding WOEID
schema ( $tableName ) : object
setConnectTimeout ( $secs ) Sets maximum number of seconds to connect to the server before bailing
setCurlTimeout ( $secs ) Sets maximum number of seconds to the network function to execute
setFactHome ( $urlBase ) : void Change the base URL at which to contact Factual's API. This may be useful if you want to talk to a test or staging server withou changing config Example value: http://staging.api.v3.factual.com/t/
submit ( $submittor ) : object Submit data to Factual
version ( ) : string Gets driver version

보호된 메소드들

메소드 설명
getGeocoder ( ) : array Geocodes address string or placename
loadConfig ( ) : void Loads config file from ini
request ( string $urlStr, string $requestMethod = "GET", null $params = null, array $curlOptions = [] ) : array Sign the request, perform a curl request and return the results
setConfigPath ( $path ) : void Sets location of config file at runtime
toQueryString ( $parameters ) : string Converts and encodes parameter array to a query string
urlForBoost ( $tableName )
urlForClear ( $tableName, $factualID )
urlForDiffs ( $tableName, $query )
urlForFacets ( $tableName, $query )
urlForFetch ( $tableName, $query )
urlForFetchRow ( $tableName, $factualID )
urlForFlag ( $tableName, $factualID )
urlForGeocode ( $tableName, $query )
urlForMatch ( $tableName, $query )
urlForMulti ( )
urlForResolve ( $tableName, $query )
urlForSchema ( $tableName )
urlForSubmit ( $tableName, $factualID = null )

메소드 상세

__construct() 공개 메소드

Constructor. Creates authenticated access to Factual.
public __construct ( $key, $secret )

boost() 공개 메소드

Improves search results by associating query with selected record
public boost ( $factualBoost ) : object
리턴 object

buildQuery() 공개 메소드

Build query string without running fetch
public buildQuery ( $tableName, $query ) : string
리턴 string

clear() 공개 메소드

Clear a/n attribute/s from a Factual entity
public clear ( $clear ) : object
리턴 object Submit Response object

debug() 공개 메소드

Turns on debugging for output to stderr
public debug ( )

factualAutoload() 공개 정적인 메소드

Autoloader for file dependencies Called by spl_autoload_register() to avoid conflicts with autoload() methods from other libs
public static factualAutoload ( $className )

factualReverseGeocode() 공개 메소드

Reverse geocodes by returning a response containing the address nearest a given point.
public factualReverseGeocode ( $point, $tableName = "places" ) : the
리턴 the response of running a reverse geocode query for point against Factual.

fetch() 공개 메소드

Factual Fetch Abstraction
public fetch ( $tableName, $query ) : object
리턴 object ReadResponse object with result of running query against Factual.

fetchRow() 공개 메소드

Runs a read query against the specified Factual table.
public fetchRow ( string $tableName, $factualID ) : the
$tableName string the name of the table you wish to query (e.g., "places")
리턴 the response of running query against Factual.

flag() 공개 메소드

Flags entties as problematic
public flag ( $flagger ) : object
리턴 object Flag Response object

geocode() 공개 메소드

Geocodes address string or placename
public geocode ( $address ) : array
리턴 array

geocoderDiagnostics() 공개 메소드

public geocoderDiagnostics ( )

getGeocoder() 보호된 메소드

Geocodes address string or placename
protected getGeocoder ( ) : array
리턴 array

loadConfig() 보호된 메소드

Loads config file from ini
protected loadConfig ( ) : void
리턴 void

match() 공개 메소드

Matches entity to Factual ID (shortcut method)
public match ( $tableName, $vars ) : object
리턴 object MatchResponse

multiFetch() 공개 메소드

Use this to send all queued reads as a multi request
public multiFetch ( ) : response
리턴 response for a multi request

multiQueue() 공개 메소드

Queue a request for inclusion in a multi request.
public multiQueue ( $table, $query, $handle )

rawGet() 공개 메소드

Runs a GET request against the specified endpoint path, using the given parameters and your OAuth credentials. Returns the raw response body returned by Factual. The necessary URL base will be automatically prepended to path. If you need to change it, e.g. to make requests against a development instance of the Factual service, use Factual::setFactHome().
public rawGet ( $path, $params ) : string
리턴 string JSON response body from the Factual API.

rawPost() 공개 메소드

Runs a GET request against the specified endpoint path, using the given parameters and your OAuth credentials. Returns the raw response body returned by Factual. The necessary URL base will be automatically prepended to path. If you need to change it, e.g. to make requests against a development instance of the Factual service, use Factual::setFactHome().
public rawPost ( $path, $body, $params = null ) : string
리턴 string JSON response body from the Factual API.

request() 보호된 메소드

Sign the request, perform a curl request and return the results
protected request ( string $urlStr, string $requestMethod = "GET", null $params = null, array $curlOptions = [] ) : array
$urlStr string unsigned URL request
$requestMethod string
$params null
$curlOptions array
리턴 array ex: array ('code'=>int, 'headers'=>array(), 'body'=>string)

resolve() 공개 메소드

Resolves and returns resolved entity or null (shortcut method)
public resolve ( $tableName, $vars ) : object
리턴 object ResolveResponse

reverseGeocode() 공개 메소드

Reverse geocodes long/lat to the smallest bounding WOEID
public reverseGeocode ( $lon, $lat ) : array
리턴 array single result

schema() 공개 메소드

public schema ( $tableName ) : object
리턴 object SchemaResponse object

setConfigPath() 보호된 메소드

Sets location of config file at runtime
protected setConfigPath ( $path ) : void
리턴 void

setConnectTimeout() 공개 메소드

Sets maximum number of seconds to connect to the server before bailing
public setConnectTimeout ( $secs )

setCurlTimeout() 공개 메소드

Sets maximum number of seconds to the network function to execute
public setCurlTimeout ( $secs )

setFactHome() 공개 메소드

Change the base URL at which to contact Factual's API. This may be useful if you want to talk to a test or staging server withou changing config Example value: http://staging.api.v3.factual.com/t/
public setFactHome ( $urlBase ) : void
리턴 void

submit() 공개 메소드

Submit data to Factual
public submit ( $submittor ) : object
리턴 object Submit Response object

toQueryString() 보호된 메소드

Converts and encodes parameter array to a query string
protected toQueryString ( $parameters ) : string
리턴 string

urlForBoost() 보호된 메소드

protected urlForBoost ( $tableName )

urlForClear() 보호된 메소드

protected urlForClear ( $tableName, $factualID )

urlForDiffs() 보호된 메소드

protected urlForDiffs ( $tableName, $query )

urlForFacets() 보호된 메소드

protected urlForFacets ( $tableName, $query )

urlForFetch() 보호된 메소드

protected urlForFetch ( $tableName, $query )

urlForFetchRow() 보호된 메소드

protected urlForFetchRow ( $tableName, $factualID )

urlForFlag() 보호된 메소드

protected urlForFlag ( $tableName, $factualID )

urlForGeocode() 보호된 메소드

protected urlForGeocode ( $tableName, $query )

urlForMatch() 보호된 메소드

protected urlForMatch ( $tableName, $query )

urlForMulti() 보호된 메소드

protected urlForMulti ( )

urlForResolve() 보호된 메소드

protected urlForResolve ( $tableName, $query )

urlForSchema() 보호된 메소드

protected urlForSchema ( $tableName )

urlForSubmit() 보호된 메소드

protected urlForSubmit ( $tableName, $factualID = null )

version() 공개 메소드

Gets driver version
public version ( ) : string
리턴 string

프로퍼티 상세

$config 보호되어 있는 프로퍼티

OAuthStore object
protected $config

$configPath 보호되어 있는 프로퍼티

geocoder object (unsupported, experimental)
protected $configPath

$connectTimeout 보호되어 있는 프로퍼티

maximum number of seconds for the network function to execute (0 = no timeout)
protected $connectTimeout

$curlTimeout 보호되어 있는 프로퍼티

debug flag
protected $curlTimeout

$debug 보호되어 있는 프로퍼티

array of queries teed up for multi
protected $debug

$factHome 보호되어 있는 프로퍼티

protected $factHome

$fetchQueue 보호되어 있는 프로퍼티

last table queried
protected $fetchQueue

$geocoder 보호되어 있는 프로퍼티

array from config.ini file on construct
protected $geocoder

$lastTable 보호되어 있는 프로퍼티

where the config file is found: path + file
protected $lastTable

$signer 보호되어 있는 프로퍼티

string assigned from config
protected $signer