Back to JsonapiDocument class

Method __construct

public
__construct
(mixed $options = array())
Class constructor.
Parameters
  • array $options Associative array of options
Since
  • 4.0.0

Method __construct - Source code

/**
 * Class constructor.
 *
 * @param   array  $options  Associative array of options
 *
 * @since  4.0.0
 */
public function __construct($options = array())
{
    parent::__construct($options);
    // Set mime type to JSON-API
    $this->_mime = 'application/vnd.api+json';
    $this->_type = 'jsonapi';
    if (\array_key_exists('api_document', $options) && $options['api_document'] instanceof Document) {
        $this->document = $options['api_document'];
    } else {
        $this->document = new Document();
    }
}