PHP Class Zendesk\API\Resources\ResourceAbstract

Inheritance: use trait Zendesk\API\Traits\Utility\ChainedParametersTrait
ファイルを表示 Open project: zendesk/zendesk_api_client_php Class Usage Examples

Protected Properties

Property Type Description
$additionalRouteParams array
$apiBasePath string
$client Zendesk\API\HttpClient
$lastId integer
$objectName String
$objectNamePlural String
$resourceName String
$routes array

Public Methods

Method Description
__construct ( HttpClient $client )
getAdditionalRouteParams ( ) : array
getLastId ( ) : integer Saves an id for future methods in the chain
getResourceName ( ) : String
getRoute ( $name, array $params = [] ) : mixed Returns a route and replaces tokenized parts of the string with the passed params
getRoutes ( ) : array Return all routes for this resource
getValidSubResources ( ) : array This returns the valid relations of this resource. Definition of what is allowed to chain after this resource.
hasAnyKey ( array $params, array $mandatory ) : boolean Check that any parameter has been supplied
hasKeys ( array $params, array $mandatory ) : boolean Check that all parameters have been supplied
setAdditionalRouteParams ( array $additionalRouteParams )
setLastId ( integer $id ) Saves an id for future methods in the chain
setRoute ( $name, $route ) Add or override an existing route
setRoutes ( array $routes ) Wrapper for adding multiple routes via setRoute
sideload ( array $fields = [] ) Enable side-loading (beta) - flags until the next chain

Protected Methods

Method Description
getResourceNameFromClass ( ) : string Return the resource name using the name of the class (used for endpoints)
setUpRoutes ( ) Sets up the available routes for the resource.

Method Details

__construct() public method

public __construct ( HttpClient $client )
$client Zendesk\API\HttpClient

getAdditionalRouteParams() public method

public getAdditionalRouteParams ( ) : array
return array

getLastId() public method

Saves an id for future methods in the chain
public getLastId ( ) : integer
return integer

getResourceName() public method

public getResourceName ( ) : String
return String

getResourceNameFromClass() protected method

Return the resource name using the name of the class (used for endpoints)
protected getResourceNameFromClass ( ) : string
return string

getRoute() public method

Returns a route and replaces tokenized parts of the string with the passed params
public getRoute ( $name, array $params = [] ) : mixed
$name
$params array
return mixed

getRoutes() public method

Return all routes for this resource
public getRoutes ( ) : array
return array

getValidSubResources() public static method

Make sure to add in this method when adding new sub resources. Example: $client->ticket()->comments(); Where ticket would have a comments as a valid sub resource. The array would look like: ['comments' => '\Zendesk\API\Resources\TicketComments']
public static getValidSubResources ( ) : array
return array

hasAnyKey() public method

Check that any parameter has been supplied
public hasAnyKey ( array $params, array $mandatory ) : boolean
$params array
$mandatory array
return boolean

hasKeys() public method

Check that all parameters have been supplied
public hasKeys ( array $params, array $mandatory ) : boolean
$params array
$mandatory array
return boolean

setAdditionalRouteParams() public method

public setAdditionalRouteParams ( array $additionalRouteParams )
$additionalRouteParams array

setLastId() public method

Saves an id for future methods in the chain
public setLastId ( integer $id )
$id integer

setRoute() public method

Add or override an existing route
public setRoute ( $name, $route )
$name
$route

setRoutes() public method

Wrapper for adding multiple routes via setRoute
public setRoutes ( array $routes )
$routes array

setUpRoutes() protected method

Sets up the available routes for the resource.
protected setUpRoutes ( )

sideload() public method

Enable side-loading (beta) - flags until the next chain
public sideload ( array $fields = [] )
$fields array

Property Details

$additionalRouteParams protected_oe property

protected array $additionalRouteParams
return array

$apiBasePath protected_oe property

protected string $apiBasePath
return string

$client protected_oe property

protected HttpClient,Zendesk\API $client
return Zendesk\API\HttpClient

$lastId protected_oe property

protected int $lastId
return integer

$objectName protected_oe property

protected String $objectName
return String

$objectNamePlural protected_oe property

protected String $objectNamePlural
return String

$resourceName protected_oe property

protected String $resourceName
return String

$routes protected_oe property

protected array $routes
return array