PHP 클래스 Usps\USPSBase

부터: 1.0
저자: Vincent Gabriel
파일 보기 프로젝트 열기: vinceg/usps-php-api

공개 프로퍼티들

프로퍼티 타입 설명
$CURL_OPTS Default options for curl.
$testMode - set whether we are in a test mode or not

보호된 프로퍼티들

프로퍼티 타입 설명
$apiCodes - different kind of supported api calls by this wrapper
$apiVersion string The api type we are about to call.
$arrayResponse array The response represented as an array.
$errorCode integer the error code if one exists.
$errorMessage string the error message if one exists.
$headers array the headers returned from the call made.
$postFields array All the post fields we will add to the call.
$response string the response message.
$username - the usps username provided by the usps website

공개 메소드들

메소드 설명
__construct ( string $username = '' ) Constructor.
convertResponseToArray ( ) : array Return the response represented as string.
getArrayResponse ( ) : array Return the array representation of the last response.
getEndpoint ( )
getErrorCode ( ) : integer Get the error code number.
getErrorMessage ( ) : string Get the error code message.
getHeaders ( ) : array Get the headers.
getPostData ( ) : array Return the post data fields as an array.
getPostFields ( )
getResponse ( ) : mixed Get the response data.
getResponseApiName ( ) : string Response api name.
isError ( ) : boolean Did we encounter an error?
isSuccess ( ) : boolean Was the last call successful.
setApiVersion ( string $version ) : void Set the api version we are going to use.
setArrayResponse ( array $value ) : void Set the array response value.
setErrorCode ( integer $code ) : self Set the error code number.
setErrorMessage ( string $message = '' ) : self Set the error message.
setHeaders ( array $headers = [] ) : self Set the headers.
setResponse ( mixed $response = '' ) : self Set the response.
setTestMode ( boolean $value ) : void Set whether we are in a test mode or not.
setUsername ( string $username ) set the usps api username we are going to user.

보호된 메소드들

메소드 설명
doRequest ( resource $ch = null ) : string Makes an HTTP request. This method can be overriden by subclasses if developers want to do fancier things or use something other than curl to make the request.
getValueByKey ( array $array, string $key ) : mixed Find a key inside a multi dim. array.
getXMLString ( ) : string Return the xml string built that we are about to send over to the api.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( string $username = '' )
$username string - the usps api username

convertResponseToArray() 공개 메소드

Return the response represented as string.
public convertResponseToArray ( ) : array
리턴 array

doRequest() 보호된 메소드

Makes an HTTP request. This method can be overriden by subclasses if developers want to do fancier things or use something other than curl to make the request.
protected doRequest ( resource $ch = null ) : string
$ch resource Optional initialized cURL handle
리턴 string the response text

getArrayResponse() 공개 메소드

Return the array representation of the last response.
public getArrayResponse ( ) : array
리턴 array

getEndpoint() 공개 메소드

public getEndpoint ( )

getErrorCode() 공개 메소드

Get the error code number.
public getErrorCode ( ) : integer
리턴 integer error code number

getErrorMessage() 공개 메소드

Get the error code message.
public getErrorMessage ( ) : string
리턴 string error code message

getHeaders() 공개 메소드

Get the headers.
public getHeaders ( ) : array
리턴 array the headers returned from the call

getPostData() 공개 메소드

Return the post data fields as an array.
public getPostData ( ) : array
리턴 array

getPostFields() 추상적인 공개 메소드

abstract public getPostFields ( )

getResponse() 공개 메소드

Get the response data.
public getResponse ( ) : mixed
리턴 mixed the response data

getResponseApiName() 공개 메소드

Response api name.
public getResponseApiName ( ) : string
리턴 string

getValueByKey() 보호된 메소드

Find a key inside a multi dim. array.
protected getValueByKey ( array $array, string $key ) : mixed
$array array
$key string
리턴 mixed

getXMLString() 보호된 메소드

Return the xml string built that we are about to send over to the api.
protected getXMLString ( ) : string
리턴 string

isError() 공개 메소드

Did we encounter an error?
public isError ( ) : boolean
리턴 boolean

isSuccess() 공개 메소드

Was the last call successful.
public isSuccess ( ) : boolean
리턴 boolean

setApiVersion() 공개 메소드

Set the api version we are going to use.
public setApiVersion ( string $version ) : void
$version string the new api version
리턴 void

setArrayResponse() 공개 메소드

Set the array response value.
public setArrayResponse ( array $value ) : void
$value array
리턴 void

setErrorCode() 공개 메소드

Set the error code number.
public setErrorCode ( integer $code ) : self
$code integer the error code number
리턴 self

setErrorMessage() 공개 메소드

Set the error message.
public setErrorMessage ( string $message = '' ) : self
$message string the error message
리턴 self

setHeaders() 공개 메소드

Set the headers.
public setHeaders ( array $headers = [] ) : self
$headers array the headers array
리턴 self

setResponse() 공개 메소드

Set the response.
public setResponse ( mixed $response = '' ) : self
$response mixed The response returned from the call
리턴 self

setTestMode() 공개 메소드

Set whether we are in a test mode or not.
public setTestMode ( boolean $value ) : void
$value boolean
리턴 void

setUsername() 공개 메소드

set the usps api username we are going to user.
public setUsername ( string $username )
$username string - the usps api username

프로퍼티 상세

$CURL_OPTS 공개적으로 정적으로 프로퍼티

Default options for curl.
public static $CURL_OPTS

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

- different kind of supported api calls by this wrapper
protected $apiCodes

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

The api type we are about to call.
protected string $apiVersion
리턴 string

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

The response represented as an array.
protected array $arrayResponse
리턴 array

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

the error code if one exists.
protected int $errorCode
리턴 integer

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

the error message if one exists.
protected string $errorMessage
리턴 string

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

the headers returned from the call made.
protected array $headers
리턴 array

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

All the post fields we will add to the call.
protected array $postFields
리턴 array

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

the response message.
protected string $response
리턴 string

$testMode 공개적으로 정적으로 프로퍼티

- set whether we are in a test mode or not
public static $testMode

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

- the usps username provided by the usps website
protected $username