Plugin Directory

Changeset 2039426


Ignore:
Timestamp:
02/26/2019 06:48:47 AM (7 years ago)
Author:
79mplus
Message:

Updated the sdk for intercom api version update to 1.1

Location:
mplus-intercom-subscription/trunk
Files:
70 edited

Legend:

Unmodified
Added
Removed
  • mplus-intercom-subscription/trunk/mplus-intercom-subscription.php

    r1951178 r2039426  
    44 * Plugin URI:        https://www.79mplus.com/intercom-subscription/
    55 * Description:       The easiest and most extendable WordPress plugin for Intercom. This lets you offer a subscription form for Intercom and offers a wide range of extensions to grow your user base with the power of Intercom.
    6  * Version:           1.0.24
     6 * Version:           1.0.25
    77 * Author:            79mplus
    88 * Author URI:        https://www.79mplus.com/
     
    2828 * Plugin version.
    2929 */
    30 define( 'MPLUSISVERSION', '1.0.24' );
     30define( 'MPLUSISVERSION', '1.0.25' );
    3131/**
    3232 * Plugin directory.
  • mplus-intercom-subscription/trunk/readme.txt

    r1960555 r2039426  
    44Tags: intercom, email, newsletter, marketing, user base, grow, communication
    55Requires at least: 4.6
    6 Tested up to: 5.0
     6Tested up to: 5.1
    77Stable tag: trunk
    8 Requires PHP: 5.2.4
     8Requires PHP: 7.2
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    134134== Changelog ==
    135135
     136= 1.0.25 =
     137* Updated intercom php SDK file
     138* Fix user not created issue.
     139
    136140= 1.0.24 =
    137141* Updated the new logo and banner.
  • mplus-intercom-subscription/trunk/vendor/autoload.php

    r1877046 r2039426  
    11<?php
    2 
    3 // File Security Check
    4 if ( ! defined( 'ABSPATH' ) ) :
    5     exit;
    6 endif;
    72
    83// autoload.php @generated by Composer
    94
    10 require_once __DIR__ . '/composer' . '/autoload_real.php';
     5require_once __DIR__ . '/composer/autoload_real.php';
    116
    12 return ComposerAutoloaderInitd17eceb359be558bbf8db8ddf58b8404::getLoader();
     7return ComposerAutoloaderInitc8232c00733f860956eb2ccd68c4460b::getLoader();
  • mplus-intercom-subscription/trunk/vendor/composer/ClassLoader.php

    r1864548 r2039426  
    1414
    1515/**
    16  * ClassLoader implements a PSR-0 class loader
    17  *
    18  * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
     16 * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
    1917 *
    2018 *     $loader = new \Composer\Autoload\ClassLoader();
     
    4038 * @author Fabien Potencier <fabien@symfony.com>
    4139 * @author Jordi Boggiano <j.boggiano@seld.be>
     40 * @see    http://www.php-fig.org/psr/psr-0/
     41 * @see    http://www.php-fig.org/psr/psr-4/
    4242 */
    4343class ClassLoader
     
    5454    private $useIncludePath = false;
    5555    private $classMap = array();
    56 
    5756    private $classMapAuthoritative = false;
     57    private $missingClasses = array();
     58    private $apcuPrefix;
    5859
    5960    public function getPrefixes()
     
    148149     *
    149150     * @param string       $prefix  The prefix/namespace, with trailing '\\'
    150      * @param array|string $paths   The PSR-0 base directories
     151     * @param array|string $paths   The PSR-4 base directories
    151152     * @param bool         $prepend Whether to prepend the directories
    152153     *
     
    273274
    274275    /**
     276     * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
     277     *
     278     * @param string|null $apcuPrefix
     279     */
     280    public function setApcuPrefix($apcuPrefix)
     281    {
     282        $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
     283    }
     284
     285    /**
     286     * The APCu prefix in use, or null if APCu caching is not enabled.
     287     *
     288     * @return string|null
     289     */
     290    public function getApcuPrefix()
     291    {
     292        return $this->apcuPrefix;
     293    }
     294
     295    /**
    275296     * Registers this instance as an autoloader.
    276297     *
     
    314335    public function findFile($class)
    315336    {
    316         // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
    317         if ('\\' == $class[0]) {
    318             $class = substr($class, 1);
    319         }
    320 
    321337        // class map lookup
    322338        if (isset($this->classMap[$class])) {
    323339            return $this->classMap[$class];
    324340        }
    325         if ($this->classMapAuthoritative) {
     341        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
    326342            return false;
    327343        }
     344        if (null !== $this->apcuPrefix) {
     345            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
     346            if ($hit) {
     347                return $file;
     348            }
     349        }
    328350
    329351        $file = $this->findFileWithExtension($class, '.php');
    330352
    331353        // Search for Hack files if we are running on HHVM
    332         if ($file === null && defined('HHVM_VERSION')) {
     354        if (false === $file && defined('HHVM_VERSION')) {
    333355            $file = $this->findFileWithExtension($class, '.hh');
    334356        }
    335357
    336         if ($file === null) {
     358        if (null !== $this->apcuPrefix) {
     359            apcu_add($this->apcuPrefix.$class, $file);
     360        }
     361
     362        if (false === $file) {
    337363            // Remember that this class does not exist.
    338             return $this->classMap[$class] = false;
     364            $this->missingClasses[$class] = true;
    339365        }
    340366
     
    349375        $first = $class[0];
    350376        if (isset($this->prefixLengthsPsr4[$first])) {
    351             foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
    352                 if (0 === strpos($class, $prefix)) {
    353                     foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
    354                         if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
     377            $subPath = $class;
     378            while (false !== $lastPos = strrpos($subPath, '\\')) {
     379                $subPath = substr($subPath, 0, $lastPos);
     380                $search = $subPath.'\\';
     381                if (isset($this->prefixDirsPsr4[$search])) {
     382                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
     383                    foreach ($this->prefixDirsPsr4[$search] as $dir) {
     384                        if (file_exists($file = $dir . $pathEnd)) {
    355385                            return $file;
    356386                        }
     
    400430            return $file;
    401431        }
     432
     433        return false;
    402434    }
    403435}
  • mplus-intercom-subscription/trunk/vendor/composer/LICENSE

    r1864548 r2039426  
    11
    2 Copyright (c) 2015 Nils Adermann, Jordi Boggiano
     2Copyright (c) Nils Adermann, Jordi Boggiano
    33
    44Permission is hereby granted, free of charge, to any person obtaining a copy
  • mplus-intercom-subscription/trunk/vendor/composer/autoload_files.php

    r1864548 r2039426  
    77
    88return array(
    9     $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
    10     $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
    11     $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
     9    '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
     10    'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
     11    'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
     12    'ddc0a4d7e61c0286f0f8593b1903e894' => $vendorDir . '/clue/stream-filter/src/functions.php',
     13    '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
     14    '8cff32064859f4559445b89279f3199c' => $vendorDir . '/php-http/message/src/filters.php',
    1215);
  • mplus-intercom-subscription/trunk/vendor/composer/autoload_psr4.php

    r1864548 r2039426  
    88return array(
    99    'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
     10    'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
    1011    'Intercom\\' => array($vendorDir . '/intercom/intercom-php/src'),
     12    'Http\\Promise\\' => array($vendorDir . '/php-http/promise/src'),
     13    'Http\\Message\\' => array($vendorDir . '/php-http/message/src', $vendorDir . '/php-http/message-factory/src'),
     14    'Http\\Discovery\\' => array($vendorDir . '/php-http/discovery/src'),
     15    'Http\\Client\\' => array($vendorDir . '/php-http/httplug/src'),
     16    'Http\\Adapter\\Guzzle6\\' => array($vendorDir . '/php-http/guzzle6-adapter/src'),
    1117    'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
    1218    'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
    1319    'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
     20    'Clue\\StreamFilter\\' => array($vendorDir . '/clue/stream-filter/src'),
    1421);
  • mplus-intercom-subscription/trunk/vendor/composer/autoload_real.php

    r1864548 r2039426  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitd17eceb359be558bbf8db8ddf58b8404
     5class ComposerAutoloaderInitc8232c00733f860956eb2ccd68c4460b
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderInitd17eceb359be558bbf8db8ddf58b8404', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInitc8232c00733f860956eb2ccd68c4460b', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderInitd17eceb359be558bbf8db8ddf58b8404', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInitc8232c00733f860956eb2ccd68c4460b', 'loadClassLoader'));
    2525
    26         $map = require __DIR__ . '/autoload_namespaces.php';
    27         foreach ($map as $namespace => $path) {
    28             $loader->set($namespace, $path);
    29         }
     26        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     27        if ($useStaticLoader) {
     28            require_once __DIR__ . '/autoload_static.php';
    3029
    31         $map = require __DIR__ . '/autoload_psr4.php';
    32         foreach ($map as $namespace => $path) {
    33             $loader->setPsr4($namespace, $path);
    34         }
     30            call_user_func(\Composer\Autoload\ComposerStaticInitc8232c00733f860956eb2ccd68c4460b::getInitializer($loader));
     31        } else {
     32            $map = require __DIR__ . '/autoload_namespaces.php';
     33            foreach ($map as $namespace => $path) {
     34                $loader->set($namespace, $path);
     35            }
    3536
    36         $classMap = require __DIR__ . '/autoload_classmap.php';
    37         if ($classMap) {
    38             $loader->addClassMap($classMap);
     37            $map = require __DIR__ . '/autoload_psr4.php';
     38            foreach ($map as $namespace => $path) {
     39                $loader->setPsr4($namespace, $path);
     40            }
     41
     42            $classMap = require __DIR__ . '/autoload_classmap.php';
     43            if ($classMap) {
     44                $loader->addClassMap($classMap);
     45            }
    3946        }
    4047
    4148        $loader->register(true);
    4249
    43         $includeFiles = require __DIR__ . '/autoload_files.php';
    44         foreach ($includeFiles as $file) {
    45             composerRequired17eceb359be558bbf8db8ddf58b8404($file);
     50        if ($useStaticLoader) {
     51            $includeFiles = Composer\Autoload\ComposerStaticInitc8232c00733f860956eb2ccd68c4460b::$files;
     52        } else {
     53            $includeFiles = require __DIR__ . '/autoload_files.php';
     54        }
     55        foreach ($includeFiles as $fileIdentifier => $file) {
     56            composerRequirec8232c00733f860956eb2ccd68c4460b($fileIdentifier, $file);
    4657        }
    4758
     
    5061}
    5162
    52 function composerRequired17eceb359be558bbf8db8ddf58b8404($file)
     63function composerRequirec8232c00733f860956eb2ccd68c4460b($fileIdentifier, $file)
    5364{
    54     require $file;
     65    if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
     66        require $file;
     67
     68        $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
     69    }
    5570}
  • mplus-intercom-subscription/trunk/vendor/composer/installed.json

    r1864548 r2039426  
    11[
    22    {
    3         "name": "guzzlehttp/promises",
    4         "version": "v1.3.1",
    5         "version_normalized": "1.3.1.0",
    6         "source": {
    7             "type": "git",
    8             "url": "https://github.com/guzzle/promises.git",
    9             "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
    10         },
    11         "dist": {
    12             "type": "zip",
    13             "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
    14             "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
    15             "shasum": ""
    16         },
    17         "require": {
    18             "php": ">=5.5.0"
    19         },
    20         "require-dev": {
    21             "phpunit/phpunit": "^4.0"
    22         },
    23         "time": "2016-12-20 10:07:11",
    24         "type": "library",
    25         "extra": {
    26             "branch-alias": {
    27                 "dev-master": "1.4-dev"
    28             }
    29         },
    30         "installation-source": "dist",
    31         "autoload": {
    32             "psr-4": {
    33                 "GuzzleHttp\\Promise\\": "src/"
     3        "name": "clue/stream-filter",
     4        "version": "v1.4.0",
     5        "version_normalized": "1.4.0.0",
     6        "source": {
     7            "type": "git",
     8            "url": "https://github.com/clue/php-stream-filter.git",
     9            "reference": "d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0"
     10        },
     11        "dist": {
     12            "type": "zip",
     13            "url": "https://api.github.com/repos/clue/php-stream-filter/zipball/d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0",
     14            "reference": "d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0",
     15            "shasum": ""
     16        },
     17        "require": {
     18            "php": ">=5.3"
     19        },
     20        "require-dev": {
     21            "phpunit/phpunit": "^5.0 || ^4.8"
     22        },
     23        "time": "2017-08-18T09:54:01+00:00",
     24        "type": "library",
     25        "installation-source": "dist",
     26        "autoload": {
     27            "psr-4": {
     28                "Clue\\StreamFilter\\": "src/"
    3429            },
    3530            "files": [
    36                 "src/functions_include.php"
     31                "src/functions.php"
    3732            ]
    3833        },
     
    4338        "authors": [
    4439            {
    45                 "name": "Michael Dowling",
    46                 "email": "mtdowling@gmail.com",
    47                 "homepage": "https://github.com/mtdowling"
    48             }
    49         ],
    50         "description": "Guzzle promises library",
    51         "keywords": [
    52             "promise"
    53         ]
    54     },
    55     {
    56         "name": "psr/http-message",
    57         "version": "1.0.1",
    58         "version_normalized": "1.0.1.0",
    59         "source": {
    60             "type": "git",
    61             "url": "https://github.com/php-fig/http-message.git",
    62             "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
    63         },
    64         "dist": {
    65             "type": "zip",
    66             "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
    67             "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
    68             "shasum": ""
    69         },
    70         "require": {
    71             "php": ">=5.3.0"
    72         },
    73         "time": "2016-08-06 14:39:51",
    74         "type": "library",
    75         "extra": {
    76             "branch-alias": {
    77                 "dev-master": "1.0.x-dev"
    78             }
    79         },
    80         "installation-source": "dist",
    81         "autoload": {
    82             "psr-4": {
    83                 "Psr\\Http\\Message\\": "src/"
    84             }
    85         },
    86         "notification-url": "https://packagist.org/downloads/",
    87         "license": [
    88             "MIT"
    89         ],
    90         "authors": [
    91             {
    92                 "name": "PHP-FIG",
    93                 "homepage": "http://www.php-fig.org/"
    94             }
    95         ],
    96         "description": "Common interface for HTTP messages",
    97         "homepage": "https://github.com/php-fig/http-message",
    98         "keywords": [
    99             "http",
    100             "http-message",
    101             "psr",
    102             "psr-7",
    103             "request",
    104             "response"
    105         ]
    106     },
    107     {
    108         "name": "guzzlehttp/psr7",
    109         "version": "1.4.2",
    110         "version_normalized": "1.4.2.0",
    111         "source": {
    112             "type": "git",
    113             "url": "https://github.com/guzzle/psr7.git",
    114             "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
    115         },
    116         "dist": {
    117             "type": "zip",
    118             "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
    119             "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
    120             "shasum": ""
    121         },
    122         "require": {
    123             "php": ">=5.4.0",
    124             "psr/http-message": "~1.0"
    125         },
    126         "provide": {
    127             "psr/http-message-implementation": "1.0"
    128         },
    129         "require-dev": {
    130             "phpunit/phpunit": "~4.0"
    131         },
    132         "time": "2017-03-20 17:10:46",
    133         "type": "library",
    134         "extra": {
    135             "branch-alias": {
    136                 "dev-master": "1.4-dev"
    137             }
    138         },
    139         "installation-source": "dist",
    140         "autoload": {
    141             "psr-4": {
    142                 "GuzzleHttp\\Psr7\\": "src/"
    143             },
    144             "files": [
    145                 "src/functions_include.php"
    146             ]
    147         },
    148         "notification-url": "https://packagist.org/downloads/",
    149         "license": [
    150             "MIT"
    151         ],
    152         "authors": [
    153             {
    154                 "name": "Michael Dowling",
    155                 "email": "mtdowling@gmail.com",
    156                 "homepage": "https://github.com/mtdowling"
    157             },
    158             {
    159                 "name": "Tobias Schultze",
    160                 "homepage": "https://github.com/Tobion"
    161             }
    162         ],
    163         "description": "PSR-7 message implementation that also provides common utility methods",
    164         "keywords": [
    165             "http",
    166             "message",
    167             "request",
    168             "response",
     40                "name": "Christian Lück",
     41                "email": "christian@lueck.tv"
     42            }
     43        ],
     44        "description": "A simple and modern approach to stream filtering in PHP",
     45        "homepage": "https://github.com/clue/php-stream-filter",
     46        "keywords": [
     47            "bucket brigade",
     48            "callback",
     49            "filter",
     50            "php_user_filter",
    16951            "stream",
    170             "uri",
    171             "url"
     52            "stream_filter_append",
     53            "stream_filter_register"
    17254        ]
    17355    },
    17456    {
    17557        "name": "guzzlehttp/guzzle",
    176         "version": "6.3.0",
    177         "version_normalized": "6.3.0.0",
     58        "version": "6.3.3",
     59        "version_normalized": "6.3.3.0",
    17860        "source": {
    17961            "type": "git",
    18062            "url": "https://github.com/guzzle/guzzle.git",
    181             "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699"
    182         },
    183         "dist": {
    184             "type": "zip",
    185             "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699",
    186             "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699",
     63            "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
     64        },
     65        "dist": {
     66            "type": "zip",
     67            "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
     68            "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
    18769            "shasum": ""
    18870        },
     
    19476        "require-dev": {
    19577            "ext-curl": "*",
    196             "phpunit/phpunit": "^4.0 || ^5.0",
     78            "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
    19779            "psr/log": "^1.0"
    19880        },
     
    20082            "psr/log": "Required for using the Log middleware"
    20183        },
    202         "time": "2017-06-22 18:50:49",
    203         "type": "library",
    204         "extra": {
    205             "branch-alias": {
    206                 "dev-master": "6.2-dev"
     84        "time": "2018-04-22T15:46:56+00:00",
     85        "type": "library",
     86        "extra": {
     87            "branch-alias": {
     88                "dev-master": "6.3-dev"
    20789            }
    20890        },
     
    240122    },
    241123    {
     124        "name": "guzzlehttp/promises",
     125        "version": "v1.3.1",
     126        "version_normalized": "1.3.1.0",
     127        "source": {
     128            "type": "git",
     129            "url": "https://github.com/guzzle/promises.git",
     130            "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
     131        },
     132        "dist": {
     133            "type": "zip",
     134            "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
     135            "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
     136            "shasum": ""
     137        },
     138        "require": {
     139            "php": ">=5.5.0"
     140        },
     141        "require-dev": {
     142            "phpunit/phpunit": "^4.0"
     143        },
     144        "time": "2016-12-20T10:07:11+00:00",
     145        "type": "library",
     146        "extra": {
     147            "branch-alias": {
     148                "dev-master": "1.4-dev"
     149            }
     150        },
     151        "installation-source": "dist",
     152        "autoload": {
     153            "psr-4": {
     154                "GuzzleHttp\\Promise\\": "src/"
     155            },
     156            "files": [
     157                "src/functions_include.php"
     158            ]
     159        },
     160        "notification-url": "https://packagist.org/downloads/",
     161        "license": [
     162            "MIT"
     163        ],
     164        "authors": [
     165            {
     166                "name": "Michael Dowling",
     167                "email": "mtdowling@gmail.com",
     168                "homepage": "https://github.com/mtdowling"
     169            }
     170        ],
     171        "description": "Guzzle promises library",
     172        "keywords": [
     173            "promise"
     174        ]
     175    },
     176    {
     177        "name": "guzzlehttp/psr7",
     178        "version": "1.5.2",
     179        "version_normalized": "1.5.2.0",
     180        "source": {
     181            "type": "git",
     182            "url": "https://github.com/guzzle/psr7.git",
     183            "reference": "9f83dded91781a01c63574e387eaa769be769115"
     184        },
     185        "dist": {
     186            "type": "zip",
     187            "url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115",
     188            "reference": "9f83dded91781a01c63574e387eaa769be769115",
     189            "shasum": ""
     190        },
     191        "require": {
     192            "php": ">=5.4.0",
     193            "psr/http-message": "~1.0",
     194            "ralouphie/getallheaders": "^2.0.5"
     195        },
     196        "provide": {
     197            "psr/http-message-implementation": "1.0"
     198        },
     199        "require-dev": {
     200            "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
     201        },
     202        "time": "2018-12-04T20:46:45+00:00",
     203        "type": "library",
     204        "extra": {
     205            "branch-alias": {
     206                "dev-master": "1.5-dev"
     207            }
     208        },
     209        "installation-source": "dist",
     210        "autoload": {
     211            "psr-4": {
     212                "GuzzleHttp\\Psr7\\": "src/"
     213            },
     214            "files": [
     215                "src/functions_include.php"
     216            ]
     217        },
     218        "notification-url": "https://packagist.org/downloads/",
     219        "license": [
     220            "MIT"
     221        ],
     222        "authors": [
     223            {
     224                "name": "Michael Dowling",
     225                "email": "mtdowling@gmail.com",
     226                "homepage": "https://github.com/mtdowling"
     227            },
     228            {
     229                "name": "Tobias Schultze",
     230                "homepage": "https://github.com/Tobion"
     231            }
     232        ],
     233        "description": "PSR-7 message implementation that also provides common utility methods",
     234        "keywords": [
     235            "http",
     236            "message",
     237            "psr-7",
     238            "request",
     239            "response",
     240            "stream",
     241            "uri",
     242            "url"
     243        ]
     244    },
     245    {
    242246        "name": "intercom/intercom-php",
    243         "version": "v3.1.8",
    244         "version_normalized": "3.1.8.0",
     247        "version": "v4.0.0",
     248        "version_normalized": "4.0.0.0",
    245249        "source": {
    246250            "type": "git",
    247251            "url": "https://github.com/intercom/intercom-php.git",
    248             "reference": "b700866052cdb39777720b6ed886c61175b240f8"
    249         },
    250         "dist": {
    251             "type": "zip",
    252             "url": "https://api.github.com/repos/intercom/intercom-php/zipball/b700866052cdb39777720b6ed886c61175b240f8",
    253             "reference": "b700866052cdb39777720b6ed886c61175b240f8",
    254             "shasum": ""
    255         },
    256         "require": {
    257             "guzzlehttp/guzzle": "~6.0",
    258             "php": ">= 5.6"
    259         },
    260         "require-dev": {
    261             "phpunit/phpunit": "4.0.*",
     252            "reference": "362e3053d741d96fe56de6ad156885ea564dd884"
     253        },
     254        "dist": {
     255            "type": "zip",
     256            "url": "https://api.github.com/repos/intercom/intercom-php/zipball/362e3053d741d96fe56de6ad156885ea564dd884",
     257            "reference": "362e3053d741d96fe56de6ad156885ea564dd884",
     258            "shasum": ""
     259        },
     260        "require": {
     261            "ext-json": "*",
     262            "php": ">= 7.1",
     263            "php-http/client-implementation": "*",
     264            "php-http/discovery": "^1.4",
     265            "php-http/httplug": "^1.0 || ^2.0",
     266            "php-http/message": "^1.7",
     267            "psr/http-message": "^1.0"
     268        },
     269        "require-dev": {
     270            "php-http/guzzle6-adapter": "^2.0",
     271            "phpunit/phpunit": "^7.0",
    262272            "squizlabs/php_codesniffer": "^3.1"
    263273        },
    264         "time": "2017-10-24 09:58:05",
     274        "time": "2019-01-15T11:17:08+00:00",
    265275        "type": "library",
    266276        "installation-source": "dist",
     
    274284        "notification-url": "https://packagist.org/downloads/",
    275285        "license": [
    276             "Apache Version 2"
     286            "Apache-2.0"
    277287        ],
    278288        "authors": [
     
    289299            "intercom.io"
    290300        ]
     301    },
     302    {
     303        "name": "php-http/discovery",
     304        "version": "1.6.0",
     305        "version_normalized": "1.6.0.0",
     306        "source": {
     307            "type": "git",
     308            "url": "https://github.com/php-http/discovery.git",
     309            "reference": "02b7ea21eafa0757af04140890a67d8ed45f83b2"
     310        },
     311        "dist": {
     312            "type": "zip",
     313            "url": "https://api.github.com/repos/php-http/discovery/zipball/02b7ea21eafa0757af04140890a67d8ed45f83b2",
     314            "reference": "02b7ea21eafa0757af04140890a67d8ed45f83b2",
     315            "shasum": ""
     316        },
     317        "require": {
     318            "php": "^5.5 || ^7.0"
     319        },
     320        "conflict": {
     321            "nyholm/psr7": "<1.0"
     322        },
     323        "require-dev": {
     324            "php-http/httplug": "^1.0 || ^2.0",
     325            "php-http/message-factory": "^1.0",
     326            "phpspec/phpspec": "^2.4",
     327            "puli/composer-plugin": "1.0.0-beta10"
     328        },
     329        "suggest": {
     330            "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories",
     331            "puli/composer-plugin": "Sets up Puli which is recommended for Discovery to work. Check http://docs.php-http.org/en/latest/discovery.html for more details."
     332        },
     333        "time": "2019-01-23T12:41:22+00:00",
     334        "type": "library",
     335        "extra": {
     336            "branch-alias": {
     337                "dev-master": "1.5-dev"
     338            }
     339        },
     340        "installation-source": "dist",
     341        "autoload": {
     342            "psr-4": {
     343                "Http\\Discovery\\": "src/"
     344            }
     345        },
     346        "notification-url": "https://packagist.org/downloads/",
     347        "license": [
     348            "MIT"
     349        ],
     350        "authors": [
     351            {
     352                "name": "Márk Sági-Kazár",
     353                "email": "mark.sagikazar@gmail.com"
     354            }
     355        ],
     356        "description": "Finds installed HTTPlug implementations and PSR-7 message factories",
     357        "homepage": "http://php-http.org",
     358        "keywords": [
     359            "adapter",
     360            "client",
     361            "discovery",
     362            "factory",
     363            "http",
     364            "message",
     365            "psr7"
     366        ]
     367    },
     368    {
     369        "name": "php-http/guzzle6-adapter",
     370        "version": "v2.0.1",
     371        "version_normalized": "2.0.1.0",
     372        "source": {
     373            "type": "git",
     374            "url": "https://github.com/php-http/guzzle6-adapter.git",
     375            "reference": "6074a4b1f4d5c21061b70bab3b8ad484282fe31f"
     376        },
     377        "dist": {
     378            "type": "zip",
     379            "url": "https://api.github.com/repos/php-http/guzzle6-adapter/zipball/6074a4b1f4d5c21061b70bab3b8ad484282fe31f",
     380            "reference": "6074a4b1f4d5c21061b70bab3b8ad484282fe31f",
     381            "shasum": ""
     382        },
     383        "require": {
     384            "guzzlehttp/guzzle": "^6.0",
     385            "php": "^7.1",
     386            "php-http/httplug": "^2.0",
     387            "psr/http-client": "^1.0"
     388        },
     389        "provide": {
     390            "php-http/async-client-implementation": "1.0",
     391            "php-http/client-implementation": "1.0",
     392            "psr/http-client-implementation": "1.0"
     393        },
     394        "require-dev": {
     395            "ext-curl": "*",
     396            "php-http/client-integration-tests": "^2.0",
     397            "phpunit/phpunit": "^7.4"
     398        },
     399        "time": "2018-12-16T14:44:03+00:00",
     400        "type": "library",
     401        "extra": {
     402            "branch-alias": {
     403                "dev-master": "2.x-dev"
     404            }
     405        },
     406        "installation-source": "dist",
     407        "autoload": {
     408            "psr-4": {
     409                "Http\\Adapter\\Guzzle6\\": "src/"
     410            }
     411        },
     412        "notification-url": "https://packagist.org/downloads/",
     413        "license": [
     414            "MIT"
     415        ],
     416        "authors": [
     417            {
     418                "name": "Márk Sági-Kazár",
     419                "email": "mark.sagikazar@gmail.com"
     420            },
     421            {
     422                "name": "David de Boer",
     423                "email": "david@ddeboer.nl"
     424            }
     425        ],
     426        "description": "Guzzle 6 HTTP Adapter",
     427        "homepage": "http://httplug.io",
     428        "keywords": [
     429            "Guzzle",
     430            "http"
     431        ]
     432    },
     433    {
     434        "name": "php-http/httplug",
     435        "version": "v2.0.0",
     436        "version_normalized": "2.0.0.0",
     437        "source": {
     438            "type": "git",
     439            "url": "https://github.com/php-http/httplug.git",
     440            "reference": "b3842537338c949f2469557ef4ad4bdc47b58603"
     441        },
     442        "dist": {
     443            "type": "zip",
     444            "url": "https://api.github.com/repos/php-http/httplug/zipball/b3842537338c949f2469557ef4ad4bdc47b58603",
     445            "reference": "b3842537338c949f2469557ef4ad4bdc47b58603",
     446            "shasum": ""
     447        },
     448        "require": {
     449            "php": "^7.0",
     450            "php-http/promise": "^1.0",
     451            "psr/http-client": "^1.0",
     452            "psr/http-message": "^1.0"
     453        },
     454        "require-dev": {
     455            "henrikbjorn/phpspec-code-coverage": "^1.0",
     456            "phpspec/phpspec": "^2.4"
     457        },
     458        "time": "2018-10-31T09:14:44+00:00",
     459        "type": "library",
     460        "extra": {
     461            "branch-alias": {
     462                "dev-master": "2.0.x-dev"
     463            }
     464        },
     465        "installation-source": "dist",
     466        "autoload": {
     467            "psr-4": {
     468                "Http\\Client\\": "src/"
     469            }
     470        },
     471        "notification-url": "https://packagist.org/downloads/",
     472        "license": [
     473            "MIT"
     474        ],
     475        "authors": [
     476            {
     477                "name": "Eric GELOEN",
     478                "email": "geloen.eric@gmail.com"
     479            },
     480            {
     481                "name": "Márk Sági-Kazár",
     482                "email": "mark.sagikazar@gmail.com"
     483            }
     484        ],
     485        "description": "HTTPlug, the HTTP client abstraction for PHP",
     486        "homepage": "http://httplug.io",
     487        "keywords": [
     488            "client",
     489            "http"
     490        ]
     491    },
     492    {
     493        "name": "php-http/message",
     494        "version": "1.7.2",
     495        "version_normalized": "1.7.2.0",
     496        "source": {
     497            "type": "git",
     498            "url": "https://github.com/php-http/message.git",
     499            "reference": "b159ffe570dffd335e22ef0b91a946eacb182fa1"
     500        },
     501        "dist": {
     502            "type": "zip",
     503            "url": "https://api.github.com/repos/php-http/message/zipball/b159ffe570dffd335e22ef0b91a946eacb182fa1",
     504            "reference": "b159ffe570dffd335e22ef0b91a946eacb182fa1",
     505            "shasum": ""
     506        },
     507        "require": {
     508            "clue/stream-filter": "^1.4",
     509            "php": "^5.4 || ^7.0",
     510            "php-http/message-factory": "^1.0.2",
     511            "psr/http-message": "^1.0"
     512        },
     513        "provide": {
     514            "php-http/message-factory-implementation": "1.0"
     515        },
     516        "require-dev": {
     517            "akeneo/phpspec-skip-example-extension": "^1.0",
     518            "coduo/phpspec-data-provider-extension": "^1.0",
     519            "ext-zlib": "*",
     520            "guzzlehttp/psr7": "^1.0",
     521            "henrikbjorn/phpspec-code-coverage": "^1.0",
     522            "phpspec/phpspec": "^2.4",
     523            "slim/slim": "^3.0",
     524            "zendframework/zend-diactoros": "^1.0"
     525        },
     526        "suggest": {
     527            "ext-zlib": "Used with compressor/decompressor streams",
     528            "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories",
     529            "slim/slim": "Used with Slim Framework PSR-7 implementation",
     530            "zendframework/zend-diactoros": "Used with Diactoros Factories"
     531        },
     532        "time": "2018-11-01T09:32:41+00:00",
     533        "type": "library",
     534        "extra": {
     535            "branch-alias": {
     536                "dev-master": "1.6-dev"
     537            }
     538        },
     539        "installation-source": "dist",
     540        "autoload": {
     541            "psr-4": {
     542                "Http\\Message\\": "src/"
     543            },
     544            "files": [
     545                "src/filters.php"
     546            ]
     547        },
     548        "notification-url": "https://packagist.org/downloads/",
     549        "license": [
     550            "MIT"
     551        ],
     552        "authors": [
     553            {
     554                "name": "Márk Sági-Kazár",
     555                "email": "mark.sagikazar@gmail.com"
     556            }
     557        ],
     558        "description": "HTTP Message related tools",
     559        "homepage": "http://php-http.org",
     560        "keywords": [
     561            "http",
     562            "message",
     563            "psr-7"
     564        ]
     565    },
     566    {
     567        "name": "php-http/message-factory",
     568        "version": "v1.0.2",
     569        "version_normalized": "1.0.2.0",
     570        "source": {
     571            "type": "git",
     572            "url": "https://github.com/php-http/message-factory.git",
     573            "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1"
     574        },
     575        "dist": {
     576            "type": "zip",
     577            "url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1",
     578            "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1",
     579            "shasum": ""
     580        },
     581        "require": {
     582            "php": ">=5.4",
     583            "psr/http-message": "^1.0"
     584        },
     585        "time": "2015-12-19T14:08:53+00:00",
     586        "type": "library",
     587        "extra": {
     588            "branch-alias": {
     589                "dev-master": "1.0-dev"
     590            }
     591        },
     592        "installation-source": "dist",
     593        "autoload": {
     594            "psr-4": {
     595                "Http\\Message\\": "src/"
     596            }
     597        },
     598        "notification-url": "https://packagist.org/downloads/",
     599        "license": [
     600            "MIT"
     601        ],
     602        "authors": [
     603            {
     604                "name": "Márk Sági-Kazár",
     605                "email": "mark.sagikazar@gmail.com"
     606            }
     607        ],
     608        "description": "Factory interfaces for PSR-7 HTTP Message",
     609        "homepage": "http://php-http.org",
     610        "keywords": [
     611            "factory",
     612            "http",
     613            "message",
     614            "stream",
     615            "uri"
     616        ]
     617    },
     618    {
     619        "name": "php-http/promise",
     620        "version": "v1.0.0",
     621        "version_normalized": "1.0.0.0",
     622        "source": {
     623            "type": "git",
     624            "url": "https://github.com/php-http/promise.git",
     625            "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980"
     626        },
     627        "dist": {
     628            "type": "zip",
     629            "url": "https://api.github.com/repos/php-http/promise/zipball/dc494cdc9d7160b9a09bd5573272195242ce7980",
     630            "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980",
     631            "shasum": ""
     632        },
     633        "require-dev": {
     634            "henrikbjorn/phpspec-code-coverage": "^1.0",
     635            "phpspec/phpspec": "^2.4"
     636        },
     637        "time": "2016-01-26T13:27:02+00:00",
     638        "type": "library",
     639        "extra": {
     640            "branch-alias": {
     641                "dev-master": "1.1-dev"
     642            }
     643        },
     644        "installation-source": "dist",
     645        "autoload": {
     646            "psr-4": {
     647                "Http\\Promise\\": "src/"
     648            }
     649        },
     650        "notification-url": "https://packagist.org/downloads/",
     651        "license": [
     652            "MIT"
     653        ],
     654        "authors": [
     655            {
     656                "name": "Márk Sági-Kazár",
     657                "email": "mark.sagikazar@gmail.com"
     658            },
     659            {
     660                "name": "Joel Wurtz",
     661                "email": "joel.wurtz@gmail.com"
     662            }
     663        ],
     664        "description": "Promise used for asynchronous HTTP requests",
     665        "homepage": "http://httplug.io",
     666        "keywords": [
     667            "promise"
     668        ]
     669    },
     670    {
     671        "name": "psr/http-client",
     672        "version": "1.0.0",
     673        "version_normalized": "1.0.0.0",
     674        "source": {
     675            "type": "git",
     676            "url": "https://github.com/php-fig/http-client.git",
     677            "reference": "496a823ef742b632934724bf769560c2a5c7c44e"
     678        },
     679        "dist": {
     680            "type": "zip",
     681            "url": "https://api.github.com/repos/php-fig/http-client/zipball/496a823ef742b632934724bf769560c2a5c7c44e",
     682            "reference": "496a823ef742b632934724bf769560c2a5c7c44e",
     683            "shasum": ""
     684        },
     685        "require": {
     686            "php": "^7.0",
     687            "psr/http-message": "^1.0"
     688        },
     689        "time": "2018-10-30T23:29:13+00:00",
     690        "type": "library",
     691        "extra": {
     692            "branch-alias": {
     693                "dev-master": "1.0.x-dev"
     694            }
     695        },
     696        "installation-source": "dist",
     697        "autoload": {
     698            "psr-4": {
     699                "Psr\\Http\\Client\\": "src/"
     700            }
     701        },
     702        "notification-url": "https://packagist.org/downloads/",
     703        "license": [
     704            "MIT"
     705        ],
     706        "authors": [
     707            {
     708                "name": "PHP-FIG",
     709                "homepage": "http://www.php-fig.org/"
     710            }
     711        ],
     712        "description": "Common interface for HTTP clients",
     713        "homepage": "https://github.com/php-fig/http-client",
     714        "keywords": [
     715            "http",
     716            "http-client",
     717            "psr",
     718            "psr-18"
     719        ]
     720    },
     721    {
     722        "name": "psr/http-message",
     723        "version": "1.0.1",
     724        "version_normalized": "1.0.1.0",
     725        "source": {
     726            "type": "git",
     727            "url": "https://github.com/php-fig/http-message.git",
     728            "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
     729        },
     730        "dist": {
     731            "type": "zip",
     732            "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
     733            "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
     734            "shasum": ""
     735        },
     736        "require": {
     737            "php": ">=5.3.0"
     738        },
     739        "time": "2016-08-06T14:39:51+00:00",
     740        "type": "library",
     741        "extra": {
     742            "branch-alias": {
     743                "dev-master": "1.0.x-dev"
     744            }
     745        },
     746        "installation-source": "dist",
     747        "autoload": {
     748            "psr-4": {
     749                "Psr\\Http\\Message\\": "src/"
     750            }
     751        },
     752        "notification-url": "https://packagist.org/downloads/",
     753        "license": [
     754            "MIT"
     755        ],
     756        "authors": [
     757            {
     758                "name": "PHP-FIG",
     759                "homepage": "http://www.php-fig.org/"
     760            }
     761        ],
     762        "description": "Common interface for HTTP messages",
     763        "homepage": "https://github.com/php-fig/http-message",
     764        "keywords": [
     765            "http",
     766            "http-message",
     767            "psr",
     768            "psr-7",
     769            "request",
     770            "response"
     771        ]
     772    },
     773    {
     774        "name": "ralouphie/getallheaders",
     775        "version": "2.0.5",
     776        "version_normalized": "2.0.5.0",
     777        "source": {
     778            "type": "git",
     779            "url": "https://github.com/ralouphie/getallheaders.git",
     780            "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa"
     781        },
     782        "dist": {
     783            "type": "zip",
     784            "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa",
     785            "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa",
     786            "shasum": ""
     787        },
     788        "require": {
     789            "php": ">=5.3"
     790        },
     791        "require-dev": {
     792            "phpunit/phpunit": "~3.7.0",
     793            "satooshi/php-coveralls": ">=1.0"
     794        },
     795        "time": "2016-02-11T07:05:27+00:00",
     796        "type": "library",
     797        "installation-source": "dist",
     798        "autoload": {
     799            "files": [
     800                "src/getallheaders.php"
     801            ]
     802        },
     803        "notification-url": "https://packagist.org/downloads/",
     804        "license": [
     805            "MIT"
     806        ],
     807        "authors": [
     808            {
     809                "name": "Ralph Khattar",
     810                "email": "ralph.khattar@gmail.com"
     811            }
     812        ],
     813        "description": "A polyfill for getallheaders."
    291814    }
    292815]
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/CHANGELOG.md

    r1864548 r2039426  
    1 # CHANGELOG
     1# Change Log
     2
     3## 6.3.3 - 2018-04-22
     4
     5* Fix: Default headers when decode_content is specified
     6
     7
     8## 6.3.2 - 2018-03-26
     9
     10* Fix: Release process
     11
     12
     13## 6.3.1 - 2018-03-26
     14
     15* Bug fix: Parsing 0 epoch expiry times in cookies [#2014](https://github.com/guzzle/guzzle/pull/2014)
     16* Improvement: Better ConnectException detection [#2012](https://github.com/guzzle/guzzle/pull/2012)
     17* Bug fix: Malformed domain that contains a "/" [#1999](https://github.com/guzzle/guzzle/pull/1999)
     18* Bug fix: Undefined offset when a cookie has no first key-value pair [#1998](https://github.com/guzzle/guzzle/pull/1998)
     19* Improvement: Support PHPUnit 6 [#1953](https://github.com/guzzle/guzzle/pull/1953)
     20* Bug fix: Support empty headers [#1915](https://github.com/guzzle/guzzle/pull/1915)
     21* Bug fix: Ignore case during header modifications [#1916](https://github.com/guzzle/guzzle/pull/1916)
     22
     23+ Minor code cleanups, documentation fixes and clarifications.
     24
    225
    326## 6.3.0 - 2017-06-22
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/LICENSE

    r1864548 r2039426  
    1 Copyright (c) 2011-2016 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
     1Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling <mtdowling@gmail.com>
    22
    33Permission is hereby granted, free of charge, to any person obtaining a copy
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/README.md

    r1864548 r2039426  
    22=======================
    33
    4 [![Build Status](https://travis-ci.org/guzzle/guzzle.svg?branch=master)](https://travis-ci.org/guzzle/guzzle)
     4[![Latest Version](https://img.shields.io/github/release/guzzle/guzzle.svg?style=flat-square)](https://github.com/guzzle/guzzle/releases)
     5[![Build Status](https://img.shields.io/travis/guzzle/guzzle.svg?style=flat-square)](https://travis-ci.org/guzzle/guzzle)
     6[![Total Downloads](https://img.shields.io/packagist/dt/guzzlehttp/guzzle.svg?style=flat-square)](https://packagist.org/packages/guzzlehttp/guzzle)
    57
    68Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/composer.json

    r1864548 r2039426  
    2020    "require-dev": {
    2121        "ext-curl": "*",
    22         "phpunit/phpunit": "^4.0 || ^5.0",
     22        "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
    2323        "psr/log": "^1.0"
    2424    },
     
    3939    "extra": {
    4040        "branch-alias": {
    41             "dev-master": "6.2-dev"
     41            "dev-master": "6.3-dev"
    4242        }
    4343    }
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/Client.php

    r1864548 r2039426  
    291291    private function applyOptions(RequestInterface $request, array &$options)
    292292    {
    293         $modify = [];
     293        $modify = [
     294            'set_headers' => [],
     295        ];
     296
     297        if (isset($options['headers'])) {
     298            $modify['set_headers'] = $options['headers'];
     299            unset($options['headers']);
     300        }
    294301
    295302        if (isset($options['form_params'])) {
     
    303310            $options['body'] = http_build_query($options['form_params'], '', '&');
    304311            unset($options['form_params']);
     312            // Ensure that we don't have the header in different case and set the new value.
     313            $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
    305314            $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded';
    306315        }
     
    314323            $options['body'] = \GuzzleHttp\json_encode($options['json']);
    315324            unset($options['json']);
     325            // Ensure that we don't have the header in different case and set the new value.
     326            $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
    316327            $options['_conditional']['Content-Type'] = 'application/json';
    317328        }
     
    320331            && $options['decode_content'] !== true
    321332        ) {
     333            // Ensure that we don't have the header in different case and set the new value.
     334            $options['_conditional'] = Psr7\_caseless_remove(['Accept-Encoding'], $options['_conditional']);
    322335            $modify['set_headers']['Accept-Encoding'] = $options['decode_content'];
    323         }
    324 
    325         if (isset($options['headers'])) {
    326             if (isset($modify['set_headers'])) {
    327                 $modify['set_headers'] = $options['headers'] + $modify['set_headers'];
    328             } else {
    329                 $modify['set_headers'] = $options['headers'];
    330             }
    331             unset($options['headers']);
    332336        }
    333337
     
    345349            switch ($type) {
    346350                case 'basic':
     351                    // Ensure that we don't have the header in different case and set the new value.
     352                    $modify['set_headers'] = Psr7\_caseless_remove(['Authorization'], $modify['set_headers']);
    347353                    $modify['set_headers']['Authorization'] = 'Basic '
    348354                        . base64_encode("$value[0]:$value[1]");
     
    383389        if ($request->getBody() instanceof Psr7\MultipartStream) {
    384390            // Use a multipart/form-data POST if a Content-Type is not set.
     391            // Ensure that we don't have the header in different case and set the new value.
     392            $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']);
    385393            $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary='
    386394                . $request->getBody()->getBoundary();
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/ClientInterface.php

    r1864548 r2039426  
    1313interface ClientInterface
    1414{
    15     const VERSION = '6.2.1';
     15    const VERSION = '6.3.3';
    1616
    1717    /**
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php

    r1864548 r2039426  
    9696    {
    9797        // don't allow a null name
    98         if($name === null) {
     98        if ($name === null) {
    9999            return null;
    100100        }
    101         foreach($this->cookies as $cookie) {
    102             if($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) {
     101        foreach ($this->cookies as $cookie) {
     102            if ($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) {
    103103                return $cookie;
    104104            }
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php

    r1864548 r2039426  
    1616     * Create a new SessionCookieJar object
    1717     *
    18      * @param string $sessionKey        Session key name to store the cookie 
     18     * @param string $sessionKey        Session key name to store the cookie
    1919     *                                  data in session
    2020     * @param bool $storeSessionCookies Set to true to store session cookies
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php

    r1864548 r2039426  
    3636        // Explode the cookie string using a series of semicolons
    3737        $pieces = array_filter(array_map('trim', explode(';', $cookie)));
    38         // The name of the cookie (first kvp) must include an equal sign.
    39         if (empty($pieces) || !strpos($pieces[0], '=')) {
     38        // The name of the cookie (first kvp) must exist and include an equal sign.
     39        if (empty($pieces[0]) || !strpos($pieces[0], '=')) {
    4040            return new self($data);
    4141        }
     
    4343        // Add the cookie pieces into the parsed data array
    4444        foreach ($pieces as $part) {
    45 
    4645            $cookieParts = explode('=', $part, 2);
    4746            $key = trim($cookieParts[0]);
     
    350349        }
    351350
    352         return (bool) preg_match('/\.' . preg_quote($cookieDomain) . '$/', $domain);
     351        return (bool) preg_match('/\.' . preg_quote($cookieDomain, '/') . '$/', $domain);
    353352    }
    354353
     
    360359    public function isExpired()
    361360    {
    362         return $this->getExpires() && time() > $this->getExpires();
     361        return $this->getExpires() !== null && time() > $this->getExpires();
    363362    }
    364363
     
    379378        if (preg_match(
    380379            '/[\x00-\x20\x22\x28-\x29\x2c\x2f\x3a-\x40\x5c\x7b\x7d\x7f]/',
    381             $name)
    382         ) {
     380            $name
     381        )) {
    383382            return 'Cookie name must not contain invalid characters: ASCII '
    384383                . 'Control characters (0-31;127), space, tab and the '
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php

    r1864548 r2039426  
    22namespace GuzzleHttp\Exception;
    33
     4/**
     5 * @method string getMessage()
     6 * @method \Throwable|null getPrevious()
     7 * @method mixed getCode()
     8 * @method string getFile()
     9 * @method int getLine()
     10 * @method array getTrace()
     11 * @method string getTraceAsString()
     12 */
    413interface GuzzleException {}
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php

    r1864548 r2039426  
    55use GuzzleHttp\Exception\ConnectException;
    66use GuzzleHttp\Promise\FulfilledPromise;
    7 use GuzzleHttp\Promise\RejectedPromise;
    87use GuzzleHttp\Psr7;
    98use GuzzleHttp\Psr7\LazyOpenStream;
     
    289288        foreach ($conf['_headers'] as $name => $values) {
    290289            foreach ($values as $value) {
    291                 $conf[CURLOPT_HTTPHEADER][] = "$name: $value";
     290                $value = (string) $value;
     291                if ($value === '') {
     292                    // cURL requires a special format for empty headers.
     293                    // See https://github.com/guzzle/guzzle/issues/1882 for more details.
     294                    $conf[CURLOPT_HTTPHEADER][] = "$name;";
     295                } else {
     296                    $conf[CURLOPT_HTTPHEADER][] = "$name: $value";
     297                }
    292298            }
    293299        }
     
    389395            if ('v4' === $options['force_ip_resolve']) {
    390396                $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
    391             } else if ('v6' === $options['force_ip_resolve']) {
     397            } elseif ('v6' === $options['force_ip_resolve']) {
    392398                $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6;
    393399            }
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php

    r1864548 r2039426  
    6666        $promise = new Promise(
    6767            [$this, 'execute'],
    68             function () use ($id) { return $this->cancel($id); }
     68            function () use ($id) {
     69                return $this->cancel($id);
     70            }
    6971        );
    7072
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php

    r1864548 r2039426  
    55use GuzzleHttp\Exception\ConnectException;
    66use GuzzleHttp\Promise\FulfilledPromise;
    7 use GuzzleHttp\Promise\RejectedPromise;
    87use GuzzleHttp\Promise\PromiseInterface;
    98use GuzzleHttp\Psr7;
     
    6261                || strpos($message, 'Connection refused')
    6362                || strpos($message, "couldn't connect to host") // error on HHVM
     63                || strpos($message, "connection attempt failed")
    6464            ) {
    6565                $e = new ConnectException($e->getMessage(), $request, $e);
     
    104104        $reason = isset($parts[2]) ? $parts[2] : null;
    105105        $headers = \GuzzleHttp\headers_from_lines($hdrs);
    106         list ($stream, $headers) = $this->checkDecode($options, $headers, $stream);
     106        list($stream, $headers) = $this->checkDecode($options, $headers, $stream);
    107107        $stream = Psr7\stream_for($stream);
    108108        $sink = $stream;
     
    277277
    278278        $params = [];
    279         $context = $this->getDefaultContext($request, $options);
     279        $context = $this->getDefaultContext($request);
    280280
    281281        if (isset($options['on_headers']) && !is_callable($options['on_headers'])) {
     
    308308            && 'ntlm' == $options['auth'][2]
    309309        ) {
    310 
    311310            throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler');
    312311        }
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/HandlerStack.php

    r1864548 r2039426  
    2323     *
    2424     * The returned handler will wrap the provided handler or use the most
    25      * appropriate default handler for you system. The returned HandlerStack has
     25     * appropriate default handler for your system. The returned HandlerStack has
    2626     * support for cookies, redirects, HTTP error exceptions, and preparing a body
    2727     * before sending.
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/MessageFormatter.php

    r1864548 r2039426  
    2020 * - {method}:         Method of the request
    2121 * - {uri}:            URI of the request
    22  * - {host}:           Host of the request
    2322 * - {version}:        Protocol version
    2423 * - {target}:         Request target of the request (path + query + fragment)
     
    7574            '/{\s*([A-Za-z_\-\.0-9]+)\s*}/',
    7675            function (array $matches) use ($request, $response, $error, &$cache) {
    77 
    7876                if (isset($cache[$matches[1]])) {
    7977                    return $cache[$matches[1]];
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/Middleware.php

    r1864548 r2039426  
    3535                $request = $cookieJar->withCookieHeader($request);
    3636                return $handler($request, $options)
    37                     ->then(function ($response) use ($cookieJar, $request) {
    38                         $cookieJar->extractCookies($request, $response);
    39                         return $response;
    40                     }
     37                    ->then(
     38                        function ($response) use ($cookieJar, $request) {
     39                            $cookieJar->extractCookies($request, $response);
     40                            return $response;
     41                        }
    4142                );
    4243            };
     
    7374     * Middleware that pushes history data to an ArrayAccess container.
    7475     *
    75      * @param array $container Container to hold the history (by reference).
     76     * @param array|\ArrayAccess $container Container to hold the history (by reference).
    7677     *
    7778     * @return callable Returns a function that accepts the next handler.
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/UriTemplate.php

    r1864548 r2039426  
    108108
    109109        foreach ($parsed['values'] as $value) {
    110 
    111110            if (!isset($this->variables[$value['value']])) {
    112111                continue;
     
    118117
    119118            if (is_array($variable)) {
    120 
    121119                $isAssoc = $this->isAssoc($variable);
    122120                $kvp = [];
    123121                foreach ($variable as $key => $var) {
    124 
    125122                    if ($isAssoc) {
    126123                        $key = rawurlencode($key);
     
    180177                    $expanded = implode(',', $kvp);
    181178                }
    182 
    183179            } else {
    184180                if ($value['modifier'] === ':') {
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/guzzle/src/functions.php

    r1864548 r2039426  
    303303    if (JSON_ERROR_NONE !== json_last_error()) {
    304304        throw new \InvalidArgumentException(
    305             'json_decode error: ' . json_last_error_msg());
     305            'json_decode error: ' . json_last_error_msg()
     306        );
    306307    }
    307308
     
    325326    if (JSON_ERROR_NONE !== json_last_error()) {
    326327        throw new \InvalidArgumentException(
    327             'json_encode error: ' . json_last_error_msg());
     328            'json_encode error: ' . json_last_error_msg()
     329        );
    328330    }
    329331
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/CHANGELOG.md

    r1864548 r2039426  
    1 # CHANGELOG
    2 
    3 ## 1.4.2 - 2017-03-20
    4 
    5 * Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing
     1# Change Log
     2
     3
     4All notable changes to this project will be documented in this file.
     5
     6The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
     7and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
     8
     9
     10## [Unreleased]
     11
     12
     13## [1.5.2] - 2018-12-04
     14
     15### Fixed
     16
     17- Check body size when getting the message summary
     18
     19
     20## [1.5.1] - 2018-12-04
     21
     22### Fixed
     23
     24- Get the summary of a body only if it is readable
     25
     26
     27## [1.5.0] - 2018-12-03
     28
     29### Added
     30
     31- Response first-line to response string exception (fixes #145)
     32- A test for #129 behavior
     33- `get_message_body_summary` function in order to get the message summary
     34- `3gp` and `mkv` mime types
     35
     36### Changed
     37
     38- Clarify exception message when stream is detached
     39
     40### Deprecated
     41
     42- Deprecated parsing folded header lines as per RFC 7230
     43
     44### Fixed
     45
     46- Fix `AppendStream::detach` to not close streams
     47- `InflateStream` preserves `isSeekable` attribute of the underlying stream
     48- `ServerRequest::getUriFromGlobals` to support URLs in query parameters
     49
     50
     51Several other fixes and improvements.
     52
     53
     54## [1.4.2] - 2017-03-20
     55
     56### Fixed
     57
     58- Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing
    659  calls to `trigger_error` when deprecated methods are invoked.
    760
    8 ## 1.4.1 - 2017-02-27
    9 
    10 * Reverted BC break by reintroducing behavior to automagically fix a URI with a
     61
     62## [1.4.1] - 2017-02-27
     63
     64### Added
     65
     66- Rriggering of silenced deprecation warnings.
     67
     68### Fixed
     69
     70- Reverted BC break by reintroducing behavior to automagically fix a URI with a
    1171  relative path and an authority by adding a leading slash to the path. It's only
    1272  deprecated now.
    13 * Added triggering of silenced deprecation warnings.
    14 
    15 ## 1.4.0 - 2017-02-21
    16 
    17 * Fix `Stream::read` when length parameter <= 0.
    18 * `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
    19 * Fix `ServerRequest::getUriFromGlobals` when `Host` header contains port.
    20 * Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
    21 * Allow `parse_response` to parse a response without delimiting space and reason.
    22 * Ensure each URI modification results in a valid URI according to PSR-7 discussions.
    23   Invalid modifications will throw an exception instead of returning a wrong URI or
    24   doing some magic.
    25   - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
    26     because the path of a URI with an authority must start with a slash "/" or be empty
    27   - `(new Uri())->withScheme('http')` will return `'http://localhost'`
    28 * Fix compatibility of URIs with `file` scheme and empty host.
    29 * Added common URI utility methods based on RFC 3986 (see documentation in the readme):
     73
     74
     75## [1.4.0] - 2017-02-21
     76
     77### Added
     78
     79- Added common URI utility methods based on RFC 3986 (see documentation in the readme):
    3080  - `Uri::isDefaultPort`
    3181  - `Uri::isAbsolute`
     
    3888  - `UriNormalizer::isEquivalent`
    3989  - `UriResolver::relativize`
    40 * Deprecated `Uri::resolve` in favor of `UriResolver::resolve`
    41 * Deprecated `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
    42 
    43 ## 1.3.1 - 2016-06-25
    44 
    45 * Fix `Uri::__toString` for network path references, e.g. `//example.org`.
    46 * Fix missing lowercase normalization for host.
    47 * Fix handling of URI components in case they are `'0'` in a lot of places,
     90
     91### Changed
     92
     93- Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
     94- Allow `parse_response` to parse a response without delimiting space and reason.
     95- Ensure each URI modification results in a valid URI according to PSR-7 discussions.
     96  Invalid modifications will throw an exception instead of returning a wrong URI or
     97  doing some magic.
     98  - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
     99    because the path of a URI with an authority must start with a slash "/" or be empty
     100  - `(new Uri())->withScheme('http')` will return `'http://localhost'`
     101
     102### Deprecated
     103
     104- `Uri::resolve` in favor of `UriResolver::resolve`
     105- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
     106
     107### Fixed
     108
     109- `Stream::read` when length parameter <= 0.
     110- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
     111- `ServerRequest::getUriFromGlobals` when `Host` header contains port.
     112- Compatibility of URIs with `file` scheme and empty host.
     113
     114
     115## [1.3.1] - 2016-06-25
     116
     117### Fixed
     118
     119- `Uri::__toString` for network path references, e.g. `//example.org`.
     120- Missing lowercase normalization for host.
     121- Handling of URI components in case they are `'0'` in a lot of places,
    48122  e.g. as a user info password.
    49 * Fix `Uri::withAddedHeader` to correctly merge headers with different case.
    50 * Fix trimming of header values in `Uri::withAddedHeader`. Header values may
     123- `Uri::withAddedHeader` to correctly merge headers with different case.
     124- Trimming of header values in `Uri::withAddedHeader`. Header values may
    51125  be surrounded by whitespace which should be ignored according to RFC 7230
    52126  Section 3.2.4. This does not apply to header names.
    53 * Fix `Uri::withAddedHeader` with an array of header values.
    54 * Fix `Uri::resolve` when base path has no slash and handling of fragment.
    55 * Fix handling of encoding in `Uri::with(out)QueryValue` so one can pass the
     127- `Uri::withAddedHeader` with an array of header values.
     128- `Uri::resolve` when base path has no slash and handling of fragment.
     129- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the
    56130  key/value both in encoded as well as decoded form to those methods. This is
    57131  consistent with withPath, withQuery etc.
    58 * Fix `ServerRequest::withoutAttribute` when attribute value is null.
    59 
    60 ## 1.3.0 - 2016-04-13
    61 
    62 * Added remaining interfaces needed for full PSR7 compatibility
     132- `ServerRequest::withoutAttribute` when attribute value is null.
     133
     134
     135## [1.3.0] - 2016-04-13
     136
     137### Added
     138
     139- Remaining interfaces needed for full PSR7 compatibility
    63140  (ServerRequestInterface, UploadedFileInterface, etc.).
    64 * Added support for stream_for from scalars.
    65 * Can now extend Uri.
    66 * Fixed a bug in validating request methods by making it more permissive.
    67 
    68 ## 1.2.3 - 2016-02-18
    69 
    70 * Fixed support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
     141- Support for stream_for from scalars.
     142
     143### Changed
     144
     145- Can now extend Uri.
     146
     147### Fixed
     148- A bug in validating request methods by making it more permissive.
     149
     150
     151## [1.2.3] - 2016-02-18
     152
     153### Fixed
     154
     155- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
    71156  streams, which can sometimes return fewer bytes than requested with `fread`.
    72 * Fixed handling of gzipped responses with FNAME headers.
    73 
    74 ## 1.2.2 - 2016-01-22
    75 
    76 * Added support for URIs without any authority.
    77 * Added support for HTTP 451 'Unavailable For Legal Reasons.'
    78 * Added support for using '0' as a filename.
    79 * Added support for including non-standard ports in Host headers.
    80 
    81 ## 1.2.1 - 2015-11-02
    82 
    83 * Now supporting negative offsets when seeking to SEEK_END.
    84 
    85 ## 1.2.0 - 2015-08-15
    86 
    87 * Body as `"0"` is now properly added to a response.
    88 * Now allowing forward seeking in CachingStream.
    89 * Now properly parsing HTTP requests that contain proxy targets in
     157- Handling of gzipped responses with FNAME headers.
     158
     159
     160## [1.2.2] - 2016-01-22
     161
     162### Added
     163
     164- Support for URIs without any authority.
     165- Support for HTTP 451 'Unavailable For Legal Reasons.'
     166- Support for using '0' as a filename.
     167- Support for including non-standard ports in Host headers.
     168
     169
     170## [1.2.1] - 2015-11-02
     171
     172### Changes
     173
     174- Now supporting negative offsets when seeking to SEEK_END.
     175
     176
     177## [1.2.0] - 2015-08-15
     178
     179### Changed
     180
     181- Body as `"0"` is now properly added to a response.
     182- Now allowing forward seeking in CachingStream.
     183- Now properly parsing HTTP requests that contain proxy targets in
    90184  `parse_request`.
    91 * functions.php is now conditionally required.
    92 * user-info is no longer dropped when resolving URIs.
    93 
    94 ## 1.1.0 - 2015-06-24
    95 
    96 * URIs can now be relative.
    97 * `multipart/form-data` headers are now overridden case-insensitively.
    98 * URI paths no longer encode the following characters because they are allowed
     185- functions.php is now conditionally required.
     186- user-info is no longer dropped when resolving URIs.
     187
     188
     189## [1.1.0] - 2015-06-24
     190
     191### Changed
     192
     193- URIs can now be relative.
     194- `multipart/form-data` headers are now overridden case-insensitively.
     195- URI paths no longer encode the following characters because they are allowed
    99196  in URIs: "(", ")", "*", "!", "'"
    100 * A port is no longer added to a URI when the scheme is missing and no port is
     197- A port is no longer added to a URI when the scheme is missing and no port is
    101198  present.
     199
    102200
    103201## 1.0.0 - 2015-05-19
     
    109207- `Psr\Http\Message\ServerRequestInterface`
    110208- `Psr\Http\Message\UploadedFileInterface`
     209
     210
     211
     212[Unreleased]: https://github.com/guzzle/psr7/compare/1.5.2...HEAD
     213[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2
     214[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1
     215[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0
     216[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2
     217[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1
     218[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0
     219[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1
     220[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0
     221[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3
     222[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2
     223[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1
     224[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0
     225[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/README.md

    r1864548 r2039426  
    373373$stream = GuzzleHttp\Psr7\stream_for(fopen('/path/to/file', 'r'));
    374374
    375 $generator function ($bytes) {
     375$generator = function ($bytes) {
    376376    for ($i = 0; $i < $bytes; $i++) {
    377377        yield ' ';
     
    607607key without a value, e.g. "key" instead of "key=value".
    608608
     609### `GuzzleHttp\Psr7\Uri::withQueryValues`
     610
     611`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface`
     612
     613Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an
     614associative array of key => value.
    609615
    610616### `GuzzleHttp\Psr7\Uri::withoutQueryValue`
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/composer.json

    r1864548 r2039426  
    33    "type": "library",
    44    "description": "PSR-7 message implementation that also provides common utility methods",
    5     "keywords": ["request", "response", "message", "stream", "http", "uri", "url"],
     5    "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"],
    66    "license": "MIT",
    77    "authors": [
     
    1818    "require": {
    1919        "php": ">=5.4.0",
    20         "psr/http-message": "~1.0"
     20        "psr/http-message": "~1.0",
     21        "ralouphie/getallheaders": "^2.0.5"
    2122    },
    2223    "require-dev": {
    23         "phpunit/phpunit": "~4.0"
     24        "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
    2425    },
    2526    "provide": {
     
    3233        "files": ["src/functions_include.php"]
    3334    },
     35    "autoload-dev": {
     36        "psr-4": {
     37            "GuzzleHttp\\Tests\\Psr7\\": "tests/"
     38        }
     39    },
    3440    "extra": {
    3541        "branch-alias": {
    36             "dev-master": "1.4-dev"
     42            "dev-master": "1.5-dev"
    3743        }
    3844    }
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/src/AppendStream.php

    r1864548 r2039426  
    1717    private $current = 0;
    1818    private $pos = 0;
    19     private $detached = false;
    2019
    2120    /**
     
    7473    {
    7574        $this->pos = $this->current = 0;
     75        $this->seekable = true;
    7676
    7777        foreach ($this->streams as $stream) {
     
    8383
    8484    /**
    85      * Detaches each attached stream
     85     * Detaches each attached stream.
     86     *
     87     * Returns null as it's not clear which underlying stream resource to return.
    8688     *
    8789     * {@inheritdoc}
     
    8991    public function detach()
    9092    {
    91         $this->close();
    92         $this->detached = true;
     93        $this->pos = $this->current = 0;
     94        $this->seekable = true;
     95
     96        foreach ($this->streams as $stream) {
     97            $stream->detach();
     98        }
     99
     100        $this->streams = [];
    93101    }
    94102
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/src/FnStream.php

    r1864548 r2039426  
    5151            call_user_func($this->_fn_close);
    5252        }
     53    }
     54
     55    /**
     56     * An unserialize would allow the __destruct to run when the unserialized value goes out of scope.
     57     * @throws \LogicException
     58     */
     59    public function __wakeup()
     60    {
     61        throw new \LogicException('FnStream should never be unserialized');
    5362    }
    5463
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/src/InflateStream.php

    r1864548 r2039426  
    2828        $resource = StreamWrapper::getResource($stream);
    2929        stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ);
    30         $this->stream = new Stream($resource);
     30        $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource));
    3131    }
    3232
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/src/Request.php

    r1864548 r2039426  
    4646        $this->protocol = $version;
    4747
    48         if (!$this->hasHeader('Host')) {
     48        if (!isset($this->headerNames['host'])) {
    4949            $this->updateHostFromUri();
    5050        }
     
    111111        $new->uri = $uri;
    112112
    113         if (!$preserveHost) {
     113        if (!$preserveHost || !isset($this->headerNames['host'])) {
    114114            $new->updateHostFromUri();
    115115        }
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/src/Response.php

    r1864548 r2039426  
    9494        $reason = null
    9595    ) {
     96        if (filter_var($status, FILTER_VALIDATE_INT) === false) {
     97            throw new \InvalidArgumentException('Status code must be an integer value.');
     98        }
     99
    96100        $this->statusCode = (int) $status;
    97101
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/src/ServerRequest.php

    r1864548 r2039426  
    167167    {
    168168        $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
    169         $headers = function_exists('getallheaders') ? getallheaders() : [];
     169        $headers = getallheaders();
    170170        $uri = self::getUriFromGlobals();
    171171        $body = new LazyOpenStream('php://input', 'r+');
     
    181181    }
    182182
     183    private static function extractHostAndPortFromAuthority($authority)
     184    {
     185        $uri = 'http://'.$authority;
     186        $parts = parse_url($uri);
     187        if (false === $parts) {
     188            return [null, null];
     189        }
     190
     191        $host = isset($parts['host']) ? $parts['host'] : null;
     192        $port = isset($parts['port']) ? $parts['port'] : null;
     193
     194        return [$host, $port];
     195    }
     196
    183197    /**
    184198     * Get a Uri populated with values from $_SERVER.
     
    186200     * @return UriInterface
    187201     */
    188     public static function getUriFromGlobals() {
     202    public static function getUriFromGlobals()
     203    {
    189204        $uri = new Uri('');
    190205
     
    193208        $hasPort = false;
    194209        if (isset($_SERVER['HTTP_HOST'])) {
    195             $hostHeaderParts = explode(':', $_SERVER['HTTP_HOST']);
    196             $uri = $uri->withHost($hostHeaderParts[0]);
    197             if (isset($hostHeaderParts[1])) {
     210            list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']);
     211            if ($host !== null) {
     212                $uri = $uri->withHost($host);
     213            }
     214
     215            if ($port !== null) {
    198216                $hasPort = true;
    199                 $uri = $uri->withPort($hostHeaderParts[1]);
     217                $uri = $uri->withPort($port);
    200218            }
    201219        } elseif (isset($_SERVER['SERVER_NAME'])) {
     
    211229        $hasQuery = false;
    212230        if (isset($_SERVER['REQUEST_URI'])) {
    213             $requestUriParts = explode('?', $_SERVER['REQUEST_URI']);
     231            $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2);
    214232            $uri = $uri->withPath($requestUriParts[0]);
    215233            if (isset($requestUriParts[1])) {
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/src/Stream.php

    r1864548 r2039426  
    2525            'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
    2626            'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true,
    27             'x+t' => true, 'c+t' => true, 'a+' => true
     27            'x+t' => true, 'c+t' => true, 'a+' => true, 'rb+' => true,
    2828        ],
    2929        'write' => [
    3030            'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true,
    31             'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true,
     31            'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true, 'rb+' => true,
    3232            'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true,
    3333            'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true
     
    7171    }
    7272
    73     public function __get($name)
    74     {
    75         if ($name == 'stream') {
    76             throw new \RuntimeException('The stream is detached');
    77         }
    78 
    79         throw new \BadMethodCallException('No value for ' . $name);
    80     }
    81 
    8273    /**
    8374     * Closes the stream when the destructed
     
    10091    public function getContents()
    10192    {
     93        if (!isset($this->stream)) {
     94            throw new \RuntimeException('Stream is detached');
     95        }
     96
    10297        $contents = stream_get_contents($this->stream);
    10398
     
    174169    public function eof()
    175170    {
    176         return !$this->stream || feof($this->stream);
     171        if (!isset($this->stream)) {
     172            throw new \RuntimeException('Stream is detached');
     173        }
     174
     175        return feof($this->stream);
    177176    }
    178177
    179178    public function tell()
    180179    {
     180        if (!isset($this->stream)) {
     181            throw new \RuntimeException('Stream is detached');
     182        }
     183
    181184        $result = ftell($this->stream);
    182185
     
    195198    public function seek($offset, $whence = SEEK_SET)
    196199    {
     200        if (!isset($this->stream)) {
     201            throw new \RuntimeException('Stream is detached');
     202        }
    197203        if (!$this->seekable) {
    198204            throw new \RuntimeException('Stream is not seekable');
    199         } elseif (fseek($this->stream, $offset, $whence) === -1) {
     205        }
     206        if (fseek($this->stream, $offset, $whence) === -1) {
    200207            throw new \RuntimeException('Unable to seek to stream position '
    201208                . $offset . ' with whence ' . var_export($whence, true));
     
    205212    public function read($length)
    206213    {
     214        if (!isset($this->stream)) {
     215            throw new \RuntimeException('Stream is detached');
     216        }
    207217        if (!$this->readable) {
    208218            throw new \RuntimeException('Cannot read from non-readable stream');
     
    226236    public function write($string)
    227237    {
     238        if (!isset($this->stream)) {
     239            throw new \RuntimeException('Stream is detached');
     240        }
    228241        if (!$this->writable) {
    229242            throw new \RuntimeException('Cannot write to a non-writable stream');
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/src/StreamWrapper.php

    r1864548 r2039426  
    3939        }
    4040
    41         return fopen('guzzle://stream', $mode, null, stream_context_create([
     41        return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream));
     42    }
     43
     44    /**
     45     * Creates a stream context that can be used to open a stream as a php stream resource.
     46     *
     47     * @param StreamInterface $stream
     48     *
     49     * @return resource
     50     */
     51    public static function createStreamContext(StreamInterface $stream)
     52    {
     53        return stream_context_create([
    4254            'guzzle' => ['stream' => $stream]
    43         ]));
     55        ]);
    4456    }
    4557
     
    95107    }
    96108
     109    public function stream_cast($cast_as)
     110    {
     111        $stream = clone($this->stream);
     112
     113        return $stream->detach();
     114    }
     115
    97116    public function stream_stat()
    98117    {
    99118        static $modeMap = [
    100119            'r'  => 33060,
     120            'rb' => 33060,
    101121            'r+' => 33206,
    102             'w'  => 33188
     122            'w'  => 33188,
     123            'wb' => 33188
    103124        ];
    104125
     
    119140        ];
    120141    }
     142
     143    public function url_stat($path, $flags)
     144    {
     145        return [
     146            'dev'     => 0,
     147            'ino'     => 0,
     148            'mode'    => 0,
     149            'nlink'   => 0,
     150            'uid'     => 0,
     151            'gid'     => 0,
     152            'rdev'    => 0,
     153            'size'    => 0,
     154            'atime'   => 0,
     155            'mtime'   => 0,
     156            'ctime'   => 0,
     157            'blksize' => 0,
     158            'blocks'  => 0
     159        ];
     160    }
    121161}
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/src/Uri.php

    r1864548 r2039426  
    302302    public static function withoutQueryValue(UriInterface $uri, $key)
    303303    {
    304         $current = $uri->getQuery();
    305         if ($current === '') {
    306             return $uri;
    307         }
    308 
    309         $decodedKey = rawurldecode($key);
    310         $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
    311             return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
    312         });
     304        $result = self::getFilteredQueryString($uri, [$key]);
    313305
    314306        return $uri->withQuery(implode('&', $result));
     
    332324    public static function withQueryValue(UriInterface $uri, $key, $value)
    333325    {
    334         $current = $uri->getQuery();
    335 
    336         if ($current === '') {
    337             $result = [];
    338         } else {
    339             $decodedKey = rawurldecode($key);
    340             $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
    341                 return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
    342             });
    343         }
    344 
    345         // Query string separators ("=", "&") within the key or value need to be encoded
    346         // (while preventing double-encoding) before setting the query string. All other
    347         // chars that need percent-encoding will be encoded by withQuery().
    348         $key = strtr($key, self::$replaceQuery);
    349 
    350         if ($value !== null) {
    351             $result[] = $key . '=' . strtr($value, self::$replaceQuery);
    352         } else {
    353             $result[] = $key;
     326        $result = self::getFilteredQueryString($uri, [$key]);
     327
     328        $result[] = self::generateQueryString($key, $value);
     329
     330        return $uri->withQuery(implode('&', $result));
     331    }
     332
     333    /**
     334     * Creates a new URI with multiple specific query string values.
     335     *
     336     * It has the same behavior as withQueryValue() but for an associative array of key => value.
     337     *
     338     * @param UriInterface $uri           URI to use as a base.
     339     * @param array        $keyValueArray Associative array of key and values
     340     *
     341     * @return UriInterface
     342     */
     343    public static function withQueryValues(UriInterface $uri, array $keyValueArray)
     344    {
     345        $result = self::getFilteredQueryString($uri, array_keys($keyValueArray));
     346
     347        foreach ($keyValueArray as $key => $value) {
     348            $result[] = self::generateQueryString($key, $value);
    354349        }
    355350
     
    621616    }
    622617
     618    /**
     619     * @param UriInterface $uri
     620     * @param array        $keys
     621     *
     622     * @return array
     623     */
     624    private static function getFilteredQueryString(UriInterface $uri, array $keys)
     625    {
     626        $current = $uri->getQuery();
     627
     628        if ($current === '') {
     629            return [];
     630        }
     631
     632        $decodedKeys = array_map('rawurldecode', $keys);
     633
     634        return array_filter(explode('&', $current), function ($part) use ($decodedKeys) {
     635            return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true);
     636        });
     637    }
     638
     639    /**
     640     * @param string      $key
     641     * @param string|null $value
     642     *
     643     * @return string
     644     */
     645    private static function generateQueryString($key, $value)
     646    {
     647        // Query string separators ("=", "&") within the key or value need to be encoded
     648        // (while preventing double-encoding) before setting the query string. All other
     649        // chars that need percent-encoding will be encoded by withQuery().
     650        $queryString = strtr($key, self::$replaceQuery);
     651
     652        if ($value !== null) {
     653            $queryString .= '=' . strtr($value, self::$replaceQuery);
     654        }
     655
     656        return $queryString;
     657    }
     658
    623659    private function removeDefaultPort()
    624660    {
  • mplus-intercom-subscription/trunk/vendor/guzzlehttp/psr7/src/functions.php

    r1864548 r2039426  
    7070 * - size: Size of the stream.
    7171 *
    72  * @param resource|string|null|int|float|bool|StreamInterface|callable $resource Entity body data
    73  * @param array                                                        $options  Additional options
    74  *
    75  * @return Stream
     72 * @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data
     73 * @param array                                                                  $options  Additional options
     74 *
     75 * @return StreamInterface
    7676 * @throws \InvalidArgumentException if the $resource arg is not valid.
    7777 */
     
    239239
    240240    if ($request instanceof ServerRequestInterface) {
    241         return new ServerRequest(
     241        return (new ServerRequest(
    242242            isset($changes['method']) ? $changes['method'] : $request->getMethod(),
    243243            $uri,
     
    248248                : $request->getProtocolVersion(),
    249249            $request->getServerParams()
    250         );
     250        ))
     251        ->withParsedBody($request->getParsedBody())
     252        ->withQueryParams($request->getQueryParams())
     253        ->withCookieParams($request->getCookieParams())
     254        ->withUploadedFiles($request->getUploadedFiles());
    251255    }
    252256
     
    432436 * @param int             $maxLength Maximum buffer length
    433437 *
    434  * @return string|bool
     438 * @return string
    435439 */
    436440function readline(StreamInterface $stream, $maxLength = null)
     
    496500    // responses without space and reason as well.
    497501    if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) {
    498         throw new \InvalidArgumentException('Invalid response string');
     502        throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']);
    499503    }
    500504    $parts = explode(' ', $data['start-line'], 3);
     
    517521 * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']).
    518522 *
    519  * @param string      $str         Query string to parse
    520  * @param bool|string $urlEncoding How the query string is encoded
     523 * @param string   $str         Query string to parse
     524 * @param int|bool $urlEncoding How the query string is encoded
    521525 *
    522526 * @return array
     
    534538            return rawurldecode(str_replace('+', ' ', $value));
    535539        };
    536     } elseif ($urlEncoding == PHP_QUERY_RFC3986) {
     540    } elseif ($urlEncoding === PHP_QUERY_RFC3986) {
    537541        $decoder = 'rawurldecode';
    538     } elseif ($urlEncoding == PHP_QUERY_RFC1738) {
     542    } elseif ($urlEncoding === PHP_QUERY_RFC1738) {
    539543        $decoder = 'urldecode';
    540544    } else {
     
    634638{
    635639    static $mimetypes = [
     640        '3gp' => 'video/3gpp',
    636641        '7z' => 'application/x-7z-compressed',
    637642        'aac' => 'audio/x-aac',
     
    681686        'midi' => 'audio/midi',
    682687        'mov' => 'video/quicktime',
     688        'mkv' => 'video/x-matroska',
    683689        'mp3' => 'audio/mpeg',
    684690        'mp4' => 'video/mp4',
     
    759765    }
    760766
    761     // Iterate over each line in the message, accounting for line endings
    762     $lines = preg_split('/(\\r?\\n)/', $message, -1, PREG_SPLIT_DELIM_CAPTURE);
    763     $result = ['start-line' => array_shift($lines), 'headers' => [], 'body' => ''];
    764     array_shift($lines);
    765 
    766     for ($i = 0, $totalLines = count($lines); $i < $totalLines; $i += 2) {
    767         $line = $lines[$i];
    768         // If two line breaks were encountered, then this is the end of body
    769         if (empty($line)) {
    770             if ($i < $totalLines - 1) {
    771                 $result['body'] = implode('', array_slice($lines, $i + 2));
    772             }
    773             break;
    774         }
    775         if (strpos($line, ':')) {
    776             $parts = explode(':', $line, 2);
    777             $key = trim($parts[0]);
    778             $value = isset($parts[1]) ? trim($parts[1]) : '';
    779             $result['headers'][$key][] = $value;
    780         }
    781     }
    782 
    783     return $result;
     767    $message = ltrim($message, "\r\n");
     768
     769    $messageParts = preg_split("/\r?\n\r?\n/", $message, 2);
     770
     771    if ($messageParts === false || count($messageParts) !== 2) {
     772        throw new \InvalidArgumentException('Invalid message: Missing header delimiter');
     773    }
     774
     775    list($rawHeaders, $body) = $messageParts;
     776    $rawHeaders .= "\r\n"; // Put back the delimiter we split previously
     777    $headerParts = preg_split("/\r?\n/", $rawHeaders, 2);
     778
     779    if ($headerParts === false || count($headerParts) !== 2) {
     780        throw new \InvalidArgumentException('Invalid message: Missing status line');
     781    }
     782
     783    list($startLine, $rawHeaders) = $headerParts;
     784
     785    if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') {
     786        // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0
     787        $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders);
     788    }
     789
     790    /** @var array[] $headerLines */
     791    $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER);
     792
     793    // If these aren't the same, then one line didn't match and there's an invalid header.
     794    if ($count !== substr_count($rawHeaders, "\n")) {
     795        // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
     796        if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) {
     797            throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding');
     798        }
     799
     800        throw new \InvalidArgumentException('Invalid header syntax');
     801    }
     802
     803    $headers = [];
     804
     805    foreach ($headerLines as $headerLine) {
     806        $headers[$headerLine[1]][] = $headerLine[2];
     807    }
     808
     809    return [
     810        'start-line' => $startLine,
     811        'headers' => $headers,
     812        'body' => $body,
     813    ];
    784814}
    785815
     
    810840}
    811841
     842/**
     843 * Get a short summary of the message body
     844 *
     845 * Will return `null` if the response is not printable.
     846 *
     847 * @param MessageInterface $message    The message to get the body summary
     848 * @param int              $truncateAt The maximum allowed size of the summary
     849 *
     850 * @return null|string
     851 */
     852function get_message_body_summary(MessageInterface $message, $truncateAt = 120)
     853{
     854    $body = $message->getBody();
     855
     856    if (!$body->isSeekable() || !$body->isReadable()) {
     857        return null;
     858    }
     859
     860    $size = $body->getSize();
     861
     862    if ($size === 0) {
     863        return null;
     864    }
     865
     866    $summary = $body->read($truncateAt);
     867    $body->rewind();
     868
     869    if ($size > $truncateAt) {
     870        $summary .= ' (truncated...)';
     871    }
     872
     873    // Matches any printable character, including unicode characters:
     874    // letters, marks, numbers, punctuation, spacing, and separators.
     875    if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) {
     876        return null;
     877    }
     878
     879    return $summary;
     880}
     881
    812882/** @internal */
    813883function _caseless_remove($keys, array $data)
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/README.md

    r1864548 r2039426  
    1 
    2 [![Code
    3 Climate](https://codeclimate.com/repos/537da4a7e30ba062b101be9c/badges/2aa25d4736f09f40282e/gpa.svg)](https://codeclimate.com/repos/537da4a7e30ba062b101be9c/feed) [![Build
    4 Status](https://travis-ci.org/intercom/intercom-php.svg?branch=master)](https://travis-ci.org/intercom/intercom-php)
    5 
    6 ## intercom-php
    7 
    8 > Official PHP bindings to the Intercom API
     1# intercom-php
     2
     3[![Code Climate](https://codeclimate.com/repos/537da4a7e30ba062b101be9c/badges/2aa25d4736f09f40282e/gpa.svg)](https://codeclimate.com/repos/537da4a7e30ba062b101be9c/feed) [![Circle CI](https://circleci.com/gh/intercom/intercom-php.png?style=badge)](https://circleci.com/gh/intercom/intercom-php)
     4
     5Official PHP bindings to the Intercom API
    96
    107## Installation
    118
    12 Requires PHP 5.6.
     9This library supports PHP 7.1 and later
     10
     11This library uses [HTTPPlug](https://github.com/php-http/httplug) as HTTP client. HTTPPlug is an abstraction that allows this library to support many different HTTP Clients. Therefore, you need to provide it with an adapter for the HTTP library you prefer. You can find all the available adapters [in Packagist](https://packagist.org/providers/php-http/client-implementation). This documentation assumes you use the Guzzle6 Client, but you can replace it with any adapter that you prefer.
    1312
    1413The recommended way to install intercom-php is through [Composer](https://getcomposer.org):
    1514
    16 First, install Composer:
    17 
    18 ```
    19 $ curl -sS https://getcomposer.org/installer | php
    20 ```
    21 
    22 Next, install the latest intercom-php:
    23 
    24 ```
    25 $ php composer.phar require intercom/intercom-php
    26 ```
    27 
    28 Finally, you need to require the library in your PHP application:
    29 
    30 ```php
    31 require "vendor/autoload.php";
     15```sh
     16composer require intercom/intercom-php php-http/guzzle6-adapter
    3217```
    3318
    3419## Clients
    35 For OAuth or Access Tokens use:
     20
     21Initialize your client using your access token:
    3622
    3723```php
    3824use Intercom\IntercomClient;
    3925
    40 $client = new IntercomClient(<insert_token_here>, null);
    41 ```
    42 
    43 > If you already have an access token you can find it [here](https://app.intercom.com/developers/_). If you want to create or learn more about access tokens then you can find more info [here](https://developers.intercom.io/docs/personal-access-tokens).
    44 
    45 > If you are building a third party application you can get your OAuth token by [setting-up-oauth](https://developers.intercom.io/page/setting-up-oauth) for Intercom.
     26$client = new IntercomClient('<insert_token_here>');
     27```
     28
     29> If you already have an access token you can find it [here](https://app.intercom.com/a/apps/_/developer-hub). If you want to create or learn more about access tokens then you can find more info [here](https://developers.intercom.com/building-apps/docs/authorization#section-access-tokens).
     30>
     31> If you are building a third party application you can get your OAuth token by [setting-up-oauth](https://developers.intercom.com/building-apps/docs/authorization#section-oauth) for Intercom.
     32
     33For most use cases the code snippet above should suffice. However, if needed, you can customize the Intercom client as follows:
     34
     35```php
     36use Intercom\IntercomClient;
     37
     38$client = new IntercomClient('<insert_token_here>', null, ['Custom-Header' => 'value']);
     39
     40$client->setHttpClient($myCustomHttpClient); // $myCustomHttpClient implements Psr\Http\Client\ClientInterface
     41$client->setRequestFactory($myCustomRequestFactory); // $myCustomRequestFactory implements Http\Message\RequestFactory
     42$client->setUriFactory($myCustomUriFactory); // $myCustomUriFactory implements Http\Message\UriFactory
     43```
    4644
    4745## Users
     
    5048/** Create a user */
    5149$client->users->create([
    52   "email" => "test@example.com",
    53   "custom_attributes" => ['foo' => 'bar']
    54 ]);
    55 
    56 /** 
    57  * Update a user (Note: This method is an alias to the create method. In practice you 
     50    "email" => "test@example.com",
     51    "custom_attributes" => ['foo' => 'bar']
     52]);
     53
     54/**
     55 * Update a user (Note: This method is an alias to the create method. In practice you
    5856 * can use create to update users if you wish)
    5957 */
    6058$client->users->update([
    61   "email" => "test@example.com",
    62   "custom_attributes" => ['foo' => 'bar']
    63 ]);
    64 
    65 /** Delete a user by ID */
    66 $client->users->deleteUser("570680a8a1bcbca8a90001b9");
     59    "email" => "test@example.com",
     60    "custom_attributes" => ['foo' => 'bar']
     61]);
     62
     63/** Archive a user by ID (i.e. soft delete) */
     64$client->users->archiveUser("570680a8a1bcbca8a90001b9");
     65
     66/** Permanently delete a user */
     67$client->users->permanentlyDeleteUser("570680a8a1bcbca8a90001b9");
     68
     69/** For more on the difference between archive and permanently deleting a user please see https://developers.intercom.com/reference#archive-a-user. */
    6770
    6871/** Get a user by ID */
     
    7174/** Add companies to a user */
    7275$client->users->create([
    73   "email" => "test@example.com",
    74   "companies" => [
    75     [
    76       "company_id" => "3"
    77     ]
    78   ]
     76    "email" => "test@example.com",
     77    "companies" => [
     78        [
     79            "company_id" => "3"
     80        ]
     81    ]
    7982]);
    8083
    8184/** Remove companies from a user */
    8285$client->users->create([
    83   "email" => "test@example.com",
    84   "companies" => [
    85     [
    86       "company_id" => "3",
    87       "remove" => true
    88     ]
    89   ]
     86    "email" => "test@example.com",
     87    "companies" => [
     88        [
     89            "company_id" => "3",
     90            "remove" => true
     91        ]
     92    ]
    9093]);
    9194
     
    9699$client->users->getUsers([]);
    97100
    98 /** 
     101/**
    99102 * List all users (even above 10k records)
    100  * The result object contains an array of your user objects and a scroll_param which you can then 
    101  * use to request the next 100 users. Note that the scroll parameter will time out after one minute 
     103 * The result object contains an array of your user objects and a scroll_param which you can then
     104 * use to request the next 100 users. Note that the scroll parameter will time out after one minute
    102105 * and you will need to make a new request
    103106 */
     
    105108```
    106109
     110See [here](https://github.com/intercom/intercom-php#scroll) for more info on using the scroll parameter
     111
    107112## Leads
    108113
    109114```php
    110 /** 
     115/**
    111116 * Create a lead
    112117 * See more options here: https://developers.intercom.io/reference#create-lead
    113118 */
    114119$client->leads->create([
    115   "email" => "test@example.com",
    116   "custom_attributes" => ['foo' => 'bar']
    117 ]);
    118 
    119 /**
    120  * Update a lead (Note: This method is an alias to the create method. 
     120    "email" => "test@example.com",
     121    "custom_attributes" => ['foo' => 'bar']
     122]);
     123
     124/**
     125 * Update a lead (Note: This method is an alias to the create method.
    121126 * In practice you can use create to update leads if you wish)
    122127 */
    123128$client->leads->update([
    124   "email" => "test@example.com",
    125   "custom_attributes" => ['foo' => 'bar']
    126 ]);
    127 
    128 /** 
     129    "email" => "test@example.com",
     130    "custom_attributes" => ['foo' => 'bar']
     131]);
     132
     133/**
    129134 * List leads
    130135 * See more options here: https://developers.intercom.io/reference#list-leads
     
    140145/** Convert a Lead to a User */
    141146$client->leads->convertLead([
    142   "contact" => [
    143     "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c"
    144   ],
    145   "user" => [
    146     "email" => "winstonsmith@truth.org"
    147   ]
    148 ]);
    149 
    150 /** 
     147    "contact" => [
     148        "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c"
     149    ],
     150    "user" => [
     151        "email" => "winstonsmith@truth.org"
     152    ]
     153]);
     154
     155/**
    151156 * List all leads (even above 10k records)
    152  * The result object contains an array of your contacts objects and a scroll_param which you can then 
    153  * use to request the next 100 leads. Note that the scroll parameter will time out after one minute 
     157 * The result object contains an array of your contacts objects and a scroll_param which you can then
     158 * use to request the next 100 leads. Note that the scroll parameter will time out after one minute
    154159 * and you will need to make a new request
    155160 */
     
    157162```
    158163
     164See [here](https://github.com/intercom/intercom-php#scroll) for more info on using the scroll parameter
     165
    159166## Visitors
     167
    160168Retrieve `user_id` of a visitor via [the JavaScript API](https://developers.intercom.com/docs/intercom-javascript#section-intercomgetvisitorid)
    161169
     
    163171/** Update a visitor */
    164172$client->visitors->update([
    165   "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c",
    166   "custom_attributes" => ['foo' => 'bar']
     173    "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c",
     174    "custom_attributes" => ['foo' => 'bar']
    167175]);
    168176
     
    178186/** Convert a Visitor to a Lead */
    179187$client->visitors->convertVisitor([
    180   "visitor" => [
    181     "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c"
    182   ],
    183   "type" => "lead"
     188    "visitor" => [
     189        "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c"
     190    ],
     191    "type" => "lead"
    184192]);
    185193
    186194/** Convert a Visitor to a User */
    187195$client->visitors->convertVisitor([
    188   "visitor" => [
    189     "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c"
    190   ],
    191   "user" => [
    192     "email" => "winstonsmith@truth.org"
    193   ],
    194   "type" => "user"
     196    "visitor" => [
     197        "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c"
     198    ],
     199    "user" => [
     200        "email" => "winstonsmith@truth.org"
     201    ],
     202    "type" => "user"
    195203]);
    196204```
     
    202210$client->tags->getTags();
    203211
    204 /** 
     212/**
    205213 * Tag users
    206214 * See more options here: https://developers.intercom.io/reference#tag-or-untag-users-companies-leads-contacts
    207215 */
    208216$client->tags->tag([
    209   "name" => "Test",
    210   "users" => [
    211     ["id" => "1234"]
    212   ]
     217    "name" => "Test",
     218    "users" => [
     219        ["id" => "1234"]
     220    ]
    213221]);
    214222```
     
    222230/** View a segment */
    223231$client->segments->getSegment("58a707924f6651b07b94376c");
     232
     233/** View a segment with count */
     234$client->segments->getSegment("59c124f770e00fd819b9ce81", ["include_count"=>"true"]);
    224235```
    225236
     
    229240/** Create an event */
    230241$client->events->create([
    231   "event_name" => "testing",
    232   "created_at" => 1391691571,
    233   "email" => "test@example.com"
     242    "event_name" => "testing",
     243    "created_at" => 1391691571,
     244    "email" => "test@example.com",
     245    "metadata" => [
     246        "order_date" => 1392036272,
     247        "stripe_invoice" => "inv_3434343434"
     248    ]
    234249]);
    235250
     
    243258/** Create a company */
    244259$client->companies->create([
    245   "name" => "foocorp", "company_id" => "3"
    246 ]);
    247 
    248 /**
    249  * Update a company (Note: This method is an alias to the create method.
     260    "name" => "foocorp",
     261    "company_id" => "3"
     262]);
     263
     264/**
     265 * Update a company (Note: This method is an alias to the create method.
    250266 * In practice you can use create to update companies if you wish)
    251267 */
    252268$client->companies->update([
    253   "name" => "foocorp", "id" => "3"
     269    "name" => "foocorp",
     270    "id" => "3"
    254271]);
    255272
    256273/** Creating or Update a company with custom attributes. */
    257274$client->companies->update([
    258   "name" => "foocorp",
    259   "id" => "3",
    260   "custom_attributes" => [
    261     "foo" => "bar",
    262     "baz" => "qux"
    263   ]
     275    "name" => "foocorp",
     276    "id" => "3",
     277    "custom_attributes" => [
     278        "foo" => "bar",
     279        "baz" => "qux"
     280    ]
    264281]);
    265282
    266283/** List Companies */
    267284$client->companies->getCompanies([]);
     285
     286/** Get a company by ID */
     287$client->companies->getCompany("531ee472cce572a6ec000006");
    268288```
    269289
     
    278298
    279299```php
    280 /** 
     300/**
    281301 * Send a message from an admin to a user
    282302 * See more options here: https://developers.intercom.io/reference#conversations
    283303 */
    284304$client->messages->create([
    285   "message_type" => "inapp",
    286   "subject" => "Hey",
    287   "body" => "Ponies, cute small horses or something more sinister?",
    288   "from" => [
    289     "type" => "admin",
    290     "id" => "1234"
    291   ],
    292   "to" => [
    293     "type" => "user",
    294     "email" => "bob@example.com"
    295   ]
     305    "message_type" => "inapp",
     306    "subject" => "Hey",
     307    "body" => "Ponies, cute small horses or something more sinister?",
     308    "from" => [
     309        "type" => "admin",
     310        "id" => "1234"
     311    ],
     312    "to" => [
     313        "type" => "user",
     314        "email" => "bob@example.com"
     315    ]
    296316]);
    297317```
     
    300320
    301321```php
    302 /** 
     322/**
    303323 * List conversations for an admin
    304324 * See more options here: https://developers.intercom.io/reference#list-conversations
    305325 */
    306326$client->conversations->getConversations([
    307   "type" => "admin",
    308   "admin_id" => "25610"
     327    "type" => "admin",
     328    "admin_id" => "25610"
    309329]);
    310330
     
    314334/** Get a single conversation with plaintext comments */
    315335$client->conversations->getConversation("1234", [
    316   "display_as" => "plaintext"
     336    "display_as" => "plaintext"
    317337])
    318338
    319 /** 
     339/**
    320340 * Reply to a conversation
    321341 * See more options here: https://developers.intercom.io/reference#replying-to-a-conversation
    322342 */
    323343$client->conversations->replyToConversation("5678", [
    324   "email" => "test@example.com",
    325   "body" => "Thanks :)",
    326   "type" => "user",
    327   "message_type" => "comment"
    328 ]);
    329 
    330 /** 
     344    "email" => "test@example.com",
     345    "body" => "Thanks :)",
     346    "type" => "user",
     347    "message_type" => "comment"
     348]);
     349
     350/**
    331351 * Reply to a user's last conversation
    332352 * See more options here: https://developers.intercom.com/reference#replying-to-users-last-conversation
    333353 */
    334354$client->conversations->replyToLastConversation([
    335   "email" => "test@example.com",
    336   "body" => "Thanks :)",
    337   "type" => "user",
    338   "message_type" => "comment"
    339 ]);
    340 
    341 /** 
     355    "email" => "test@example.com",
     356    "body" => "Thanks :)",
     357    "type" => "user",
     358    "message_type" => "comment"
     359]);
     360
     361/**
    342362 * Mark a conversation as read
    343363 * See API documentation here: https://developers.intercom.io/reference#marking-a-conversation-as-read
     
    349369
    350370```php
    351 /** 
     371/**
    352372 * List counts
    353373 * See more options here: https://developers.intercom.io/reference#getting-counts
     
    361381/** Create a note */
    362382$client->notes->create([
    363   "admin_id" => "21",
    364   "body" => "Text for my note",
    365   "user" => [
    366     "id" => "5310d8e8598c9a0b24000005"
    367   ]
     383    "admin_id" => "21",
     384    "body" => "Text for my note",
     385    "user" => [
     386        "id" => "5310d8e8598c9a0b24000005"
     387    ]
    368388]);
    369389
     
    382402You can access this information as follows:
    383403
    384 ```
     404```php
    385405$rate_limit = $intercom->getRateLimitDetails();
    386406print("{$rate_limit['remaining']} {$rate_limit['limit']} \n");
    387407print_r($rate_limit['reset_at']->format(DateTime::ISO8601));
    388408```
     409
    389410For more info on rate limits and these headers please see the [API reference docs](https://developers.intercom.com/reference#rate-limiting)
    390411
     
    407428```
    408429
     430## Scroll
     431
     432The first time you use the scroll API you can just send a simple GET request.
     433This will return up to 100 records. If you have more than 100 you will need to make another call.
     434To do this you need to use to scroll_parameter returned in the original response.
     435Use this for subsequent responses until you get an empty array of records.
     436This means there are no records and the scroll timer will be reset.
     437For more information on scroll please see the [API reference](https://developers.intercom.com/reference#iterating-over-all-users)
     438Here is an example of a simple way to use the scroll for multiple calls:
     439
     440```php
     441require "vendor/autoload.php";
     442
     443use Intercom\IntercomClient;
     444
     445$intercom = new IntercomClient(getenv('AT'), null);
     446$resp = $intercom->users->scrollUsers([]);
     447$count = 1;
     448echo "PAGE $count: " . sizeof($resp->users);
     449echo "\n";
     450while (!empty($resp->scroll_param) && sizeof($resp->users) > 0) {
     451    $count = ++$count;
     452    $resp = $intercom->users->scrollUsers(["scroll_param" => $resp->scroll_param]);
     453    echo "PAGE $count: " . sizeof($resp->users);
     454    echo "\n";
     455}
     456```
    409457
    410458## Exceptions
    411459
    412 Exceptions are handled by [Guzzle](https://github.com/guzzle/guzzle).
     460Exceptions are handled by HTTPPlug. Every exception thrown implements `Http\Client\Exception`. See the different exceptions that can be thrown [in the HTTPPlug documentation](http://docs.php-http.org/en/latest/httplug/exceptions.html).
    413461The Intercom API may return an unsuccessful HTTP response, for example when a resource is not found (404).
    414 If you want to catch errors you can wrap your API call into a try/catch:
    415 
    416 ```php
    417 use GuzzleHttp\Exception\ClientException;
    418 
     462If you want to catch errors you can wrap your API call into a try/catch block:
     463
     464```php
    419465try {
    420   $user = $client->users->getUser("570680a8a1bcbca8a90001b9");
    421 } catch(ClientException $e) {
    422   $response = $e->getResponse();
    423   $statusCode = $response->getStatusCode();
    424   if ($statusCode == '404') {
    425     // Handle 404 error
    426     return;
    427   } else {
    428     throw $e;
    429   }
     466    $user = $client->users->getUser("570680a8a1bcbca8a90001b9");
     467} catch(Http\Client\Exception $e) {
     468    if ($e->getCode() == '404') {
     469        // Handle 404 error
     470        return;
     471    } else {
     472        throw $e;
     473    }
    430474}
    431475```
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/composer.json

    r1864548 r2039426  
    33    "description": "Intercom API client built on top of Guzzle 6",
    44    "keywords": ["intercom", "intercom.io", "api", "guzzle"],
    5     "license": "Apache Version 2",
     5    "license": "Apache-2.0",
    66    "authors": [
    77        {
     
    1515        }
    1616    },
     17    "autoload-dev": {
     18        "psr-4": {
     19            "Intercom\\Test\\": ["test"]
     20        }
     21    },
    1722    "require": {
    18         "guzzlehttp/guzzle": "~6.0",
    19         "php": ">= 5.6"
     23        "php": ">= 7.1",
     24        "ext-json": "*",
     25        "php-http/httplug": "^1.0 || ^2.0",
     26        "php-http/client-implementation": "*",
     27        "php-http/discovery": "^1.4",
     28        "php-http/message": "^1.7",
     29        "psr/http-message": "^1.0"
    2030    },
    2131    "require-dev": {
    22         "phpunit/phpunit": "4.0.*",
    23         "squizlabs/php_codesniffer": "^3.1"
     32        "phpunit/phpunit": "^7.0",
     33        "squizlabs/php_codesniffer": "^3.1",
     34        "php-http/guzzle6-adapter": "^2.0"
    2435    }
    2536}
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomAdmins.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomAdmins
     
    2628     * @see    https://developers.intercom.io/reference#list-admins
    2729     * @param  array $options
    28      * @return mixed
    29      * @throws \GuzzleHttp\Exception\GuzzleException
     30     * @return stdClass
     31     * @throws Exception
    3032     */
    3133    public function getAdmins($options = [])
     
    4042     * @param  integer $id
    4143     * @param  array   $options
    42      * @return mixed
    43      * @throws \GuzzleHttp\Exception\GuzzleException
     44     * @return stdClass
     45     * @throws Exception
    4446     */
    4547    public function getAdmin($id, $options = [])
     
    4951    }
    5052
     53    /**
     54     * Returns endpoint path to Admin with given ID.
     55     *
     56     * @param  string $id
     57     * @return string
     58     */
    5159    public function adminPath($id)
    5260    {
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomBulk.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomBulk
     
    2426     * Creates Users in bulk.
    2527     *
    26      * @see    https://developers.intercom.io/reference#bulk-user-operations
    2728     * @param  array $options
    28      * @return mixed
    29      * @throws \GuzzleHttp\Exception\GuzzleException
     29     * @return stdClass
     30     * @throws Exception
    3031     */
    3132    public function users($options)
     
    3738     * Creates Events in bulk.
    3839     *
    39      * @see    https://developers.intercom.io/reference#bulk-event-operations
    4040     * @param  array $options
    41      * @return mixed
    42      * @throws \GuzzleHttp\Exception\GuzzleException
     41     * @return stdClass
     42     * @throws Exception
    4343     */
    4444    public function events($options)
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomClient.php

    r1864548 r2039426  
    33namespace Intercom;
    44
    5 use GuzzleHttp\Client;
    6 use GuzzleHttp\Psr7\Response;
     5use Http\Discovery\HttpClientDiscovery;
     6use Http\Discovery\MessageFactoryDiscovery;
     7use Http\Discovery\UriFactoryDiscovery;
     8use Http\Message\Authentication;
     9use Http\Message\Authentication\BasicAuth;
     10use Http\Message\Authentication\Bearer;
     11use Http\Message\RequestFactory;
     12use Http\Message\UriFactory;
     13use Psr\Http\Client\ClientExceptionInterface;
     14use Psr\Http\Client\ClientInterface;
     15use Psr\Http\Message\RequestInterface;
    716use Psr\Http\Message\ResponseInterface;
     17use Psr\Http\Message\UriInterface;
    818
    919class IntercomClient
    1020{
    11 
    12     /**
    13      * @var Client $http_client
    14      */
    15     private $http_client;
     21    /**
     22     * @var ClientInterface $httpClient
     23     */
     24    private $httpClient;
     25
     26    /**
     27     * @var RequestFactory $requestFactory
     28     */
     29    private $requestFactory;
     30
     31    /**
     32     * @var UriFactory $uriFactory
     33     */
     34    private $uriFactory;
    1635
    1736    /**
    1837     * @var string API user authentication
    1938     */
    20     protected $usernamePart;
     39    private $usernameOrToken;
    2140
    2241    /**
    2342     * @var string API password authentication
    2443     */
    25     protected $passwordPart;
    26 
    27     /**
    28      * @var string Extra Guzzle Requests Options
    29      */
    30     protected $extraGuzzleRequestsOptions;
     44    private $password;
     45
     46    /**
     47     * @var array $extraRequestHeaders
     48     */
     49    private $extraRequestHeaders;
    3150
    3251    /**
     
    6180
    6281    /**
     82     * @var IntercomVisitors $visitors
     83     */
     84    public $visitors;
     85
     86    /**
    6387     * @var IntercomAdmins $admins
    6488     */
     
    91115
    92116    /**
    93      * @var int[] $rateLimitDetails
     117     * @var array $rateLimitDetails
    94118     */
    95119    protected $rateLimitDetails = [];
     
    98122     * IntercomClient constructor.
    99123     *
    100      * @param string $usernamePart App ID.
    101      * @param string $passwordPart Api Key.
    102      */
    103     public function __construct($usernamePart, $passwordPart, $extraGuzzleRequestsOptions = [])
    104     {
    105         $this->setDefaultClient();
     124     * @param string $appIdOrToken App ID.
     125     * @param string|null $password Api Key.
     126     * @param array $extraRequestHeaders Extra request headers to be sent in every api request
     127     */
     128    public function __construct($appIdOrToken, $password = null, $extraRequestHeaders = [])
     129    {
    106130        $this->users = new IntercomUsers($this);
    107131        $this->events = new IntercomEvents($this);
     
    118142        $this->notes = new IntercomNotes($this);
    119143
    120         $this->usernamePart = $usernamePart;
    121         $this->passwordPart = $passwordPart;
    122         $this->extraGuzzleRequestsOptions = $extraGuzzleRequestsOptions;
    123     }
    124 
    125     private function setDefaultClient()
    126     {
    127         $this->http_client = new Client();
    128     }
    129 
    130     /**
    131      * Sets GuzzleHttp client.
    132      *
    133      * @param Client $client
    134      */
    135     public function setClient($client)
    136     {
    137         $this->http_client = $client;
     144        $this->appIdOrToken = $appIdOrToken;
     145        $this->passwordPart = $password;
     146        $this->extraRequestHeaders = $extraRequestHeaders;
     147
     148        $this->httpClient = HttpClientDiscovery::find();
     149        $this->requestFactory = MessageFactoryDiscovery::find();
     150        $this->uriFactory = UriFactoryDiscovery::find();
     151    }
     152
     153    /**
     154     * Sets the HTTP client.
     155     *
     156     * @param ClientInterface $httpClient
     157     */
     158    public function setHttpClient(ClientInterface $httpClient)
     159    {
     160        $this->httpClient = $httpClient;
     161    }
     162
     163    /**
     164     * Sets the request factory.
     165     *
     166     * @param RequestFactory $requestFactory
     167     */
     168    public function setRequestFactory(RequestFactory $requestFactory)
     169    {
     170        $this->requestFactory = $requestFactory;
     171    }
     172
     173    /**
     174     * Sets the URI factory.
     175     *
     176     * @param UriFactory $uriFactory
     177     */
     178    public function setUriFactory(UriFactory $uriFactory)
     179    {
     180        $this->uriFactory = $uriFactory;
    138181    }
    139182
     
    142185     *
    143186     * @param  string $endpoint
    144      * @param  string $json
    145      * @return mixed
    146      * @throws \GuzzleHttp\Exception\GuzzleException
     187     * @param  array $json
     188     * @return stdClass
    147189     */
    148190    public function post($endpoint, $json)
    149191    {
    150         $guzzleRequestOptions = $this->getGuzzleRequestOptions(
     192        $response = $this->sendRequest('POST', "https://api.intercom.io/$endpoint", $json);
     193        return $this->handleResponse($response);
     194    }
     195
     196    /**
     197     * Sends PUT request to Intercom API.
     198     *
     199     * @param  string $endpoint
     200     * @param  array $json
     201     * @return stdClass
     202     */
     203    public function put($endpoint, $json)
     204    {
     205        $response = $this->sendRequest('PUT', "https://api.intercom.io/$endpoint", $json);
     206        return $this->handleResponse($response);
     207    }
     208
     209    /**
     210     * Sends DELETE request to Intercom API.
     211     *
     212     * @param  string $endpoint
     213     * @param  array $json
     214     * @return stdClass
     215     */
     216    public function delete($endpoint, $json)
     217    {
     218        $response = $this->sendRequest('DELETE', "https://api.intercom.io/$endpoint", $json);
     219        return $this->handleResponse($response);
     220    }
     221
     222    /**
     223     * Sends GET request to Intercom API.
     224     *
     225     * @param string $endpoint
     226     * @param array  $queryParams
     227     * @return stdClass
     228     */
     229    public function get($endpoint, $queryParams = [])
     230    {
     231        $uri = $this->uriFactory->createUri("https://api.intercom.io/$endpoint");
     232        if (!empty($queryParams)) {
     233            $uri = $uri->withQuery(http_build_query($queryParams));
     234        }
     235
     236        $response = $this->sendRequest('GET', $uri);
     237
     238        return $this->handleResponse($response);
     239    }
     240
     241    /**
     242     * Returns the next page of the result.
     243     *
     244     * @param  stdClass $pages
     245     * @return stdClass
     246     */
     247    public function nextPage($pages)
     248    {
     249        $response = $this->sendRequest('GET', $pages->next);
     250        return $this->handleResponse($response);
     251    }
     252
     253    /**
     254     * Gets the rate limit details.
     255     *
     256     * @return array
     257     */
     258    public function getRateLimitDetails()
     259    {
     260        return $this->rateLimitDetails;
     261    }
     262
     263    /**
     264     * @return array
     265     */
     266    private function getRequestHeaders()
     267    {
     268        return array_merge(
    151269            [
    152             'json' => $json,
    153             'auth' => $this->getAuth(),
    154             'headers' => [
    155                 'Accept' => 'application/json'
     270                'Accept' => 'application/json',
     271                'Content-Type' => 'application/json'
    156272            ],
    157             ]
     273            $this->extraRequestHeaders
    158274        );
    159         $response = $this->http_client->request('POST', "https://api.intercom.io/$endpoint", $guzzleRequestOptions);
    160         return $this->handleResponse($response);
    161     }
    162 
    163     /**
    164      * Sends PUT request to Intercom API.
    165      *
    166      * @param  string $endpoint
    167      * @param  string $json
    168      * @return mixed
    169      * @throws \GuzzleHttp\Exception\GuzzleException
    170      */
    171     public function put($endpoint, $json)
    172     {
    173         $guzzleRequestOptions = $this->getGuzzleRequestOptions(
    174             [
    175             'json' => $json,
    176             'auth' => $this->getAuth(),
    177             'headers' => [
    178                 'Accept' => 'application/json'
    179             ],
    180             ]
     275    }
     276
     277    /**
     278     * Returns authentication parameters
     279     *
     280     * @return Authentication
     281     */
     282    private function getAuth()
     283    {
     284        if (!empty($this->appIdOrToken) && !empty($this->passwordPart)) {
     285            return new BasicAuth($this->appIdOrToken, $this->passwordPart);
     286        } elseif (!empty($this->appIdOrToken)) {
     287            return new Bearer($this->appIdOrToken);
     288        }
     289        return null;
     290    }
     291
     292    /**
     293     * Authenticates a request object
     294     * @param RequestInterface $request
     295     *
     296     * @return RequestInterface
     297     */
     298    private function authenticateRequest(RequestInterface $request)
     299    {
     300        $auth = $this->getAuth();
     301        return $auth ? $auth->authenticate($request) : $request;
     302    }
     303
     304    /**
     305     * @param string              $method
     306     * @param string|UriInterface $uri
     307     * @param array|string|null   $body
     308     *
     309     * @return ResponseInterface
     310     * @throws ClientExceptionInterface
     311     */
     312    private function sendRequest($method, $uri, $body = null)
     313    {
     314        $headers = $this->getRequestHeaders();
     315        $body = is_array($body) ? json_encode($body) : $body;
     316        $request = $this->authenticateRequest(
     317            $this->requestFactory->createRequest($method, $uri, $headers, $body)
    181318        );
    182319
    183         $response = $this->http_client->request('PUT', "https://api.intercom.io/$endpoint", $guzzleRequestOptions);
    184         return $this->handleResponse($response);
    185     }
    186 
    187     /**
    188      * Sends DELETE request to Intercom API.
    189      *
    190      * @param  string $endpoint
    191      * @param  string $json
    192      * @return mixed
    193      * @throws \GuzzleHttp\Exception\GuzzleException
    194      */
    195     public function delete($endpoint, $json)
    196     {
    197         $guzzleRequestOptions = $this->getGuzzleRequestOptions(
    198             [
    199             'json' => $json,
    200             'auth' => $this->getAuth(),
    201             'headers' => [
    202                 'Accept' => 'application/json'
    203             ],
    204             ]
    205         );
    206 
    207         $response = $this->http_client->request('DELETE', "https://api.intercom.io/$endpoint", $guzzleRequestOptions);
    208         return $this->handleResponse($response);
    209     }
    210 
    211     /**
    212      * @param string $endpoint
    213      * @param array  $query
    214      * @return mixed
    215      * @throws \GuzzleHttp\Exception\GuzzleException
    216      */
    217     public function get($endpoint, $query)
    218     {
    219         $guzzleRequestOptions = $this->getGuzzleRequestOptions(
    220             [
    221             'query' => $query,
    222             'auth' => $this->getAuth(),
    223             'headers' => [
    224                 'Accept' => 'application/json'
    225             ],
    226             ]
    227         );
    228 
    229         $response = $this->http_client->request('GET', "https://api.intercom.io/$endpoint", $guzzleRequestOptions);
    230         return $this->handleResponse($response);
    231     }
    232 
    233     /**
    234      * Returns next page of the result.
    235      *
    236      * @param  \stdClass $pages
    237      * @return mixed
    238      * @throws \GuzzleHttp\Exception\GuzzleException
    239      */
    240     public function nextPage($pages)
    241     {
    242         $guzzleRequestOptions = $this->getGuzzleRequestOptions(
    243             [
    244             'auth' => $this->getAuth(),
    245             'headers' => [
    246                 'Accept' => 'application/json'
    247             ],
    248             ]
    249         );
    250 
    251         $response = $this->http_client->request('GET', $pages->next, $guzzleRequestOptions);
    252         return $this->handleResponse($response);
    253     }
    254 
    255     /**
    256      * Returns Guzzle Requests Options Array
    257      *
    258      * @param  array $defaultGuzzleRequestsOptions
    259      * @return array
    260      */
    261     public function getGuzzleRequestOptions($defaultGuzzleRequestOptions = [])
    262     {
    263         return array_replace_recursive($this->extraGuzzleRequestsOptions, $defaultGuzzleRequestOptions);
    264     }
    265 
    266     /**
    267      * Returns authentication parameters.
    268      *
    269      * @return array
    270      */
    271     public function getAuth()
    272     {
    273         return [$this->usernamePart, $this->passwordPart];
    274     }
    275 
    276     /**
    277      * @param Response $response
    278      * @return mixed
    279      */
    280     private function handleResponse(Response $response)
     320        return $this->httpClient->sendRequest($request);
     321    }
     322
     323    /**
     324     * @param ResponseInterface $response
     325     *
     326     * @return stdClass
     327     */
     328    private function handleResponse(ResponseInterface $response)
    281329    {
    282330        $this->setRateLimitDetails($response);
    283331
    284         $stream = \GuzzleHttp\Psr7\stream_for($response->getBody());
    285         $data = json_decode($stream);
    286         return $data;
    287     }
    288 
    289     /**
    290      * @param Response $response
    291      * @return void
    292      */
    293     private function setRateLimitDetails(Response $response)
     332        $stream = $response->getBody()->getContents();
     333
     334        return json_decode($stream);
     335    }
     336
     337    /**
     338     * @param ResponseInterface $response
     339     */
     340    private function setRateLimitDetails(ResponseInterface $response)
    294341    {
    295342        $this->rateLimitDetails = [
     
    305352        ];
    306353    }
    307 
    308     /**
    309      * @return int[]
    310      */
    311     public function getRateLimitDetails()
    312     {
    313         return $this->rateLimitDetails;
    314     }
    315354}
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomCompanies.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomCompanies
     
    2628     * @see    https://developers.intercom.io/reference#create-or-update-company
    2729     * @param  array $options
    28      * @return mixed
    29      * @throws \GuzzleHttp\Exception\GuzzleException
     30     * @return stdClass
     31     * @throws Exception
    3032     */
    3133    public function create($options)
     
    3941     * @see    https://developers.intercom.io/reference#create-or-update-company
    4042     * @param  array $options
    41      * @return mixed
    42      * @throws \GuzzleHttp\Exception\GuzzleException
     43     * @return stdClass
     44     * @throws Exception
    4345     */
    4446    public function update($options)
     
    5254     * @see    https://developers.intercom.io/reference#list-companies
    5355     * @param  array $options
    54      * @return mixed
    55      * @throws \GuzzleHttp\Exception\GuzzleException
     56     * @return stdClass
     57     * @throws Exception
    5658     */
    5759    public function getCompanies($options)
     
    5961        return $this->client->get("companies", $options);
    6062    }
     63
     64    /**
     65     * Gets a single Company based on the Intercom ID.
     66     *
     67     * @see    https://developers.intercom.com/reference#view-a-company
     68     * @param  string $id
     69     * @param  array  $options
     70     * @return stdClass
     71     * @throws Exception
     72     */
     73    public function getCompany($id, $options = [])
     74    {
     75        $path = $this->companyPath($id);
     76        return $this->client->get($path, $options);
     77    }
     78
     79    /**
     80     * @param string $id
     81     * @return string
     82     */
     83    public function companyPath($id)
     84    {
     85        return 'companies/' . $id;
     86    }
    6187}
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomConversations.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomConversations
     
    2628     * @see    https://developers.intercom.io/reference#list-conversations
    2729     * @param  array $options
    28      * @return mixed
    29      * @throws \GuzzleHttp\Exception\GuzzleException
     30     * @return stdClass
     31     * @throws Exception
    3032     */
    3133    public function getConversations($options)
     
    3941     * @see    https://developers.intercom.io/reference#get-a-single-conversation
    4042     * @param  string $id
    41      * @return mixed
    42      * @throws \GuzzleHttp\Exception\GuzzleException
     43     * @param  array  $options
     44     * @return stdClass
     45     * @throws Exception
    4346     */
    4447    public function getConversation($id, $options = [])
     
    5457     * @param  string $id
    5558     * @param  array  $options
    56      * @return mixed
    57      * @throws \GuzzleHttp\Exception\GuzzleException
     59     * @return stdClass
     60     * @throws Exception
    5861     */
    5962    public function replyToConversation($id, $options)
     
    6871     * @see    https://developers.intercom.io/reference#replying-to-users-last-conversation
    6972     * @param  array $options
    70      * @return mixed
    71      * @throws \GuzzleHttp\Exception\GuzzleException
     73     * @return stdClass
     74     * @throws Exception
    7275     */
    7376    public function replyToLastConversation($options)
     
    8285     * @see    https://developers.intercom.io/reference#marking-a-conversation-as-read
    8386     * @param  string $id
    84      * @return mixed
    85      * @throws \GuzzleHttp\Exception\GuzzleException
     87     * @return stdClass
     88     * @throws Exception
    8689     */
    8790    public function markConversationAsRead($id)
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomCounts.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomCounts
     
    2628     * @see    https://developers.intercom.io/reference#getting-counts
    2729     * @param  array $options
    28      * @return mixed
    29      * @throws \GuzzleHttp\Exception\GuzzleException
     30     * @return stdClass
     31     * @throws Exception
    3032     */
    3133    public function getCounts($options = [])
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomEvents.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomEvents
     
    2628     * @see    https://developers.intercom.io/reference#submitting-events
    2729     * @param  array $options
    28      * @return mixed
    29      * @throws \GuzzleHttp\Exception\GuzzleException
     30     * @return stdClass
     31     * @throws Exception
    3032     */
    3133    public function create($options)
     
    3941     * @see    https://developers.intercom.io/reference#list-user-events
    4042     * @param  array $options
    41      * @return mixed
    42      * @throws \GuzzleHttp\Exception\GuzzleException
     43     * @return stdClass
     44     * @throws Exception
    4345     */
    4446    public function getEvents($options)
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomLeads.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomLeads
     
    2628     * @see    https://developers.intercom.io/reference#create-lead
    2729     * @param  array $options
    28      * @return mixed
    29      * @throws \GuzzleHttp\Exception\GuzzleException
     30     * @return stdClass
     31     * @throws Exception
    3032     */
    3133    public function create($options)
     
    3941     * @see    https://developers.intercom.io/reference#create-lead
    4042     * @param  array $options
    41      * @return mixed
    42      * @throws \GuzzleHttp\Exception\GuzzleException
     43     * @return stdClass
     44     * @throws Exception
    4345     */
    4446    public function update($options)
     
    5254     * @see    https://developers.intercom.io/reference#list-leads
    5355     * @param  array $options
    54      * @return mixed
    55      * @throws \GuzzleHttp\Exception\GuzzleException
     56     * @return stdClass
     57     * @throws Exception
    5658     */
    5759    public function getLeads($options)
     
    6668     * @param  string $id
    6769     * @param  array  $options
    68      * @return mixed
    69      * @throws \GuzzleHttp\Exception\GuzzleException
     70     * @return stdClass
     71     * @throws Exception
    7072     */
    7173    public function getLead($id, $options = [])
     
    8183     * @param  string $id
    8284     * @param  array  $options
    83      * @return mixed
    84      * @throws \GuzzleHttp\Exception\GuzzleException
     85     * @return stdClass
     86     * @throws Exception
    8587     */
    8688    public function deleteLead($id, $options = [])
     
    9597     * @see    https://developers.intercom.io/reference#convert-a-lead
    9698     * @param  $options
    97      * @return mixed
    98      * @throws \GuzzleHttp\Exception\GuzzleException
     99     * @return stdClass
     100     * @throws Exception
    99101     */
    100102    public function convertLead($options)
     
    119121     * @see    https://developers.intercom.com/v2.0/reference#iterating-over-all-leads
    120122     * @param  array $options
    121      * @return mixed
    122      * @throws \GuzzleHttp\Exception\GuzzleException
     123     * @return stdClass
     124     * @throws Exception
    123125     */
    124126    public function scrollLeads($options = [])
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomMessages.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomMessages
     
    2628     * @see    https://developers.intercom.io/reference#conversations
    2729     * @param  array $options
    28      * @return mixed
    29      * @throws \GuzzleHttp\Exception\GuzzleException
     30     * @return stdClass
     31     * @throws Exception
    3032     */
    3133    public function create($options)
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomNotes.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomNotes
     
    2628     * @see    https://developers.intercom.io/reference#create-a-note
    2729     * @param  array $options
    28      * @return mixed
    29      * @throws \GuzzleHttp\Exception\GuzzleException
     30     * @return stdClass
     31     * @throws Exception
    3032     */
    3133    public function create($options)
     
    3941     * @see    https://developers.intercom.io/reference#list-notes-for-a-user
    4042     * @param  array $options
    41      * @return mixed
    42      * @throws \GuzzleHttp\Exception\GuzzleException
     43     * @return stdClass
     44     * @throws Exception
    4345     */
    4446    public function getNotes($options)
     
    5254     * @see    https://developers.intercom.io/reference#view-a-note
    5355     * @param  string $id
    54      * @return mixed
    55      * @throws \GuzzleHttp\Exception\GuzzleException
     56     * @return stdClass
     57     * @throws Exception
    5658     */
    5759    public function getNote($id)
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomSegments.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomSegments
     
    2729     * @param  string $id
    2830     * @param  array  $options
    29      * @return mixed
    30      * @throws \GuzzleHttp\Exception\GuzzleException
     31     * @return stdClass
     32     * @throws Exception
    3133     */
    3234    public function getSegment($id, array $options = [])
     
    4042     * @see    https://developers.intercom.com/reference#list-segments
    4143     * @param  array $options
    42      * @return mixed
    43      * @throws \GuzzleHttp\Exception\GuzzleException
     44     * @return stdClass
     45     * @throws Exception
    4446     */
    4547    public function getSegments($options = [])
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomTags.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomTags
     
    2628     * @see    https://developers.intercom.io/reference#create-and-update-tags
    2729     * @param  array $options
    28      * @return mixed
    29      * @throws \GuzzleHttp\Exception\GuzzleException
     30     * @return stdClass
     31     * @throws Exception
    3032     */
    3133    public function tag($options)
     
    3941     * @see    https://developers.intercom.io/reference#list-tags-for-an-app
    4042     * @param  array $options
    41      * @return mixed
    42      * @throws \GuzzleHttp\Exception\GuzzleException
     43     * @return stdClass
     44     * @throws Exception
    4345     */
    4446    public function getTags($options = [])
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomUsers.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomUsers
     
    2628     * @see    https://developers.intercom.io/reference#create-or-update-user
    2729     * @param  array $options
    28      * @return mixed
    29      * @throws \GuzzleHttp\Exception\GuzzleException
     30     * @return stdClass
     31     * @throws Exception
    3032     */
    3133    public function create($options)
     
    3941     * @see    https://developers.intercom.io/reference#create-or-update-user
    4042     * @param  array $options
    41      * @return mixed
    42      * @throws \GuzzleHttp\Exception\GuzzleException
     43     * @return stdClass
     44     * @throws Exception
    4345     */
    4446    public function update($options)
     
    5254     * @see    https://developers.intercom.io/reference#list-users
    5355     * @param  array $options
    54      * @return mixed
    55      * @throws \GuzzleHttp\Exception\GuzzleException
     56     * @return stdClass
     57     * @throws Exception
    5658     */
    5759    public function getUsers($options)
     
    6668     * @param  string $id
    6769     * @param  array  $options
    68      * @return mixed
    69      * @throws \GuzzleHttp\Exception\GuzzleException
     70     * @return stdClass
     71     * @throws Exception
    7072     */
    7173    public function getUser($id, $options = [])
     
    8082     * @see    https://developers.intercom.com/reference#iterating-over-all-users
    8183     * @param  array $options
    82      * @return mixed
    83      * @throws \GuzzleHttp\Exception\GuzzleException
     84     * @return stdClass
     85     * @throws Exception
    8486     */
    8587    public function scrollUsers($options = [])
     
    9193     * Deletes a single User based on the Intercom ID.
    9294     *
    93      * @see    https://developers.intercom.com/reference#delete-a-user
     95     * @see    https://developers.intercom.com/reference#archive-a-user
    9496     * @param  string $id
    9597     * @param  array  $options
    96      * @return mixed
    97      * @throws \GuzzleHttp\Exception\GuzzleException
     98     * @return stdClass
     99     * @throws Exception
     100     */
     101    public function archiveUser($id, $options = [])
     102    {
     103        $path = $this->userPath($id);
     104        return $this->client->delete($path, $options);
     105    }
     106
     107    /**
     108     * Deletes a single User based on the Intercom ID.
     109     *
     110     * @see    https://developers.intercom.com/reference#archive-a-user
     111     * @param  string $id
     112     * @param  array  $options
     113     * @return stdClass
     114     * @throws Exception
    98115     */
    99116    public function deleteUser($id, $options = [])
    100117    {
    101         $path = $this->userPath($id);
    102         return $this->client->delete($path, $options);
     118        return $this->archiveUser($id, $options);
     119    }
     120
     121    /**
     122     * Permanently deletes a single User based on the Intercom ID.
     123     *
     124     * @see   https://developers.intercom.com/reference#delete-users
     125     * @param string $id
     126     * @return stdClass
     127     * @throws Exception
     128     */
     129    public function permanentlyDeleteUser($id)
     130    {
     131        return $this->client->post('user_delete_requests', [
     132            'intercom_user_id' => $id
     133        ]);
    103134    }
    104135
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/src/IntercomVisitors.php

    r1864548 r2039426  
    22
    33namespace Intercom;
     4
     5use Http\Client\Exception;
    46
    57class IntercomVisitors
     
    2628     * @see    https://developers.intercom.com/reference#update-a-visitor
    2729     * @param  array $options
    28      * @return mixed
    29      * @throws \GuzzleHttp\Exception\GuzzleException
     30     * @return stdClass
     31     * @throws Exception
    3032     */
    3133    public function update($options)
     
    4143     * @param  string $id
    4244     * @param  array  $options
    43      * @return mixed
    44      * @throws \GuzzleHttp\Exception\GuzzleException
     45     * @return stdClass
     46     * @throws Exception
    4547     */
    4648    public function getVisitor($id, $options = [])
     
    5658     * @param  string $id
    5759     * @param  array  $options
    58      * @return mixed
    59      * @throws \GuzzleHttp\Exception\GuzzleException
     60     * @return stdClass
     61     * @throws Exception
    6062     */
    6163    public function deleteVisitor($id, $options = [])
     
    7072     * @see    https://developers.intercom.io/reference#convert-a-lead
    7173     * @param  $options
    72      * @return mixed
    73      * @throws \GuzzleHttp\Exception\GuzzleException
     74     * @return stdClass
     75     * @throws Exception
    7476     */
    7577    public function convertVisitor($options)
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomAdminsTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomAdmins;
     6use PHPUnit\Framework\TestCase;
    47
    5 class IntercomAdminsTest extends PHPUnit_Framework_TestCase
     8class IntercomAdminsTest extends TestCase
    69{
    710    public function testAdminsList()
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomBulkTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomBulk;
     6use PHPUnit\Framework\TestCase;
    47
    5 class IntercomBulkTest extends PHPUnit_Framework_TestCase
     8class IntercomBulkTest extends TestCase
    69{
    710    public function testBulkUsers()
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomClientTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
     5use DateTimeImmutable;
     6use Http\Adapter\Guzzle6\Client;
    37use Intercom\IntercomClient;
    4 use GuzzleHttp\Client;
     8use GuzzleHttp\Client as GuzzleClient;
    59use GuzzleHttp\Handler\MockHandler;
    610use GuzzleHttp\Psr7\Response;
    711use GuzzleHttp\HandlerStack;
    812use GuzzleHttp\Middleware;
     13use PHPUnit\Framework\TestCase;
     14use stdClass;
    915
    10 class IntercomClientTest extends PHPUnit_Framework_TestCase
     16class IntercomClientTest extends TestCase
    1117{
    1218    public function testBasicClient()
    1319    {
    14         $mock = new MockHandler(
    15             [
     20        $mock = new MockHandler([
    1621            new Response(200, ['X-Foo' => 'Bar'], "{\"foo\":\"bar\"}")
    17             ]
    18         );
     22        ]);
    1923
    2024        $container = [];
     
    2327        $stack->push($history);
    2428
    25         $http_client = new Client(['handler' => $stack]);
     29        $httpClient = new Client(new GuzzleClient(['handler' => $stack]));
    2630
    2731        $client = new IntercomClient('u', 'p');
    28         $client->setClient($http_client);
     32        $client->setHttpClient($httpClient);
    2933
    30         $client->users->create(
    31             [
     34        $client->users->create([
    3235            'email' => 'test@intercom.io'
    33             ]
    34         );
     36        ]);
    3537
    3638        foreach ($container as $transaction) {
     
    4244    public function testExtendedClient()
    4345    {
    44         $mock = new MockHandler(
    45             [
     46        $mock = new MockHandler([
    4647            new Response(200, ['X-Foo' => 'Bar'], "{\"foo\":\"bar\"}")
    47             ]
    48         );
     48        ]);
    4949
    5050        $container = [];
     
    5353        $stack->push($history);
    5454
    55         $http_client = new Client(['handler' => $stack]);
     55        $httpClient = new Client(new GuzzleClient(['handler' => $stack, 'connect_timeout' => 10]));
    5656
    57         $client = new IntercomClient('u', 'p', ['connect_timeout' => 10]);
    58         $client->setClient($http_client);
     57        $client = new IntercomClient('u', 'p');
     58        $client->setHttpClient($httpClient);
    5959
    60         $client->users->create(
    61             [
     60        $client->users->create([
    6261            'email' => 'test@intercom.io'
    63             ]
    64         );
     62        ]);
    6563
    6664        foreach ($container as $transaction) {
    67             $basic = $client->getGuzzleRequestOptions()['connect_timeout'];
    68             $this->assertTrue($basic == 10);
     65            $options = $transaction['options'];
     66            $this->assertEquals($options['connect_timeout'], 10);
    6967        }
    7068    }
    7169
    72 
    73     public function testPaginationHelper()
     70    public function testClientWithExtraHeaders()
    7471    {
    75         $mock = new MockHandler(
    76             [
     72        $mock = new MockHandler([
    7773            new Response(200, ['X-Foo' => 'Bar'], "{\"foo\":\"bar\"}")
    78             ]
    79         );
     74        ]);
    8075
    8176        $container = [];
     
    8479        $stack->push($history);
    8580
    86         $http_client = new Client(['handler' => $stack]);
     81        $httpClient = new Client(new GuzzleClient(['handler' => $stack]));
     82
     83        $client = new IntercomClient('u', 'p', ['Custom-Header' => 'value']);
     84        $client->setHttpClient($httpClient);
     85
     86        $client->users->create([
     87            'email' => 'test@intercom.io'
     88        ]);
     89
     90        foreach ($container as $transaction) {
     91            $headers = $transaction['request']->getHeaders();
     92            $this->assertEquals($headers['Accept'][0], 'application/json');
     93            $this->assertEquals($headers['Content-Type'][0], 'application/json');
     94            $this->assertEquals($headers['Custom-Header'][0], 'value');
     95        }
     96    }
     97
     98    public function testPaginationHelper()
     99    {
     100        $mock = new MockHandler([
     101            new Response(200, ['X-Foo' => 'Bar'], "{\"foo\":\"bar\"}")
     102        ]);
     103
     104        $container = [];
     105        $history = Middleware::history($container);
     106        $stack = HandlerStack::create($mock);
     107        $stack->push($history);
     108
     109        $httpClient = new Client(new GuzzleClient(['handler' => $stack]));
    87110
    88111        $client = new IntercomClient('u', 'p');
    89         $client->setClient($http_client);
     112        $client->setHttpClient($httpClient);
    90113
    91114        $pages = new stdClass;
     
    104127        date_default_timezone_set('UTC');
    105128        $time = time() + 7;
    106         $mock = new MockHandler(
    107             [
    108             new Response(200, ['X-RateLimit-Limit' => '83', 'X-RateLimit-Remaining' => '2', 'X-RateLimit-Reset' => $time], "{\"foo\":\"bar\"}")
    109             ]
    110         );
     129        $mock = new MockHandler([
     130            new Response(
     131                200,
     132                [
     133                    'X-RateLimit-Limit' => '83',
     134                    'X-RateLimit-Remaining' => '2',
     135                    'X-RateLimit-Reset' => $time
     136                ],
     137                "{\"foo\":\"bar\"}"
     138            )
     139        ]);
    111140
    112141        $container = [];
     
    115144        $stack->push($history);
    116145
    117         $http_client = new Client(['handler' => $stack]);
     146        $httpClient = new Client(new GuzzleClient(['handler' => $stack]));
    118147
    119148        $client = new IntercomClient('u', 'p');
    120         $client->setClient($http_client);
     149        $client->setHttpClient($httpClient);
    121150
    122         $client->users->create(
    123             [
     151        $client->users->create([
    124152            'email' => 'test@intercom.io'
    125             ]
    126         );
     153        ]);
    127154
    128155        $rateLimitDetails = $client->getRateLimitDetails();
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomCompaniesTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomCompanies;
    4 use Intercom\IntercomClient;
    5 use GuzzleHttp\Client;
    6 use GuzzleHttp\Handler\MockHandler;
    7 use GuzzleHttp\Psr7\Response;
    8 use GuzzleHttp\HandlerStack;
    9 use GuzzleHttp\Middleware;
     6use PHPUnit\Framework\TestCase;
    107
    11 class IntercomCompaniesTest extends PHPUnit_Framework_TestCase
     8class IntercomCompaniesTest extends TestCase
    129{
    1310    public function testCompanyCreate()
     
    3734        $this->assertEquals('foo', $companies->getCompanies([]));
    3835    }
     36
     37    public function testCompanyPath()
     38    {
     39        $stub = $this->getMockBuilder('Intercom\IntercomClient')->disableOriginalConstructor()->getMock();
     40        $users = new IntercomCompanies($stub);
     41        $this->assertEquals('companies/foo', $users->companyPath("foo"));
     42    }
     43
     44    public function testCompanyGetById()
     45    {
     46        $stub = $this->getMockBuilder('Intercom\IntercomClient')->disableOriginalConstructor()->getMock();
     47        $stub->method('get')->willReturn('foo');
     48
     49        $users = new IntercomCompanies($stub);
     50        $this->assertEquals('foo', $users->getCompany("foo"));
     51    }
    3952}
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomConversationsTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomConversations;
    4 use Intercom\IntercomClient;
    5 use GuzzleHttp\Client;
    6 use GuzzleHttp\Handler\MockHandler;
    7 use GuzzleHttp\Psr7\Response;
    8 use GuzzleHttp\HandlerStack;
    9 use GuzzleHttp\Middleware;
     6use PHPUnit\Framework\TestCase;
    107
    11 class IntercomConversationsTest extends PHPUnit_Framework_TestCase
     8class IntercomConversationsTest extends TestCase
    129{
    1310    public function testConversationsList()
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomCountsTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomCounts;
     6use PHPUnit\Framework\TestCase;
    47
    5 class IntercomCountsTest extends PHPUnit_Framework_TestCase
     8class IntercomCountsTest extends TestCase
    69{
    710    public function testCountsList()
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomEventsTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomEvents;
    4 use Intercom\IntercomClient;
    5 use GuzzleHttp\Client;
    6 use GuzzleHttp\Handler\MockHandler;
    7 use GuzzleHttp\Psr7\Response;
    8 use GuzzleHttp\HandlerStack;
    9 use GuzzleHttp\Middleware;
     6use PHPUnit\Framework\TestCase;
    107
    11 class IntercomEventsTest extends PHPUnit_Framework_TestCase
     8class IntercomEventsTest extends TestCase
    129{
    1310    public function testEventCreate()
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomLeadsTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomLeads;
     6use PHPUnit\Framework\TestCase;
    47
    5 class IntercomLeadsTest extends PHPUnit_Framework_TestCase
     8class IntercomLeadsTest extends TestCase
    69{
    710    public function testLeadCreate()
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomMessagesTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomMessages;
    4 use Intercom\IntercomClient;
    5 use GuzzleHttp\Client;
    6 use GuzzleHttp\Handler\MockHandler;
    7 use GuzzleHttp\Psr7\Response;
    8 use GuzzleHttp\HandlerStack;
    9 use GuzzleHttp\Middleware;
     6use PHPUnit\Framework\TestCase;
    107
    11 class IntercomMessagesTest extends PHPUnit_Framework_TestCase
     8class IntercomMessagesTest extends TestCase
    129{
    1310    public function testMessageCreate()
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomNotesTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomNotes;
     6use PHPUnit\Framework\TestCase;
    47
    5 class IntercomNotesTest extends PHPUnit_Framework_TestCase
     8class IntercomNotesTest extends TestCase
    69{
    710    public function testNoteCreate()
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomSegmentsTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomSegments;
     6use PHPUnit\Framework\TestCase;
    47
    5 class IntercomSegmentTest extends PHPUnit_Framework_TestCase
     8class IntercomSegmentTest extends TestCase
    69{
    710
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomTagsTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomTags;
     6use PHPUnit\Framework\TestCase;
    47
    5 class IntercomTagsTest extends PHPUnit_Framework_TestCase
     8class IntercomTagsTest extends TestCase
    69{
    710    public function testTagUsers()
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomUsersTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomUsers;
    4 use Intercom\IntercomClient;
    5 use GuzzleHttp\Client;
    6 use GuzzleHttp\Handler\MockHandler;
    7 use GuzzleHttp\Psr7\Response;
    8 use GuzzleHttp\HandlerStack;
    9 use GuzzleHttp\Middleware;
     6use PHPUnit\Framework\TestCase;
    107
    11 class IntercomUsersTest extends PHPUnit_Framework_TestCase
     8class IntercomUsersTest extends TestCase
    129{
    1310    public function testUserCreate()
     
    3734        $this->assertEquals('foo', $users->getUsers([]));
    3835    }
     36
     37    public function testArchiveUser()
     38    {
     39        $stub = $this->getMockBuilder('Intercom\IntercomClient')->disableOriginalConstructor()->getMock();
     40        $stub->method('delete')->willReturn('foo');
     41
     42        $users = new IntercomUsers($stub);
     43        $this->assertEquals('foo', $users->archiveUser(''));
     44    }
     45
     46    public function testDeleteUser()
     47    {
     48        $stub = $this->getMockBuilder('Intercom\IntercomClient')->disableOriginalConstructor()->getMock();
     49        $stub->method('delete')->willReturn('foo');
     50
     51        $users = new IntercomUsers($stub);
     52        $this->assertEquals('foo', $users->deleteUser(''));
     53    }
     54
     55    public function testPermanentlyDeleteUser()
     56    {
     57        $stub = $this->getMockBuilder('Intercom\IntercomClient')->disableOriginalConstructor()->getMock();
     58        $stub->method('post')->willReturn('foo');
     59
     60        $users = new IntercomUsers($stub);
     61        $this->assertEquals('foo', $users->permanentlyDeleteUser(''));
     62    }
    3963}
  • mplus-intercom-subscription/trunk/vendor/intercom/intercom-php/test/IntercomVisitorsTest.php

    r1864548 r2039426  
    11<?php
    22
     3namespace Intercom\Test;
     4
    35use Intercom\IntercomVisitors;
     6use PHPUnit\Framework\TestCase;
    47
    5 class IntercomVisitorsTest extends PHPUnit_Framework_TestCase
     8class IntercomVisitorsTest extends TestCase
    69{
    710
Note: See TracChangeset for help on using the changeset viewer.