PHP Classes

File: classes/http/request/http-request-form-data.php

Recommend this page to a friend!
  Classes of Gonzalo Chumillas   HttpRequest   classes/http/request/http-request-form-data.php   Download  
File: classes/http/request/http-request-form-data.php
Role: Class source
Content type: text/plain
Description: Class source
Class: HttpRequest
Send HTTP requests to remote servers
Author: By
Last change:
Date: 9 years ago
Size: 2,274 bytes
 

Contents

Class file image Download
<?php
/**
 * This file is part of Soloproyectos common library.
 *
 * @author Gonzalo Chumillas <gchumillas@email.com>
 * @license https://github.com/soloproyectos/php.common-libs/blob/master/LICENSE BSD 2-Clause License
 * @link https://github.com/soloproyectos/php.common-libs
 */
namespace com\soloproyectos\common\http\request;

/**
 * Class HttpRequestFormData.
 *
 * @package Http
 * @author Gonzalo Chumillas <gchumillas@email.com>
 * @license https://github.com/soloproyectos/php.common-libs/blob/master/LICENSE BSD 2-Clause License
 * @link https://github.com/soloproyectos/php.common-libs
 */
class HttpRequestFormData
{
   
/**
     * MIME type.
     * @var string
     */
   
private $_mimeType = "";

   
/**
     * Filename.
     * @var string
     */
   
private $_filename = "";

   
/**
     * Data.
     * @var string
     */
   
private $_data = "";

   
/**
     * Constructor.
     *
     * Example:
     * ```php
     * $contents = file_get_contents("/path/to/image.jpg");
     * $data = new HttpRequestFormData($contents, "image/jpeg");
     * ```
     *
     * @param string $data Data
     * @param string $mimeType MIME type (not required)
     * @param string $filename Filename (not required)
     */
   
public function __construct($data, $mimeType = "", $filename = "")
    {
       
$this->_data = $data;
       
$this->_mimeType = $mimeType;
       
$this->_filename = $filename;
    }

   
/**
     * Gets the MIME type.
     *
     * @return string
     */
   
public function getMimeType()
    {
        return
$this->_mimeType;
    }

   
/**
     * Sets the MIME type.
     *
     * @param string $value MIME type
     *
     * @return void
     */
   
public function setMimeType($value)
    {
       
$this->_mimeType = $value;
    }

   
/**
     * Gets the filename.
     *
     * @return string
     */
   
public function getFilename()
    {
        return
$this->_filename;
    }

   
/**
     * Sets the filename.
     *
     * @param string $value Filename
     *
     * @return void
     */
   
public function setFilename($value)
    {
       
$this->_filename = $value;
    }

   
/**
     * Gets data.
     *
     * @return string
     */
   
public function getData()
    {
        return
$this->_data;
    }
}