Overview

Namespaces

  • Crunchmail
    • Collections
    • Entities
    • Exception
    • PHPUnit
    • Resources

Classes

  • DomainsResource
  • GenericResource
  • PreviewSendResource
  • Overview
  • Namespace
  • Class

Class GenericResource

Generic resource class

Direct known subclasses

Crunchmail\Resources\DomainsResource, Crunchmail\Resources\PreviewSendResource
Namespace: Crunchmail\Resources
Located at Resources/GenericResource.php
Methods summary
public
# __construct( Crunchmail\Client $client, string $path, string $url = '' )

Instanciate a new resource

Instanciate a new resource

Parameters

$client
Client object
$path
resource path
$url
forced url
public string
# getPath( )

Return resource default path

Return resource default path

Returns

string
public Crunchmail\Resources\GenericResource
# filter( array $filters )

Registers request filters

Registers request filters

Ex: $client->messages->filter($filter)->get()

Parameters

$filters

Returns

Crunchmail\Resources\GenericResource
public Crunchmail\Collection\GenericCollection
# page( integer $page )

Direct acces to a specific page (shortcut)

Direct acces to a specific page (shortcut)

Parameters

$page
page number

Returns

Crunchmail\Collection\GenericCollection
public string
# getCollectionClass( )

Return the class name for collection, depending on resource path

Return the class name for collection, depending on resource path

Returns

string
public string
# getEntityName( )

Map the resource name to the entity name by default we remove the trailing "s", but Client::$entities can contains special cases:

Map the resource name to the entity name by default we remove the trailing "s", but Client::$entities can contains special cases:

Returns

string
public string
# getEntityClass( )

Return the class name for the entity, depending on resource path

Return the class name for the entity, depending on resource path

Returns

string
public mixed
# request( string $method, string $url = null, array $values = [], string $format = 'json' )

Execute a client request and return an entity or a collection of entities

Execute a client request and return an entity or a collection of entities

Parameters

$method
get, post, put…
$url
forced url
$values
data
$format
json or multipart

Returns

mixed

message->get(url) message->put($values, 'multipart', url) message->post($values, $options=['url' => force, 'format' => 'json])

public mixed
# callRequest( string $method, array $args, string $url = null )

Call the request() with the given method and arguments

Call the request() with the given method and arguments

Parameters

$method
method name
$args
arguments (values, format)
$url
force url

Returns

mixed
public mixed
# get( string $url = null )

Get method is different that post, patch… because the first parameter is an url (or null)

Get method is different that post, patch… because the first parameter is an url (or null)

Ex: $message->get($url);

Parameters

$url
resource url

Returns

mixed
public Crunchmail\Resources\GenericResource
# contentType( string $type )

Change resource content-type and returns it

Change resource content-type and returns it

Parameters

$type
Content Type

Returns

Crunchmail\Resources\GenericResource
public Crunchmail\Resources\GenericResource
# multipart( )

Change ressource format to multipart and returns it

Change ressource format to multipart and returns it

Returns

Crunchmail\Resources\GenericResource
public mixed
# __call( string $method, array $args )

Catch post, put… methods but no get

Catch post, put… methods but no get

Ex: $cli->messages->post($values) Ex: $cli->messages->post($values, 'multipart')

Parameters

$method
$name method name
$args
arguments

Returns

mixed
public Crunchmail\Resources\GenericResource
# __get( string $name )

Create a resource when accessing resource properties and returns it

Create a resource when accessing resource properties and returns it

Example: $client->contacts->lists

Parameters

$name
property

Returns

Crunchmail\Resources\GenericResource
Properties summary
public Crunchmail\Client $client

The client object

The client object

#
protected string $_path

Path to resource

Path to resource

#
protected string $_url

Forced url to resource

Forced url to resource

#
API documentation generated by ApiGen