Phalcon Framework 2.0.7

Aws\Sqs\Exception\SqsException: Error executing "SendMessage" on "https://sqs.eu-west-1.amazonaws.com/324404655028/beanstalk"; AWS HTTP error: Client error: `POST https://sqs.eu-west-1.amazonaws.com/324404655028/beanstalk` resulted in a `403 Forbidden` response:\n<?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>S (truncated...)\n SignatureDoesNotMatch (client): Signature not yet current: 20170524T194143Z is still later than 20170524T194112Z (20170524T192612Z + 15 min.) - <?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>SignatureDoesNotMatch</Code><Message>Signature not yet current: 20170524T194143Z is still later than 20170524T194112Z (20170524T192612Z + 15 min.)</Message><Detail/></Error><RequestId>6afcd9b3-32dd-51a6-aeb9-882cd249753c</RequestId></ErrorResponse>

/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php (159)
#0Aws\WrappedHttpHandler->parseError(Array([exception] => Object(GuzzleHttp\Exception\ClientException), [connection_error] => , [response] => Object(GuzzleHttp\Psr7\Response)), Object(GuzzleHttp\Psr7\Request), Object(Aws\Command))
/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php (77)
<?php
namespace Aws;
 
use Aws\Api\Parser\Exception\ParserException;
use GuzzleHttp\Promise;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
 
/**
 * Converts an HTTP handler into a Command HTTP handler.
 *
 * HTTP handlers have the following signature:
 *     function(RequestInterface $request, array $options) : PromiseInterface
 *
 * The promise returned form an HTTP handler must resolve to a PSR-7 response
 * object when fulfilled or an error array when rejected. The error array
 * can contain the following data:
 *
 * - exception: (required, Exception) Exception that was encountered.
 * - response: (ResponseInterface) PSR-7 response that was received (if a
 *   response) was received.
 * - connection_error: (bool) True if the error is the result of failing to
 *   connect.
 */
class WrappedHttpHandler
{
    private $httpHandler;
    private $parser;
    private $errorParser;
    private $exceptionClass;
 
    /**
     * @param callable $httpHandler    Function that accepts a request and array
     *                                 of request options and returns a promise
     *                                 that fulfills with a response or rejects
     *                                 with an error array.
     * @param callable $parser         Function that accepts a response object
     *                                 and returns an AWS result object.
     * @param callable $errorParser    Function that parses a response object
     *                                 into AWS error data.
     * @param string   $exceptionClass Exception class to throw.
     */
    public function __construct(
        callable $httpHandler,
        callable $parser,
        callable $errorParser,
        $exceptionClass = 'Aws\Exception\AwsException'
    ) {
        $this->httpHandler = $httpHandler;
        $this->parser = $parser;
        $this->errorParser = $errorParser;
        $this->exceptionClass = $exceptionClass;
    }
 
    /**
     * Calls the simpler HTTP specific handler and wraps the returned promise
     * with AWS specific values (e.g., a result object or AWS exception).
     *
     * @param CommandInterface $command Command being executed.
     * @param RequestInterface $request Request to send.
     *
     * @return Promise\PromiseInterface
     */
    public function __invoke(
        CommandInterface $command,
        RequestInterface $request
    ) {
        $fn = $this->httpHandler;
 
        return Promise\promise_for($fn($request, $command['@http'] ?: []))
            ->then(
                function (ResponseInterface $res) use ($command, $request) {
                    return $this->parseResponse($command, $request, $res);
                },
                function ($err) use ($request, $command) {
                    if (is_array($err)) {
                        $exception = $this->parseError($err, $request, $command);
                        return new Promise\RejectedPromise($exception);
                    }
                    return new Promise\RejectedPromise($err);
                }
            );
    }
 
    /**
     * @param CommandInterface  $command
     * @param RequestInterface  $request
     * @param ResponseInterface $response
     *
     * @return ResultInterface
     */
    private function parseResponse(
        CommandInterface $command,
        RequestInterface $request,
        ResponseInterface $response
    ) {
        $parser = $this->parser;
        $status = $response->getStatusCode();
        $result = $status < 300
            ? $parser($command, $response)
            : new Result();
 
        $metadata = [
            'statusCode'   => $status,
            'effectiveUri' => (string) $request->getUri(),
            'headers'      => []
         ];
 
        // Bring headers into the metadata array.
        foreach ($response->getHeaders() as $name => $values) {
            $metadata['headers'][strtolower($name)] = $values[0];
        }
 
        $result['@metadata'] = $metadata;
 
        return $result;
    }
 
    /**
     * Parses a rejection into an AWS error.
     *
     * @param array            $err     Rejection error array.
     * @param RequestInterface $request Request that was sent.
     * @param CommandInterface $command Command being sent.
     *
     * @return \Exception
     */
    private function parseError(
        array $err,
        RequestInterface $request,
        CommandInterface $command
    ) {
        if (!isset($err['exception'])) {
            throw new \RuntimeException('The HTTP handler was rejected without an "exception" key value pair.');
        }
 
        $serviceError = "AWS HTTP error: " . $err['exception']->getMessage();
 
        if (!isset($err['response'])) {
            $parts = ['response' => null];
        } else {
            try {
                $parts = call_user_func($this->errorParser, $err['response']);
                $serviceError .= " {$parts['code']} ({$parts['type']}): "
                    . "{$parts['message']} - " . $err['response']->getBody();
            } catch (ParserException $e) {
                $parts = [];
                $serviceError .= ' Unable to parse error information from '
                    . "response - {$e->getMessage()}";
            }
 
            $parts['response'] = $err['response'];
        }
 
        $parts['exception'] = $err['exception'];
        $parts['request'] = $request;
        $parts['connection_error'] = !empty($err['connection_error']);
 
        return new $this->exceptionClass(
            sprintf(
                'Error executing "%s" on "%s"; %s',
                $command->getName(),
                $request->getUri(),
                $serviceError
            ),
            $command,
            $parts,
            $err['exception']
        );
    }
}
#1Aws\WrappedHttpHandler->Aws\{closure}(Array([exception] => Object(GuzzleHttp\Exception\ClientException), [connection_error] => , [response] => Object(GuzzleHttp\Psr7\Response)))
/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/Promise.php (199)
<?php
namespace GuzzleHttp\Promise;
 
/**
 * Promises/A+ implementation that avoids recursion when possible.
 *
 * @link https://promisesaplus.com/
 */
class Promise implements PromiseInterface
{
    private $state = self::PENDING;
    private $result;
    private $cancelFn;
    private $waitFn;
    private $waitList;
    private $handlers = [];
 
    /**
     * @param callable $waitFn   Fn that when invoked resolves the promise.
     * @param callable $cancelFn Fn that when invoked cancels the promise.
     */
    public function __construct(
        callable $waitFn = null,
        callable $cancelFn = null
    ) {
        $this->waitFn = $waitFn;
        $this->cancelFn = $cancelFn;
    }
 
    public function then(
        callable $onFulfilled = null,
        callable $onRejected = null
    ) {
        if ($this->state === self::PENDING) {
            $p = new Promise(null, [$this, 'cancel']);
            $this->handlers[] = [$p, $onFulfilled, $onRejected];
            $p->waitList = $this->waitList;
            $p->waitList[] = $this;
            return $p;
        }
 
        // Return a fulfilled promise and immediately invoke any callbacks.
        if ($this->state === self::FULFILLED) {
            return $onFulfilled
                ? promise_for($this->result)->then($onFulfilled)
                : promise_for($this->result);
        }
 
        // It's either cancelled or rejected, so return a rejected promise
        // and immediately invoke any callbacks.
        $rejection = rejection_for($this->result);
        return $onRejected ? $rejection->then(null, $onRejected) : $rejection;
    }
 
    public function otherwise(callable $onRejected)
    {
        return $this->then(null, $onRejected);
    }
 
    public function wait($unwrap = true)
    {
        $this->waitIfPending();
 
        if (!$unwrap) {
            return null;
        }
 
        if ($this->result instanceof PromiseInterface) {
            return $this->result->wait($unwrap);
        } elseif ($this->state === self::FULFILLED) {
            return $this->result;
        } else {
            // It's rejected so "unwrap" and throw an exception.
            throw exception_for($this->result);
        }
    }
 
    public function getState()
    {
        return $this->state;
    }
 
    public function cancel()
    {
        if ($this->state !== self::PENDING) {
            return;
        }
 
        $this->waitFn = $this->waitList = null;
 
        if ($this->cancelFn) {
            $fn = $this->cancelFn;
            $this->cancelFn = null;
            try {
                $fn();
            } catch (\Exception $e) {
                $this->reject($e);
            }
        }
 
        // Reject the promise only if it wasn't rejected in a then callback.
        if ($this->state === self::PENDING) {
            $this->reject(new CancellationException('Promise has been cancelled'));
        }
    }
 
    public function resolve($value)
    {
        $this->settle(self::FULFILLED, $value);
    }
 
    public function reject($reason)
    {
        $this->settle(self::REJECTED, $reason);
    }
 
    private function settle($state, $value)
    {
        if ($this->state !== self::PENDING) {
            // Ignore calls with the same resolution.
            if ($state === $this->state && $value === $this->result) {
                return;
            }
            throw $this->state === $state
                ? new \LogicException("The promise is already {$state}.")
                : new \LogicException("Cannot change a {$this->state} promise to {$state}");
        }
 
        if ($value === $this) {
            throw new \LogicException('Cannot fulfill or reject a promise with itself');
        }
 
        // Clear out the state of the promise but stash the handlers.
        $this->state = $state;
        $this->result = $value;
        $handlers = $this->handlers;
        $this->handlers = null;
        $this->waitList = $this->waitFn = null;
        $this->cancelFn = null;
 
        if (!$handlers) {
            return;
        }
 
        // If the value was not a settled promise or a thenable, then resolve
        // it in the task queue using the correct ID.
        if (!method_exists($value, 'then')) {
            $id = $state === self::FULFILLED ? 1 : 2;
            // It's a success, so resolve the handlers in the queue.
            queue()->add(static function () use ($id, $value, $handlers) {
                foreach ($handlers as $handler) {
                    self::callHandler($id, $value, $handler);
                }
            });
        } elseif ($value instanceof Promise
            && $value->getState() === self::PENDING
        ) {
            // We can just merge our handlers onto the next promise.
            $value->handlers = array_merge($value->handlers, $handlers);
        } else {
            // Resolve the handlers when the forwarded promise is resolved.
            $value->then(
                static function ($value) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(1, $value, $handler);
                    }
                },
                static function ($reason) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(2, $reason, $handler);
                    }
                }
            );
        }
    }
 
    /**
     * Call a stack of handlers using a specific callback index and value.
     *
     * @param int   $index   1 (resolve) or 2 (reject).
     * @param mixed $value   Value to pass to the callback.
     * @param array $handler Array of handler data (promise and callbacks).
     *
     * @return array Returns the next group to resolve.
     */
    private static function callHandler($index, $value, array $handler)
    {
        /** @var PromiseInterface $promise */
        $promise = $handler[0];
 
        // The promise may have been cancelled or resolved before placing
        // this thunk in the queue.
        if ($promise->getState() !== self::PENDING) {
            return;
        }
 
        try {
            if (isset($handler[$index])) {
                $promise->resolve($handler[$index]($value));
            } elseif ($index === 1) {
                // Forward resolution values as-is.
                $promise->resolve($value);
            } else {
                // Forward rejections down the chain.
                $promise->reject($value);
            }
        } catch (\Exception $reason) {
            $promise->reject($reason);
        }
    }
 
    private function waitIfPending()
    {
        if ($this->state !== self::PENDING) {
            return;
        } elseif ($this->waitFn) {
            $this->invokeWaitFn();
        } elseif ($this->waitList) {
            $this->invokeWaitList();
        } else {
            // If there's not wait function, then reject the promise.
            $this->reject('Cannot wait on a promise that has '
                . 'no internal wait function. You must provide a wait '
                . 'function when constructing the promise to be able to '
                . 'wait on a promise.');
        }
 
        queue()->run();
 
        if ($this->state === self::PENDING) {
            $this->reject('Invoking the wait callback did not resolve the promise');
        }
    }
 
    private function invokeWaitFn()
    {
        try {
            $wfn = $this->waitFn;
            $this->waitFn = null;
            $wfn(true);
        } catch (\Exception $reason) {
            if ($this->state === self::PENDING) {
                // The promise has not been resolved yet, so reject the promise
                // with the exception.
                $this->reject($reason);
            } else {
                // The promise was already resolved, so there's a problem in
                // the application.
                throw $reason;
            }
        }
    }
 
    private function invokeWaitList()
    {
        $waitList = $this->waitList;
        $this->waitList = null;
 
        foreach ($waitList as $result) {
            descend:
            $result->waitIfPending();
            if ($result->result instanceof Promise) {
                $result = $result->result;
                goto descend;
            }
        }
    }
}
#2GuzzleHttp\Promise\Promise::callHandler(2, Array([exception] => Object(GuzzleHttp\Exception\ClientException), [connection_error] => , [response] => Object(GuzzleHttp\Psr7\Response)), Array([0] => Object(GuzzleHttp\Promise\Promise), [1] => Object(Closure), [2] => Object(Closure)))
/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/Promise.php (170)
<?php
namespace GuzzleHttp\Promise;
 
/**
 * Promises/A+ implementation that avoids recursion when possible.
 *
 * @link https://promisesaplus.com/
 */
class Promise implements PromiseInterface
{
    private $state = self::PENDING;
    private $result;
    private $cancelFn;
    private $waitFn;
    private $waitList;
    private $handlers = [];
 
    /**
     * @param callable $waitFn   Fn that when invoked resolves the promise.
     * @param callable $cancelFn Fn that when invoked cancels the promise.
     */
    public function __construct(
        callable $waitFn = null,
        callable $cancelFn = null
    ) {
        $this->waitFn = $waitFn;
        $this->cancelFn = $cancelFn;
    }
 
    public function then(
        callable $onFulfilled = null,
        callable $onRejected = null
    ) {
        if ($this->state === self::PENDING) {
            $p = new Promise(null, [$this, 'cancel']);
            $this->handlers[] = [$p, $onFulfilled, $onRejected];
            $p->waitList = $this->waitList;
            $p->waitList[] = $this;
            return $p;
        }
 
        // Return a fulfilled promise and immediately invoke any callbacks.
        if ($this->state === self::FULFILLED) {
            return $onFulfilled
                ? promise_for($this->result)->then($onFulfilled)
                : promise_for($this->result);
        }
 
        // It's either cancelled or rejected, so return a rejected promise
        // and immediately invoke any callbacks.
        $rejection = rejection_for($this->result);
        return $onRejected ? $rejection->then(null, $onRejected) : $rejection;
    }
 
    public function otherwise(callable $onRejected)
    {
        return $this->then(null, $onRejected);
    }
 
    public function wait($unwrap = true)
    {
        $this->waitIfPending();
 
        if (!$unwrap) {
            return null;
        }
 
        if ($this->result instanceof PromiseInterface) {
            return $this->result->wait($unwrap);
        } elseif ($this->state === self::FULFILLED) {
            return $this->result;
        } else {
            // It's rejected so "unwrap" and throw an exception.
            throw exception_for($this->result);
        }
    }
 
    public function getState()
    {
        return $this->state;
    }
 
    public function cancel()
    {
        if ($this->state !== self::PENDING) {
            return;
        }
 
        $this->waitFn = $this->waitList = null;
 
        if ($this->cancelFn) {
            $fn = $this->cancelFn;
            $this->cancelFn = null;
            try {
                $fn();
            } catch (\Exception $e) {
                $this->reject($e);
            }
        }
 
        // Reject the promise only if it wasn't rejected in a then callback.
        if ($this->state === self::PENDING) {
            $this->reject(new CancellationException('Promise has been cancelled'));
        }
    }
 
    public function resolve($value)
    {
        $this->settle(self::FULFILLED, $value);
    }
 
    public function reject($reason)
    {
        $this->settle(self::REJECTED, $reason);
    }
 
    private function settle($state, $value)
    {
        if ($this->state !== self::PENDING) {
            // Ignore calls with the same resolution.
            if ($state === $this->state && $value === $this->result) {
                return;
            }
            throw $this->state === $state
                ? new \LogicException("The promise is already {$state}.")
                : new \LogicException("Cannot change a {$this->state} promise to {$state}");
        }
 
        if ($value === $this) {
            throw new \LogicException('Cannot fulfill or reject a promise with itself');
        }
 
        // Clear out the state of the promise but stash the handlers.
        $this->state = $state;
        $this->result = $value;
        $handlers = $this->handlers;
        $this->handlers = null;
        $this->waitList = $this->waitFn = null;
        $this->cancelFn = null;
 
        if (!$handlers) {
            return;
        }
 
        // If the value was not a settled promise or a thenable, then resolve
        // it in the task queue using the correct ID.
        if (!method_exists($value, 'then')) {
            $id = $state === self::FULFILLED ? 1 : 2;
            // It's a success, so resolve the handlers in the queue.
            queue()->add(static function () use ($id, $value, $handlers) {
                foreach ($handlers as $handler) {
                    self::callHandler($id, $value, $handler);
                }
            });
        } elseif ($value instanceof Promise
            && $value->getState() === self::PENDING
        ) {
            // We can just merge our handlers onto the next promise.
            $value->handlers = array_merge($value->handlers, $handlers);
        } else {
            // Resolve the handlers when the forwarded promise is resolved.
            $value->then(
                static function ($value) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(1, $value, $handler);
                    }
                },
                static function ($reason) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(2, $reason, $handler);
                    }
                }
            );
        }
    }
 
    /**
     * Call a stack of handlers using a specific callback index and value.
     *
     * @param int   $index   1 (resolve) or 2 (reject).
     * @param mixed $value   Value to pass to the callback.
     * @param array $handler Array of handler data (promise and callbacks).
     *
     * @return array Returns the next group to resolve.
     */
    private static function callHandler($index, $value, array $handler)
    {
        /** @var PromiseInterface $promise */
        $promise = $handler[0];
 
        // The promise may have been cancelled or resolved before placing
        // this thunk in the queue.
        if ($promise->getState() !== self::PENDING) {
            return;
        }
 
        try {
            if (isset($handler[$index])) {
                $promise->resolve($handler[$index]($value));
            } elseif ($index === 1) {
                // Forward resolution values as-is.
                $promise->resolve($value);
            } else {
                // Forward rejections down the chain.
                $promise->reject($value);
            }
        } catch (\Exception $reason) {
            $promise->reject($reason);
        }
    }
 
    private function waitIfPending()
    {
        if ($this->state !== self::PENDING) {
            return;
        } elseif ($this->waitFn) {
            $this->invokeWaitFn();
        } elseif ($this->waitList) {
            $this->invokeWaitList();
        } else {
            // If there's not wait function, then reject the promise.
            $this->reject('Cannot wait on a promise that has '
                . 'no internal wait function. You must provide a wait '
                . 'function when constructing the promise to be able to '
                . 'wait on a promise.');
        }
 
        queue()->run();
 
        if ($this->state === self::PENDING) {
            $this->reject('Invoking the wait callback did not resolve the promise');
        }
    }
 
    private function invokeWaitFn()
    {
        try {
            $wfn = $this->waitFn;
            $this->waitFn = null;
            $wfn(true);
        } catch (\Exception $reason) {
            if ($this->state === self::PENDING) {
                // The promise has not been resolved yet, so reject the promise
                // with the exception.
                $this->reject($reason);
            } else {
                // The promise was already resolved, so there's a problem in
                // the application.
                throw $reason;
            }
        }
    }
 
    private function invokeWaitList()
    {
        $waitList = $this->waitList;
        $this->waitList = null;
 
        foreach ($waitList as $result) {
            descend:
            $result->waitIfPending();
            if ($result->result instanceof Promise) {
                $result = $result->result;
                goto descend;
            }
        }
    }
}
#3GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}(Array([exception] => Object(GuzzleHttp\Exception\ClientException), [connection_error] => , [response] => Object(GuzzleHttp\Psr7\Response)))
/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/RejectedPromise.php (40)
<?php
namespace GuzzleHttp\Promise;
 
/**
 * A promise that has been rejected.
 *
 * Thenning off of this promise will invoke the onRejected callback
 * immediately and ignore other callbacks.
 */
class RejectedPromise implements PromiseInterface
{
    private $reason;
 
    public function __construct($reason)
    {
        if (method_exists($reason, 'then')) {
            throw new \InvalidArgumentException(
                'You cannot create a RejectedPromise with a promise.');
        }
 
        $this->reason = $reason;
    }
 
    public function then(
        callable $onFulfilled = null,
        callable $onRejected = null
    ) {
        // If there's no onRejected callback then just return self.
        if (!$onRejected) {
            return $this;
        }
 
        $queue = queue();
        $reason = $this->reason;
        $p = new Promise([$queue, 'run']);
        $queue->add(static function () use ($p, $reason, $onRejected) {
            if ($p->getState() === self::PENDING) {
                try {
                    // Return a resolved promise if onRejected does not throw.
                    $p->resolve($onRejected($reason));
                } catch (\Exception $e) {
                    // onRejected threw, so return a rejected promise.
                    $p->reject($e);
                }
            }
        });
 
        return $p;
    }
 
    public function otherwise(callable $onRejected)
    {
        return $this->then(null, $onRejected);
    }
 
    public function wait($unwrap = true, $defaultDelivery = null)
    {
        if ($unwrap) {
            throw exception_for($this->reason);
        }
    }
 
    public function getState()
    {
        return self::REJECTED;
    }
 
    public function resolve($value)
    {
        throw new \LogicException("Cannot resolve a rejected promise");
    }
 
    public function reject($reason)
    {
        if ($reason !== $this->reason) {
            throw new \LogicException("Cannot reject a rejected promise");
        }
    }
 
    public function cancel()
    {
        // pass
    }
}
#4GuzzleHttp\Promise\RejectedPromise::GuzzleHttp\Promise\{closure}()
/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/TaskQueue.php (60)
<?php
namespace GuzzleHttp\Promise;
 
/**
 * A task queue that executes tasks in a FIFO order.
 *
 * This task queue class is used to settle promises asynchronously and
 * maintains a constant stack size. You can use the task queue asynchronously
 * by calling the `run()` function of the global task queue in an event loop.
 *
 *     GuzzleHttp\Promise\queue()->run();
 */
class TaskQueue
{
    private $enableShutdown = true;
    private $queue = [];
 
    public function __construct($withShutdown = true)
    {
        if ($withShutdown) {
            register_shutdown_function(function () {
                if ($this->enableShutdown) {
                    // Only run the tasks if an E_ERROR didn't occur.
                    $err = error_get_last();
                    if (!$err || ($err['type'] ^ E_ERROR)) {
                        $this->run();
                    }
                }
            });
        }
    }
 
    /**
     * Returns true if the queue is empty.
     *
     * @return bool
     */
    public function isEmpty()
    {
        return !$this->queue;
    }
 
    /**
     * Adds a task to the queue that will be executed the next time run is
     * called.
     *
     * @param callable $task
     */
    public function add(callable $task)
    {
        $this->queue[] = $task;
    }
 
    /**
     * Execute all of the pending task in the queue.
     */
    public function run()
    {
        while ($task = array_shift($this->queue)) {
            $task();
        }
    }
 
    /**
     * The task queue will be run and exhausted by default when the process
     * exits IFF the exit is not the result of a PHP E_ERROR error.
     *
     * You can disable running the automatic shutdown of the queue by calling
     * this function. If you disable the task queue shutdown process, then you
     * MUST either run the task queue (as a result of running your event loop
     * or manually using the run() method) or wait on each outstanding promise.
     *
     * Note: This shutdown will occur before any destructors are triggered.
     */
    public function disableShutdown()
    {
        $this->enableShutdown = false;
    }
}
#5GuzzleHttp\Promise\TaskQueue->run()
/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php (96)
<?php
namespace GuzzleHttp\Handler;
 
use GuzzleHttp\Promise as P;
use GuzzleHttp\Promise\Promise;
use GuzzleHttp\Psr7;
use Psr\Http\Message\RequestInterface;
 
/**
 * Returns an asynchronous response using curl_multi_* functions.
 *
 * When using the CurlMultiHandler, custom curl options can be specified as an
 * associative array of curl option constants mapping to values in the
 * **curl** key of the provided request options.
 *
 * @property resource $_mh Internal use only. Lazy loaded multi-handle.
 */
class CurlMultiHandler
{
    /** @var CurlFactoryInterface */
    private $factory;
    private $selectTimeout;
    private $active;
    private $handles = [];
    private $delays = [];
 
    /**
     * This handler accepts the following options:
     *
     * - handle_factory: An optional factory  used to create curl handles
     * - select_timeout: Optional timeout (in seconds) to block before timing
     *   out while selecting curl handles. Defaults to 1 second.
     *
     * @param array $options
     */
    public function __construct(array $options = [])
    {
        $this->factory = isset($options['handle_factory'])
            ? $options['handle_factory'] : new CurlFactory(50);
        $this->selectTimeout = isset($options['select_timeout'])
            ? $options['select_timeout'] : 1;
    }
 
    public function __get($name)
    {
        if ($name === '_mh') {
            return $this->_mh = curl_multi_init();
        }
 
        throw new \BadMethodCallException();
    }
 
    public function __destruct()
    {
        if (isset($this->_mh)) {
            curl_multi_close($this->_mh);
            unset($this->_mh);
        }
    }
 
    public function __invoke(RequestInterface $request, array $options)
    {
        $easy = $this->factory->create($request, $options);
        $id = (int) $easy->handle;
 
        $promise = new Promise(
            [$this, 'execute'],
            function () use ($id) { return $this->cancel($id); }
        );
 
        $this->addRequest(['easy' => $easy, 'deferred' => $promise]);
 
        return $promise;
    }
 
    /**
     * Ticks the curl event loop.
     */
    public function tick()
    {
        // Add any delayed handles if needed.
        if ($this->delays) {
            $currentTime = microtime(true);
            foreach ($this->delays as $id => $delay) {
                if ($currentTime >= $delay) {
                    unset($this->delays[$id]);
                    curl_multi_add_handle(
                        $this->_mh,
                        $this->handles[$id]['easy']->handle
                    );
                }
            }
        }
 
        // Step through the task queue which may add additional requests.
        P\queue()->run();
 
        if ($this->active &&
            curl_multi_select($this->_mh, $this->selectTimeout) === -1
        ) {
            // Perform a usleep if a select returns -1.
            // See: https://bugs.php.net/bug.php?id=61141
            usleep(250);
        }
 
        while (curl_multi_exec($this->_mh, $this->active) === CURLM_CALL_MULTI_PERFORM);
 
        $this->processMessages();
    }
 
    /**
     * Runs until all outstanding connections have completed.
     */
    public function execute()
    {
        $queue = P\queue();
 
        while ($this->handles || !$queue->isEmpty()) {
            // If there are no transfers, then sleep for the next delay
            if (!$this->active && $this->delays) {
                usleep($this->timeToNext());
            }
            $this->tick();
        }
    }
 
    private function addRequest(array $entry)
    {
        $easy = $entry['easy'];
        $id = (int) $easy->handle;
        $this->handles[$id] = $entry;
        if (empty($easy->options['delay'])) {
            curl_multi_add_handle($this->_mh, $easy->handle);
        } else {
            $this->delays[$id] = microtime(true) + ($easy->options['delay'] / 1000);
        }
    }
 
    /**
     * Cancels a handle from sending and removes references to it.
     *
     * @param int $id Handle ID to cancel and remove.
     *
     * @return bool True on success, false on failure.
     */
    private function cancel($id)
    {
        // Cannot cancel if it has been processed.
        if (!isset($this->handles[$id])) {
            return false;
        }
 
        $handle = $this->handles[$id]['easy']->handle;
        unset($this->delays[$id], $this->handles[$id]);
        curl_multi_remove_handle($this->_mh, $handle);
        curl_close($handle);
 
        return true;
    }
 
    private function processMessages()
    {
        while ($done = curl_multi_info_read($this->_mh)) {
            $id = (int) $done['handle'];
            curl_multi_remove_handle($this->_mh, $done['handle']);
 
            if (!isset($this->handles[$id])) {
                // Probably was cancelled.
                continue;
            }
 
            $entry = $this->handles[$id];
            unset($this->handles[$id], $this->delays[$id]);
            $entry['easy']->errno = $done['result'];
            $entry['deferred']->resolve(
                CurlFactory::finish(
                    $this,
                    $entry['easy'],
                    $this->factory
                )
            );
        }
    }
 
    private function timeToNext()
    {
        $currentTime = microtime(true);
        $nextTime = PHP_INT_MAX;
        foreach ($this->delays as $time) {
            if ($time < $nextTime) {
                $nextTime = $time;
            }
        }
 
        return max(0, $currentTime - $nextTime);
    }
}
#6GuzzleHttp\Handler\CurlMultiHandler->tick()
/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php (123)
<?php
namespace GuzzleHttp\Handler;
 
use GuzzleHttp\Promise as P;
use GuzzleHttp\Promise\Promise;
use GuzzleHttp\Psr7;
use Psr\Http\Message\RequestInterface;
 
/**
 * Returns an asynchronous response using curl_multi_* functions.
 *
 * When using the CurlMultiHandler, custom curl options can be specified as an
 * associative array of curl option constants mapping to values in the
 * **curl** key of the provided request options.
 *
 * @property resource $_mh Internal use only. Lazy loaded multi-handle.
 */
class CurlMultiHandler
{
    /** @var CurlFactoryInterface */
    private $factory;
    private $selectTimeout;
    private $active;
    private $handles = [];
    private $delays = [];
 
    /**
     * This handler accepts the following options:
     *
     * - handle_factory: An optional factory  used to create curl handles
     * - select_timeout: Optional timeout (in seconds) to block before timing
     *   out while selecting curl handles. Defaults to 1 second.
     *
     * @param array $options
     */
    public function __construct(array $options = [])
    {
        $this->factory = isset($options['handle_factory'])
            ? $options['handle_factory'] : new CurlFactory(50);
        $this->selectTimeout = isset($options['select_timeout'])
            ? $options['select_timeout'] : 1;
    }
 
    public function __get($name)
    {
        if ($name === '_mh') {
            return $this->_mh = curl_multi_init();
        }
 
        throw new \BadMethodCallException();
    }
 
    public function __destruct()
    {
        if (isset($this->_mh)) {
            curl_multi_close($this->_mh);
            unset($this->_mh);
        }
    }
 
    public function __invoke(RequestInterface $request, array $options)
    {
        $easy = $this->factory->create($request, $options);
        $id = (int) $easy->handle;
 
        $promise = new Promise(
            [$this, 'execute'],
            function () use ($id) { return $this->cancel($id); }
        );
 
        $this->addRequest(['easy' => $easy, 'deferred' => $promise]);
 
        return $promise;
    }
 
    /**
     * Ticks the curl event loop.
     */
    public function tick()
    {
        // Add any delayed handles if needed.
        if ($this->delays) {
            $currentTime = microtime(true);
            foreach ($this->delays as $id => $delay) {
                if ($currentTime >= $delay) {
                    unset($this->delays[$id]);
                    curl_multi_add_handle(
                        $this->_mh,
                        $this->handles[$id]['easy']->handle
                    );
                }
            }
        }
 
        // Step through the task queue which may add additional requests.
        P\queue()->run();
 
        if ($this->active &&
            curl_multi_select($this->_mh, $this->selectTimeout) === -1
        ) {
            // Perform a usleep if a select returns -1.
            // See: https://bugs.php.net/bug.php?id=61141
            usleep(250);
        }
 
        while (curl_multi_exec($this->_mh, $this->active) === CURLM_CALL_MULTI_PERFORM);
 
        $this->processMessages();
    }
 
    /**
     * Runs until all outstanding connections have completed.
     */
    public function execute()
    {
        $queue = P\queue();
 
        while ($this->handles || !$queue->isEmpty()) {
            // If there are no transfers, then sleep for the next delay
            if (!$this->active && $this->delays) {
                usleep($this->timeToNext());
            }
            $this->tick();
        }
    }
 
    private function addRequest(array $entry)
    {
        $easy = $entry['easy'];
        $id = (int) $easy->handle;
        $this->handles[$id] = $entry;
        if (empty($easy->options['delay'])) {
            curl_multi_add_handle($this->_mh, $easy->handle);
        } else {
            $this->delays[$id] = microtime(true) + ($easy->options['delay'] / 1000);
        }
    }
 
    /**
     * Cancels a handle from sending and removes references to it.
     *
     * @param int $id Handle ID to cancel and remove.
     *
     * @return bool True on success, false on failure.
     */
    private function cancel($id)
    {
        // Cannot cancel if it has been processed.
        if (!isset($this->handles[$id])) {
            return false;
        }
 
        $handle = $this->handles[$id]['easy']->handle;
        unset($this->delays[$id], $this->handles[$id]);
        curl_multi_remove_handle($this->_mh, $handle);
        curl_close($handle);
 
        return true;
    }
 
    private function processMessages()
    {
        while ($done = curl_multi_info_read($this->_mh)) {
            $id = (int) $done['handle'];
            curl_multi_remove_handle($this->_mh, $done['handle']);
 
            if (!isset($this->handles[$id])) {
                // Probably was cancelled.
                continue;
            }
 
            $entry = $this->handles[$id];
            unset($this->handles[$id], $this->delays[$id]);
            $entry['easy']->errno = $done['result'];
            $entry['deferred']->resolve(
                CurlFactory::finish(
                    $this,
                    $entry['easy'],
                    $this->factory
                )
            );
        }
    }
 
    private function timeToNext()
    {
        $currentTime = microtime(true);
        $nextTime = PHP_INT_MAX;
        foreach ($this->delays as $time) {
            if ($time < $nextTime) {
                $nextTime = $time;
            }
        }
 
        return max(0, $currentTime - $nextTime);
    }
}
#7GuzzleHttp\Handler\CurlMultiHandler->execute(true)
/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/Promise.php (240)
<?php
namespace GuzzleHttp\Promise;
 
/**
 * Promises/A+ implementation that avoids recursion when possible.
 *
 * @link https://promisesaplus.com/
 */
class Promise implements PromiseInterface
{
    private $state = self::PENDING;
    private $result;
    private $cancelFn;
    private $waitFn;
    private $waitList;
    private $handlers = [];
 
    /**
     * @param callable $waitFn   Fn that when invoked resolves the promise.
     * @param callable $cancelFn Fn that when invoked cancels the promise.
     */
    public function __construct(
        callable $waitFn = null,
        callable $cancelFn = null
    ) {
        $this->waitFn = $waitFn;
        $this->cancelFn = $cancelFn;
    }
 
    public function then(
        callable $onFulfilled = null,
        callable $onRejected = null
    ) {
        if ($this->state === self::PENDING) {
            $p = new Promise(null, [$this, 'cancel']);
            $this->handlers[] = [$p, $onFulfilled, $onRejected];
            $p->waitList = $this->waitList;
            $p->waitList[] = $this;
            return $p;
        }
 
        // Return a fulfilled promise and immediately invoke any callbacks.
        if ($this->state === self::FULFILLED) {
            return $onFulfilled
                ? promise_for($this->result)->then($onFulfilled)
                : promise_for($this->result);
        }
 
        // It's either cancelled or rejected, so return a rejected promise
        // and immediately invoke any callbacks.
        $rejection = rejection_for($this->result);
        return $onRejected ? $rejection->then(null, $onRejected) : $rejection;
    }
 
    public function otherwise(callable $onRejected)
    {
        return $this->then(null, $onRejected);
    }
 
    public function wait($unwrap = true)
    {
        $this->waitIfPending();
 
        if (!$unwrap) {
            return null;
        }
 
        if ($this->result instanceof PromiseInterface) {
            return $this->result->wait($unwrap);
        } elseif ($this->state === self::FULFILLED) {
            return $this->result;
        } else {
            // It's rejected so "unwrap" and throw an exception.
            throw exception_for($this->result);
        }
    }
 
    public function getState()
    {
        return $this->state;
    }
 
    public function cancel()
    {
        if ($this->state !== self::PENDING) {
            return;
        }
 
        $this->waitFn = $this->waitList = null;
 
        if ($this->cancelFn) {
            $fn = $this->cancelFn;
            $this->cancelFn = null;
            try {
                $fn();
            } catch (\Exception $e) {
                $this->reject($e);
            }
        }
 
        // Reject the promise only if it wasn't rejected in a then callback.
        if ($this->state === self::PENDING) {
            $this->reject(new CancellationException('Promise has been cancelled'));
        }
    }
 
    public function resolve($value)
    {
        $this->settle(self::FULFILLED, $value);
    }
 
    public function reject($reason)
    {
        $this->settle(self::REJECTED, $reason);
    }
 
    private function settle($state, $value)
    {
        if ($this->state !== self::PENDING) {
            // Ignore calls with the same resolution.
            if ($state === $this->state && $value === $this->result) {
                return;
            }
            throw $this->state === $state
                ? new \LogicException("The promise is already {$state}.")
                : new \LogicException("Cannot change a {$this->state} promise to {$state}");
        }
 
        if ($value === $this) {
            throw new \LogicException('Cannot fulfill or reject a promise with itself');
        }
 
        // Clear out the state of the promise but stash the handlers.
        $this->state = $state;
        $this->result = $value;
        $handlers = $this->handlers;
        $this->handlers = null;
        $this->waitList = $this->waitFn = null;
        $this->cancelFn = null;
 
        if (!$handlers) {
            return;
        }
 
        // If the value was not a settled promise or a thenable, then resolve
        // it in the task queue using the correct ID.
        if (!method_exists($value, 'then')) {
            $id = $state === self::FULFILLED ? 1 : 2;
            // It's a success, so resolve the handlers in the queue.
            queue()->add(static function () use ($id, $value, $handlers) {
                foreach ($handlers as $handler) {
                    self::callHandler($id, $value, $handler);
                }
            });
        } elseif ($value instanceof Promise
            && $value->getState() === self::PENDING
        ) {
            // We can just merge our handlers onto the next promise.
            $value->handlers = array_merge($value->handlers, $handlers);
        } else {
            // Resolve the handlers when the forwarded promise is resolved.
            $value->then(
                static function ($value) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(1, $value, $handler);
                    }
                },
                static function ($reason) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(2, $reason, $handler);
                    }
                }
            );
        }
    }
 
    /**
     * Call a stack of handlers using a specific callback index and value.
     *
     * @param int   $index   1 (resolve) or 2 (reject).
     * @param mixed $value   Value to pass to the callback.
     * @param array $handler Array of handler data (promise and callbacks).
     *
     * @return array Returns the next group to resolve.
     */
    private static function callHandler($index, $value, array $handler)
    {
        /** @var PromiseInterface $promise */
        $promise = $handler[0];
 
        // The promise may have been cancelled or resolved before placing
        // this thunk in the queue.
        if ($promise->getState() !== self::PENDING) {
            return;
        }
 
        try {
            if (isset($handler[$index])) {
                $promise->resolve($handler[$index]($value));
            } elseif ($index === 1) {
                // Forward resolution values as-is.
                $promise->resolve($value);
            } else {
                // Forward rejections down the chain.
                $promise->reject($value);
            }
        } catch (\Exception $reason) {
            $promise->reject($reason);
        }
    }
 
    private function waitIfPending()
    {
        if ($this->state !== self::PENDING) {
            return;
        } elseif ($this->waitFn) {
            $this->invokeWaitFn();
        } elseif ($this->waitList) {
            $this->invokeWaitList();
        } else {
            // If there's not wait function, then reject the promise.
            $this->reject('Cannot wait on a promise that has '
                . 'no internal wait function. You must provide a wait '
                . 'function when constructing the promise to be able to '
                . 'wait on a promise.');
        }
 
        queue()->run();
 
        if ($this->state === self::PENDING) {
            $this->reject('Invoking the wait callback did not resolve the promise');
        }
    }
 
    private function invokeWaitFn()
    {
        try {
            $wfn = $this->waitFn;
            $this->waitFn = null;
            $wfn(true);
        } catch (\Exception $reason) {
            if ($this->state === self::PENDING) {
                // The promise has not been resolved yet, so reject the promise
                // with the exception.
                $this->reject($reason);
            } else {
                // The promise was already resolved, so there's a problem in
                // the application.
                throw $reason;
            }
        }
    }
 
    private function invokeWaitList()
    {
        $waitList = $this->waitList;
        $this->waitList = null;
 
        foreach ($waitList as $result) {
            descend:
            $result->waitIfPending();
            if ($result->result instanceof Promise) {
                $result = $result->result;
                goto descend;
            }
        }
    }
}
#8GuzzleHttp\Promise\Promise->invokeWaitFn()
/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/Promise.php (217)
<?php
namespace GuzzleHttp\Promise;
 
/**
 * Promises/A+ implementation that avoids recursion when possible.
 *
 * @link https://promisesaplus.com/
 */
class Promise implements PromiseInterface
{
    private $state = self::PENDING;
    private $result;
    private $cancelFn;
    private $waitFn;
    private $waitList;
    private $handlers = [];
 
    /**
     * @param callable $waitFn   Fn that when invoked resolves the promise.
     * @param callable $cancelFn Fn that when invoked cancels the promise.
     */
    public function __construct(
        callable $waitFn = null,
        callable $cancelFn = null
    ) {
        $this->waitFn = $waitFn;
        $this->cancelFn = $cancelFn;
    }
 
    public function then(
        callable $onFulfilled = null,
        callable $onRejected = null
    ) {
        if ($this->state === self::PENDING) {
            $p = new Promise(null, [$this, 'cancel']);
            $this->handlers[] = [$p, $onFulfilled, $onRejected];
            $p->waitList = $this->waitList;
            $p->waitList[] = $this;
            return $p;
        }
 
        // Return a fulfilled promise and immediately invoke any callbacks.
        if ($this->state === self::FULFILLED) {
            return $onFulfilled
                ? promise_for($this->result)->then($onFulfilled)
                : promise_for($this->result);
        }
 
        // It's either cancelled or rejected, so return a rejected promise
        // and immediately invoke any callbacks.
        $rejection = rejection_for($this->result);
        return $onRejected ? $rejection->then(null, $onRejected) : $rejection;
    }
 
    public function otherwise(callable $onRejected)
    {
        return $this->then(null, $onRejected);
    }
 
    public function wait($unwrap = true)
    {
        $this->waitIfPending();
 
        if (!$unwrap) {
            return null;
        }
 
        if ($this->result instanceof PromiseInterface) {
            return $this->result->wait($unwrap);
        } elseif ($this->state === self::FULFILLED) {
            return $this->result;
        } else {
            // It's rejected so "unwrap" and throw an exception.
            throw exception_for($this->result);
        }
    }
 
    public function getState()
    {
        return $this->state;
    }
 
    public function cancel()
    {
        if ($this->state !== self::PENDING) {
            return;
        }
 
        $this->waitFn = $this->waitList = null;
 
        if ($this->cancelFn) {
            $fn = $this->cancelFn;
            $this->cancelFn = null;
            try {
                $fn();
            } catch (\Exception $e) {
                $this->reject($e);
            }
        }
 
        // Reject the promise only if it wasn't rejected in a then callback.
        if ($this->state === self::PENDING) {
            $this->reject(new CancellationException('Promise has been cancelled'));
        }
    }
 
    public function resolve($value)
    {
        $this->settle(self::FULFILLED, $value);
    }
 
    public function reject($reason)
    {
        $this->settle(self::REJECTED, $reason);
    }
 
    private function settle($state, $value)
    {
        if ($this->state !== self::PENDING) {
            // Ignore calls with the same resolution.
            if ($state === $this->state && $value === $this->result) {
                return;
            }
            throw $this->state === $state
                ? new \LogicException("The promise is already {$state}.")
                : new \LogicException("Cannot change a {$this->state} promise to {$state}");
        }
 
        if ($value === $this) {
            throw new \LogicException('Cannot fulfill or reject a promise with itself');
        }
 
        // Clear out the state of the promise but stash the handlers.
        $this->state = $state;
        $this->result = $value;
        $handlers = $this->handlers;
        $this->handlers = null;
        $this->waitList = $this->waitFn = null;
        $this->cancelFn = null;
 
        if (!$handlers) {
            return;
        }
 
        // If the value was not a settled promise or a thenable, then resolve
        // it in the task queue using the correct ID.
        if (!method_exists($value, 'then')) {
            $id = $state === self::FULFILLED ? 1 : 2;
            // It's a success, so resolve the handlers in the queue.
            queue()->add(static function () use ($id, $value, $handlers) {
                foreach ($handlers as $handler) {
                    self::callHandler($id, $value, $handler);
                }
            });
        } elseif ($value instanceof Promise
            && $value->getState() === self::PENDING
        ) {
            // We can just merge our handlers onto the next promise.
            $value->handlers = array_merge($value->handlers, $handlers);
        } else {
            // Resolve the handlers when the forwarded promise is resolved.
            $value->then(
                static function ($value) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(1, $value, $handler);
                    }
                },
                static function ($reason) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(2, $reason, $handler);
                    }
                }
            );
        }
    }
 
    /**
     * Call a stack of handlers using a specific callback index and value.
     *
     * @param int   $index   1 (resolve) or 2 (reject).
     * @param mixed $value   Value to pass to the callback.
     * @param array $handler Array of handler data (promise and callbacks).
     *
     * @return array Returns the next group to resolve.
     */
    private static function callHandler($index, $value, array $handler)
    {
        /** @var PromiseInterface $promise */
        $promise = $handler[0];
 
        // The promise may have been cancelled or resolved before placing
        // this thunk in the queue.
        if ($promise->getState() !== self::PENDING) {
            return;
        }
 
        try {
            if (isset($handler[$index])) {
                $promise->resolve($handler[$index]($value));
            } elseif ($index === 1) {
                // Forward resolution values as-is.
                $promise->resolve($value);
            } else {
                // Forward rejections down the chain.
                $promise->reject($value);
            }
        } catch (\Exception $reason) {
            $promise->reject($reason);
        }
    }
 
    private function waitIfPending()
    {
        if ($this->state !== self::PENDING) {
            return;
        } elseif ($this->waitFn) {
            $this->invokeWaitFn();
        } elseif ($this->waitList) {
            $this->invokeWaitList();
        } else {
            // If there's not wait function, then reject the promise.
            $this->reject('Cannot wait on a promise that has '
                . 'no internal wait function. You must provide a wait '
                . 'function when constructing the promise to be able to '
                . 'wait on a promise.');
        }
 
        queue()->run();
 
        if ($this->state === self::PENDING) {
            $this->reject('Invoking the wait callback did not resolve the promise');
        }
    }
 
    private function invokeWaitFn()
    {
        try {
            $wfn = $this->waitFn;
            $this->waitFn = null;
            $wfn(true);
        } catch (\Exception $reason) {
            if ($this->state === self::PENDING) {
                // The promise has not been resolved yet, so reject the promise
                // with the exception.
                $this->reject($reason);
            } else {
                // The promise was already resolved, so there's a problem in
                // the application.
                throw $reason;
            }
        }
    }
 
    private function invokeWaitList()
    {
        $waitList = $this->waitList;
        $this->waitList = null;
 
        foreach ($waitList as $result) {
            descend:
            $result->waitIfPending();
            if ($result->result instanceof Promise) {
                $result = $result->result;
                goto descend;
            }
        }
    }
}
#9GuzzleHttp\Promise\Promise->waitIfPending()
/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/Promise.php (261)
<?php
namespace GuzzleHttp\Promise;
 
/**
 * Promises/A+ implementation that avoids recursion when possible.
 *
 * @link https://promisesaplus.com/
 */
class Promise implements PromiseInterface
{
    private $state = self::PENDING;
    private $result;
    private $cancelFn;
    private $waitFn;
    private $waitList;
    private $handlers = [];
 
    /**
     * @param callable $waitFn   Fn that when invoked resolves the promise.
     * @param callable $cancelFn Fn that when invoked cancels the promise.
     */
    public function __construct(
        callable $waitFn = null,
        callable $cancelFn = null
    ) {
        $this->waitFn = $waitFn;
        $this->cancelFn = $cancelFn;
    }
 
    public function then(
        callable $onFulfilled = null,
        callable $onRejected = null
    ) {
        if ($this->state === self::PENDING) {
            $p = new Promise(null, [$this, 'cancel']);
            $this->handlers[] = [$p, $onFulfilled, $onRejected];
            $p->waitList = $this->waitList;
            $p->waitList[] = $this;
            return $p;
        }
 
        // Return a fulfilled promise and immediately invoke any callbacks.
        if ($this->state === self::FULFILLED) {
            return $onFulfilled
                ? promise_for($this->result)->then($onFulfilled)
                : promise_for($this->result);
        }
 
        // It's either cancelled or rejected, so return a rejected promise
        // and immediately invoke any callbacks.
        $rejection = rejection_for($this->result);
        return $onRejected ? $rejection->then(null, $onRejected) : $rejection;
    }
 
    public function otherwise(callable $onRejected)
    {
        return $this->then(null, $onRejected);
    }
 
    public function wait($unwrap = true)
    {
        $this->waitIfPending();
 
        if (!$unwrap) {
            return null;
        }
 
        if ($this->result instanceof PromiseInterface) {
            return $this->result->wait($unwrap);
        } elseif ($this->state === self::FULFILLED) {
            return $this->result;
        } else {
            // It's rejected so "unwrap" and throw an exception.
            throw exception_for($this->result);
        }
    }
 
    public function getState()
    {
        return $this->state;
    }
 
    public function cancel()
    {
        if ($this->state !== self::PENDING) {
            return;
        }
 
        $this->waitFn = $this->waitList = null;
 
        if ($this->cancelFn) {
            $fn = $this->cancelFn;
            $this->cancelFn = null;
            try {
                $fn();
            } catch (\Exception $e) {
                $this->reject($e);
            }
        }
 
        // Reject the promise only if it wasn't rejected in a then callback.
        if ($this->state === self::PENDING) {
            $this->reject(new CancellationException('Promise has been cancelled'));
        }
    }
 
    public function resolve($value)
    {
        $this->settle(self::FULFILLED, $value);
    }
 
    public function reject($reason)
    {
        $this->settle(self::REJECTED, $reason);
    }
 
    private function settle($state, $value)
    {
        if ($this->state !== self::PENDING) {
            // Ignore calls with the same resolution.
            if ($state === $this->state && $value === $this->result) {
                return;
            }
            throw $this->state === $state
                ? new \LogicException("The promise is already {$state}.")
                : new \LogicException("Cannot change a {$this->state} promise to {$state}");
        }
 
        if ($value === $this) {
            throw new \LogicException('Cannot fulfill or reject a promise with itself');
        }
 
        // Clear out the state of the promise but stash the handlers.
        $this->state = $state;
        $this->result = $value;
        $handlers = $this->handlers;
        $this->handlers = null;
        $this->waitList = $this->waitFn = null;
        $this->cancelFn = null;
 
        if (!$handlers) {
            return;
        }
 
        // If the value was not a settled promise or a thenable, then resolve
        // it in the task queue using the correct ID.
        if (!method_exists($value, 'then')) {
            $id = $state === self::FULFILLED ? 1 : 2;
            // It's a success, so resolve the handlers in the queue.
            queue()->add(static function () use ($id, $value, $handlers) {
                foreach ($handlers as $handler) {
                    self::callHandler($id, $value, $handler);
                }
            });
        } elseif ($value instanceof Promise
            && $value->getState() === self::PENDING
        ) {
            // We can just merge our handlers onto the next promise.
            $value->handlers = array_merge($value->handlers, $handlers);
        } else {
            // Resolve the handlers when the forwarded promise is resolved.
            $value->then(
                static function ($value) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(1, $value, $handler);
                    }
                },
                static function ($reason) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(2, $reason, $handler);
                    }
                }
            );
        }
    }
 
    /**
     * Call a stack of handlers using a specific callback index and value.
     *
     * @param int   $index   1 (resolve) or 2 (reject).
     * @param mixed $value   Value to pass to the callback.
     * @param array $handler Array of handler data (promise and callbacks).
     *
     * @return array Returns the next group to resolve.
     */
    private static function callHandler($index, $value, array $handler)
    {
        /** @var PromiseInterface $promise */
        $promise = $handler[0];
 
        // The promise may have been cancelled or resolved before placing
        // this thunk in the queue.
        if ($promise->getState() !== self::PENDING) {
            return;
        }
 
        try {
            if (isset($handler[$index])) {
                $promise->resolve($handler[$index]($value));
            } elseif ($index === 1) {
                // Forward resolution values as-is.
                $promise->resolve($value);
            } else {
                // Forward rejections down the chain.
                $promise->reject($value);
            }
        } catch (\Exception $reason) {
            $promise->reject($reason);
        }
    }
 
    private function waitIfPending()
    {
        if ($this->state !== self::PENDING) {
            return;
        } elseif ($this->waitFn) {
            $this->invokeWaitFn();
        } elseif ($this->waitList) {
            $this->invokeWaitList();
        } else {
            // If there's not wait function, then reject the promise.
            $this->reject('Cannot wait on a promise that has '
                . 'no internal wait function. You must provide a wait '
                . 'function when constructing the promise to be able to '
                . 'wait on a promise.');
        }
 
        queue()->run();
 
        if ($this->state === self::PENDING) {
            $this->reject('Invoking the wait callback did not resolve the promise');
        }
    }
 
    private function invokeWaitFn()
    {
        try {
            $wfn = $this->waitFn;
            $this->waitFn = null;
            $wfn(true);
        } catch (\Exception $reason) {
            if ($this->state === self::PENDING) {
                // The promise has not been resolved yet, so reject the promise
                // with the exception.
                $this->reject($reason);
            } else {
                // The promise was already resolved, so there's a problem in
                // the application.
                throw $reason;
            }
        }
    }
 
    private function invokeWaitList()
    {
        $waitList = $this->waitList;
        $this->waitList = null;
 
        foreach ($waitList as $result) {
            descend:
            $result->waitIfPending();
            if ($result->result instanceof Promise) {
                $result = $result->result;
                goto descend;
            }
        }
    }
}
#10GuzzleHttp\Promise\Promise->invokeWaitList()
/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/Promise.php (219)
<?php
namespace GuzzleHttp\Promise;
 
/**
 * Promises/A+ implementation that avoids recursion when possible.
 *
 * @link https://promisesaplus.com/
 */
class Promise implements PromiseInterface
{
    private $state = self::PENDING;
    private $result;
    private $cancelFn;
    private $waitFn;
    private $waitList;
    private $handlers = [];
 
    /**
     * @param callable $waitFn   Fn that when invoked resolves the promise.
     * @param callable $cancelFn Fn that when invoked cancels the promise.
     */
    public function __construct(
        callable $waitFn = null,
        callable $cancelFn = null
    ) {
        $this->waitFn = $waitFn;
        $this->cancelFn = $cancelFn;
    }
 
    public function then(
        callable $onFulfilled = null,
        callable $onRejected = null
    ) {
        if ($this->state === self::PENDING) {
            $p = new Promise(null, [$this, 'cancel']);
            $this->handlers[] = [$p, $onFulfilled, $onRejected];
            $p->waitList = $this->waitList;
            $p->waitList[] = $this;
            return $p;
        }
 
        // Return a fulfilled promise and immediately invoke any callbacks.
        if ($this->state === self::FULFILLED) {
            return $onFulfilled
                ? promise_for($this->result)->then($onFulfilled)
                : promise_for($this->result);
        }
 
        // It's either cancelled or rejected, so return a rejected promise
        // and immediately invoke any callbacks.
        $rejection = rejection_for($this->result);
        return $onRejected ? $rejection->then(null, $onRejected) : $rejection;
    }
 
    public function otherwise(callable $onRejected)
    {
        return $this->then(null, $onRejected);
    }
 
    public function wait($unwrap = true)
    {
        $this->waitIfPending();
 
        if (!$unwrap) {
            return null;
        }
 
        if ($this->result instanceof PromiseInterface) {
            return $this->result->wait($unwrap);
        } elseif ($this->state === self::FULFILLED) {
            return $this->result;
        } else {
            // It's rejected so "unwrap" and throw an exception.
            throw exception_for($this->result);
        }
    }
 
    public function getState()
    {
        return $this->state;
    }
 
    public function cancel()
    {
        if ($this->state !== self::PENDING) {
            return;
        }
 
        $this->waitFn = $this->waitList = null;
 
        if ($this->cancelFn) {
            $fn = $this->cancelFn;
            $this->cancelFn = null;
            try {
                $fn();
            } catch (\Exception $e) {
                $this->reject($e);
            }
        }
 
        // Reject the promise only if it wasn't rejected in a then callback.
        if ($this->state === self::PENDING) {
            $this->reject(new CancellationException('Promise has been cancelled'));
        }
    }
 
    public function resolve($value)
    {
        $this->settle(self::FULFILLED, $value);
    }
 
    public function reject($reason)
    {
        $this->settle(self::REJECTED, $reason);
    }
 
    private function settle($state, $value)
    {
        if ($this->state !== self::PENDING) {
            // Ignore calls with the same resolution.
            if ($state === $this->state && $value === $this->result) {
                return;
            }
            throw $this->state === $state
                ? new \LogicException("The promise is already {$state}.")
                : new \LogicException("Cannot change a {$this->state} promise to {$state}");
        }
 
        if ($value === $this) {
            throw new \LogicException('Cannot fulfill or reject a promise with itself');
        }
 
        // Clear out the state of the promise but stash the handlers.
        $this->state = $state;
        $this->result = $value;
        $handlers = $this->handlers;
        $this->handlers = null;
        $this->waitList = $this->waitFn = null;
        $this->cancelFn = null;
 
        if (!$handlers) {
            return;
        }
 
        // If the value was not a settled promise or a thenable, then resolve
        // it in the task queue using the correct ID.
        if (!method_exists($value, 'then')) {
            $id = $state === self::FULFILLED ? 1 : 2;
            // It's a success, so resolve the handlers in the queue.
            queue()->add(static function () use ($id, $value, $handlers) {
                foreach ($handlers as $handler) {
                    self::callHandler($id, $value, $handler);
                }
            });
        } elseif ($value instanceof Promise
            && $value->getState() === self::PENDING
        ) {
            // We can just merge our handlers onto the next promise.
            $value->handlers = array_merge($value->handlers, $handlers);
        } else {
            // Resolve the handlers when the forwarded promise is resolved.
            $value->then(
                static function ($value) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(1, $value, $handler);
                    }
                },
                static function ($reason) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(2, $reason, $handler);
                    }
                }
            );
        }
    }
 
    /**
     * Call a stack of handlers using a specific callback index and value.
     *
     * @param int   $index   1 (resolve) or 2 (reject).
     * @param mixed $value   Value to pass to the callback.
     * @param array $handler Array of handler data (promise and callbacks).
     *
     * @return array Returns the next group to resolve.
     */
    private static function callHandler($index, $value, array $handler)
    {
        /** @var PromiseInterface $promise */
        $promise = $handler[0];
 
        // The promise may have been cancelled or resolved before placing
        // this thunk in the queue.
        if ($promise->getState() !== self::PENDING) {
            return;
        }
 
        try {
            if (isset($handler[$index])) {
                $promise->resolve($handler[$index]($value));
            } elseif ($index === 1) {
                // Forward resolution values as-is.
                $promise->resolve($value);
            } else {
                // Forward rejections down the chain.
                $promise->reject($value);
            }
        } catch (\Exception $reason) {
            $promise->reject($reason);
        }
    }
 
    private function waitIfPending()
    {
        if ($this->state !== self::PENDING) {
            return;
        } elseif ($this->waitFn) {
            $this->invokeWaitFn();
        } elseif ($this->waitList) {
            $this->invokeWaitList();
        } else {
            // If there's not wait function, then reject the promise.
            $this->reject('Cannot wait on a promise that has '
                . 'no internal wait function. You must provide a wait '
                . 'function when constructing the promise to be able to '
                . 'wait on a promise.');
        }
 
        queue()->run();
 
        if ($this->state === self::PENDING) {
            $this->reject('Invoking the wait callback did not resolve the promise');
        }
    }
 
    private function invokeWaitFn()
    {
        try {
            $wfn = $this->waitFn;
            $this->waitFn = null;
            $wfn(true);
        } catch (\Exception $reason) {
            if ($this->state === self::PENDING) {
                // The promise has not been resolved yet, so reject the promise
                // with the exception.
                $this->reject($reason);
            } else {
                // The promise was already resolved, so there's a problem in
                // the application.
                throw $reason;
            }
        }
    }
 
    private function invokeWaitList()
    {
        $waitList = $this->waitList;
        $this->waitList = null;
 
        foreach ($waitList as $result) {
            descend:
            $result->waitIfPending();
            if ($result->result instanceof Promise) {
                $result = $result->result;
                goto descend;
            }
        }
    }
}
#11GuzzleHttp\Promise\Promise->waitIfPending()
/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/Promise.php (261)
<?php
namespace GuzzleHttp\Promise;
 
/**
 * Promises/A+ implementation that avoids recursion when possible.
 *
 * @link https://promisesaplus.com/
 */
class Promise implements PromiseInterface
{
    private $state = self::PENDING;
    private $result;
    private $cancelFn;
    private $waitFn;
    private $waitList;
    private $handlers = [];
 
    /**
     * @param callable $waitFn   Fn that when invoked resolves the promise.
     * @param callable $cancelFn Fn that when invoked cancels the promise.
     */
    public function __construct(
        callable $waitFn = null,
        callable $cancelFn = null
    ) {
        $this->waitFn = $waitFn;
        $this->cancelFn = $cancelFn;
    }
 
    public function then(
        callable $onFulfilled = null,
        callable $onRejected = null
    ) {
        if ($this->state === self::PENDING) {
            $p = new Promise(null, [$this, 'cancel']);
            $this->handlers[] = [$p, $onFulfilled, $onRejected];
            $p->waitList = $this->waitList;
            $p->waitList[] = $this;
            return $p;
        }
 
        // Return a fulfilled promise and immediately invoke any callbacks.
        if ($this->state === self::FULFILLED) {
            return $onFulfilled
                ? promise_for($this->result)->then($onFulfilled)
                : promise_for($this->result);
        }
 
        // It's either cancelled or rejected, so return a rejected promise
        // and immediately invoke any callbacks.
        $rejection = rejection_for($this->result);
        return $onRejected ? $rejection->then(null, $onRejected) : $rejection;
    }
 
    public function otherwise(callable $onRejected)
    {
        return $this->then(null, $onRejected);
    }
 
    public function wait($unwrap = true)
    {
        $this->waitIfPending();
 
        if (!$unwrap) {
            return null;
        }
 
        if ($this->result instanceof PromiseInterface) {
            return $this->result->wait($unwrap);
        } elseif ($this->state === self::FULFILLED) {
            return $this->result;
        } else {
            // It's rejected so "unwrap" and throw an exception.
            throw exception_for($this->result);
        }
    }
 
    public function getState()
    {
        return $this->state;
    }
 
    public function cancel()
    {
        if ($this->state !== self::PENDING) {
            return;
        }
 
        $this->waitFn = $this->waitList = null;
 
        if ($this->cancelFn) {
            $fn = $this->cancelFn;
            $this->cancelFn = null;
            try {
                $fn();
            } catch (\Exception $e) {
                $this->reject($e);
            }
        }
 
        // Reject the promise only if it wasn't rejected in a then callback.
        if ($this->state === self::PENDING) {
            $this->reject(new CancellationException('Promise has been cancelled'));
        }
    }
 
    public function resolve($value)
    {
        $this->settle(self::FULFILLED, $value);
    }
 
    public function reject($reason)
    {
        $this->settle(self::REJECTED, $reason);
    }
 
    private function settle($state, $value)
    {
        if ($this->state !== self::PENDING) {
            // Ignore calls with the same resolution.
            if ($state === $this->state && $value === $this->result) {
                return;
            }
            throw $this->state === $state
                ? new \LogicException("The promise is already {$state}.")
                : new \LogicException("Cannot change a {$this->state} promise to {$state}");
        }
 
        if ($value === $this) {
            throw new \LogicException('Cannot fulfill or reject a promise with itself');
        }
 
        // Clear out the state of the promise but stash the handlers.
        $this->state = $state;
        $this->result = $value;
        $handlers = $this->handlers;
        $this->handlers = null;
        $this->waitList = $this->waitFn = null;
        $this->cancelFn = null;
 
        if (!$handlers) {
            return;
        }
 
        // If the value was not a settled promise or a thenable, then resolve
        // it in the task queue using the correct ID.
        if (!method_exists($value, 'then')) {
            $id = $state === self::FULFILLED ? 1 : 2;
            // It's a success, so resolve the handlers in the queue.
            queue()->add(static function () use ($id, $value, $handlers) {
                foreach ($handlers as $handler) {
                    self::callHandler($id, $value, $handler);
                }
            });
        } elseif ($value instanceof Promise
            && $value->getState() === self::PENDING
        ) {
            // We can just merge our handlers onto the next promise.
            $value->handlers = array_merge($value->handlers, $handlers);
        } else {
            // Resolve the handlers when the forwarded promise is resolved.
            $value->then(
                static function ($value) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(1, $value, $handler);
                    }
                },
                static function ($reason) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(2, $reason, $handler);
                    }
                }
            );
        }
    }
 
    /**
     * Call a stack of handlers using a specific callback index and value.
     *
     * @param int   $index   1 (resolve) or 2 (reject).
     * @param mixed $value   Value to pass to the callback.
     * @param array $handler Array of handler data (promise and callbacks).
     *
     * @return array Returns the next group to resolve.
     */
    private static function callHandler($index, $value, array $handler)
    {
        /** @var PromiseInterface $promise */
        $promise = $handler[0];
 
        // The promise may have been cancelled or resolved before placing
        // this thunk in the queue.
        if ($promise->getState() !== self::PENDING) {
            return;
        }
 
        try {
            if (isset($handler[$index])) {
                $promise->resolve($handler[$index]($value));
            } elseif ($index === 1) {
                // Forward resolution values as-is.
                $promise->resolve($value);
            } else {
                // Forward rejections down the chain.
                $promise->reject($value);
            }
        } catch (\Exception $reason) {
            $promise->reject($reason);
        }
    }
 
    private function waitIfPending()
    {
        if ($this->state !== self::PENDING) {
            return;
        } elseif ($this->waitFn) {
            $this->invokeWaitFn();
        } elseif ($this->waitList) {
            $this->invokeWaitList();
        } else {
            // If there's not wait function, then reject the promise.
            $this->reject('Cannot wait on a promise that has '
                . 'no internal wait function. You must provide a wait '
                . 'function when constructing the promise to be able to '
                . 'wait on a promise.');
        }
 
        queue()->run();
 
        if ($this->state === self::PENDING) {
            $this->reject('Invoking the wait callback did not resolve the promise');
        }
    }
 
    private function invokeWaitFn()
    {
        try {
            $wfn = $this->waitFn;
            $this->waitFn = null;
            $wfn(true);
        } catch (\Exception $reason) {
            if ($this->state === self::PENDING) {
                // The promise has not been resolved yet, so reject the promise
                // with the exception.
                $this->reject($reason);
            } else {
                // The promise was already resolved, so there's a problem in
                // the application.
                throw $reason;
            }
        }
    }
 
    private function invokeWaitList()
    {
        $waitList = $this->waitList;
        $this->waitList = null;
 
        foreach ($waitList as $result) {
            descend:
            $result->waitIfPending();
            if ($result->result instanceof Promise) {
                $result = $result->result;
                goto descend;
            }
        }
    }
}
#12GuzzleHttp\Promise\Promise->invokeWaitList()
/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/Promise.php (219)
<?php
namespace GuzzleHttp\Promise;
 
/**
 * Promises/A+ implementation that avoids recursion when possible.
 *
 * @link https://promisesaplus.com/
 */
class Promise implements PromiseInterface
{
    private $state = self::PENDING;
    private $result;
    private $cancelFn;
    private $waitFn;
    private $waitList;
    private $handlers = [];
 
    /**
     * @param callable $waitFn   Fn that when invoked resolves the promise.
     * @param callable $cancelFn Fn that when invoked cancels the promise.
     */
    public function __construct(
        callable $waitFn = null,
        callable $cancelFn = null
    ) {
        $this->waitFn = $waitFn;
        $this->cancelFn = $cancelFn;
    }
 
    public function then(
        callable $onFulfilled = null,
        callable $onRejected = null
    ) {
        if ($this->state === self::PENDING) {
            $p = new Promise(null, [$this, 'cancel']);
            $this->handlers[] = [$p, $onFulfilled, $onRejected];
            $p->waitList = $this->waitList;
            $p->waitList[] = $this;
            return $p;
        }
 
        // Return a fulfilled promise and immediately invoke any callbacks.
        if ($this->state === self::FULFILLED) {
            return $onFulfilled
                ? promise_for($this->result)->then($onFulfilled)
                : promise_for($this->result);
        }
 
        // It's either cancelled or rejected, so return a rejected promise
        // and immediately invoke any callbacks.
        $rejection = rejection_for($this->result);
        return $onRejected ? $rejection->then(null, $onRejected) : $rejection;
    }
 
    public function otherwise(callable $onRejected)
    {
        return $this->then(null, $onRejected);
    }
 
    public function wait($unwrap = true)
    {
        $this->waitIfPending();
 
        if (!$unwrap) {
            return null;
        }
 
        if ($this->result instanceof PromiseInterface) {
            return $this->result->wait($unwrap);
        } elseif ($this->state === self::FULFILLED) {
            return $this->result;
        } else {
            // It's rejected so "unwrap" and throw an exception.
            throw exception_for($this->result);
        }
    }
 
    public function getState()
    {
        return $this->state;
    }
 
    public function cancel()
    {
        if ($this->state !== self::PENDING) {
            return;
        }
 
        $this->waitFn = $this->waitList = null;
 
        if ($this->cancelFn) {
            $fn = $this->cancelFn;
            $this->cancelFn = null;
            try {
                $fn();
            } catch (\Exception $e) {
                $this->reject($e);
            }
        }
 
        // Reject the promise only if it wasn't rejected in a then callback.
        if ($this->state === self::PENDING) {
            $this->reject(new CancellationException('Promise has been cancelled'));
        }
    }
 
    public function resolve($value)
    {
        $this->settle(self::FULFILLED, $value);
    }
 
    public function reject($reason)
    {
        $this->settle(self::REJECTED, $reason);
    }
 
    private function settle($state, $value)
    {
        if ($this->state !== self::PENDING) {
            // Ignore calls with the same resolution.
            if ($state === $this->state && $value === $this->result) {
                return;
            }
            throw $this->state === $state
                ? new \LogicException("The promise is already {$state}.")
                : new \LogicException("Cannot change a {$this->state} promise to {$state}");
        }
 
        if ($value === $this) {
            throw new \LogicException('Cannot fulfill or reject a promise with itself');
        }
 
        // Clear out the state of the promise but stash the handlers.
        $this->state = $state;
        $this->result = $value;
        $handlers = $this->handlers;
        $this->handlers = null;
        $this->waitList = $this->waitFn = null;
        $this->cancelFn = null;
 
        if (!$handlers) {
            return;
        }
 
        // If the value was not a settled promise or a thenable, then resolve
        // it in the task queue using the correct ID.
        if (!method_exists($value, 'then')) {
            $id = $state === self::FULFILLED ? 1 : 2;
            // It's a success, so resolve the handlers in the queue.
            queue()->add(static function () use ($id, $value, $handlers) {
                foreach ($handlers as $handler) {
                    self::callHandler($id, $value, $handler);
                }
            });
        } elseif ($value instanceof Promise
            && $value->getState() === self::PENDING
        ) {
            // We can just merge our handlers onto the next promise.
            $value->handlers = array_merge($value->handlers, $handlers);
        } else {
            // Resolve the handlers when the forwarded promise is resolved.
            $value->then(
                static function ($value) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(1, $value, $handler);
                    }
                },
                static function ($reason) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(2, $reason, $handler);
                    }
                }
            );
        }
    }
 
    /**
     * Call a stack of handlers using a specific callback index and value.
     *
     * @param int   $index   1 (resolve) or 2 (reject).
     * @param mixed $value   Value to pass to the callback.
     * @param array $handler Array of handler data (promise and callbacks).
     *
     * @return array Returns the next group to resolve.
     */
    private static function callHandler($index, $value, array $handler)
    {
        /** @var PromiseInterface $promise */
        $promise = $handler[0];
 
        // The promise may have been cancelled or resolved before placing
        // this thunk in the queue.
        if ($promise->getState() !== self::PENDING) {
            return;
        }
 
        try {
            if (isset($handler[$index])) {
                $promise->resolve($handler[$index]($value));
            } elseif ($index === 1) {
                // Forward resolution values as-is.
                $promise->resolve($value);
            } else {
                // Forward rejections down the chain.
                $promise->reject($value);
            }
        } catch (\Exception $reason) {
            $promise->reject($reason);
        }
    }
 
    private function waitIfPending()
    {
        if ($this->state !== self::PENDING) {
            return;
        } elseif ($this->waitFn) {
            $this->invokeWaitFn();
        } elseif ($this->waitList) {
            $this->invokeWaitList();
        } else {
            // If there's not wait function, then reject the promise.
            $this->reject('Cannot wait on a promise that has '
                . 'no internal wait function. You must provide a wait '
                . 'function when constructing the promise to be able to '
                . 'wait on a promise.');
        }
 
        queue()->run();
 
        if ($this->state === self::PENDING) {
            $this->reject('Invoking the wait callback did not resolve the promise');
        }
    }
 
    private function invokeWaitFn()
    {
        try {
            $wfn = $this->waitFn;
            $this->waitFn = null;
            $wfn(true);
        } catch (\Exception $reason) {
            if ($this->state === self::PENDING) {
                // The promise has not been resolved yet, so reject the promise
                // with the exception.
                $this->reject($reason);
            } else {
                // The promise was already resolved, so there's a problem in
                // the application.
                throw $reason;
            }
        }
    }
 
    private function invokeWaitList()
    {
        $waitList = $this->waitList;
        $this->waitList = null;
 
        foreach ($waitList as $result) {
            descend:
            $result->waitIfPending();
            if ($result->result instanceof Promise) {
                $result = $result->result;
                goto descend;
            }
        }
    }
}
#13GuzzleHttp\Promise\Promise->waitIfPending()
/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/Promise.php (62)
<?php
namespace GuzzleHttp\Promise;
 
/**
 * Promises/A+ implementation that avoids recursion when possible.
 *
 * @link https://promisesaplus.com/
 */
class Promise implements PromiseInterface
{
    private $state = self::PENDING;
    private $result;
    private $cancelFn;
    private $waitFn;
    private $waitList;
    private $handlers = [];
 
    /**
     * @param callable $waitFn   Fn that when invoked resolves the promise.
     * @param callable $cancelFn Fn that when invoked cancels the promise.
     */
    public function __construct(
        callable $waitFn = null,
        callable $cancelFn = null
    ) {
        $this->waitFn = $waitFn;
        $this->cancelFn = $cancelFn;
    }
 
    public function then(
        callable $onFulfilled = null,
        callable $onRejected = null
    ) {
        if ($this->state === self::PENDING) {
            $p = new Promise(null, [$this, 'cancel']);
            $this->handlers[] = [$p, $onFulfilled, $onRejected];
            $p->waitList = $this->waitList;
            $p->waitList[] = $this;
            return $p;
        }
 
        // Return a fulfilled promise and immediately invoke any callbacks.
        if ($this->state === self::FULFILLED) {
            return $onFulfilled
                ? promise_for($this->result)->then($onFulfilled)
                : promise_for($this->result);
        }
 
        // It's either cancelled or rejected, so return a rejected promise
        // and immediately invoke any callbacks.
        $rejection = rejection_for($this->result);
        return $onRejected ? $rejection->then(null, $onRejected) : $rejection;
    }
 
    public function otherwise(callable $onRejected)
    {
        return $this->then(null, $onRejected);
    }
 
    public function wait($unwrap = true)
    {
        $this->waitIfPending();
 
        if (!$unwrap) {
            return null;
        }
 
        if ($this->result instanceof PromiseInterface) {
            return $this->result->wait($unwrap);
        } elseif ($this->state === self::FULFILLED) {
            return $this->result;
        } else {
            // It's rejected so "unwrap" and throw an exception.
            throw exception_for($this->result);
        }
    }
 
    public function getState()
    {
        return $this->state;
    }
 
    public function cancel()
    {
        if ($this->state !== self::PENDING) {
            return;
        }
 
        $this->waitFn = $this->waitList = null;
 
        if ($this->cancelFn) {
            $fn = $this->cancelFn;
            $this->cancelFn = null;
            try {
                $fn();
            } catch (\Exception $e) {
                $this->reject($e);
            }
        }
 
        // Reject the promise only if it wasn't rejected in a then callback.
        if ($this->state === self::PENDING) {
            $this->reject(new CancellationException('Promise has been cancelled'));
        }
    }
 
    public function resolve($value)
    {
        $this->settle(self::FULFILLED, $value);
    }
 
    public function reject($reason)
    {
        $this->settle(self::REJECTED, $reason);
    }
 
    private function settle($state, $value)
    {
        if ($this->state !== self::PENDING) {
            // Ignore calls with the same resolution.
            if ($state === $this->state && $value === $this->result) {
                return;
            }
            throw $this->state === $state
                ? new \LogicException("The promise is already {$state}.")
                : new \LogicException("Cannot change a {$this->state} promise to {$state}");
        }
 
        if ($value === $this) {
            throw new \LogicException('Cannot fulfill or reject a promise with itself');
        }
 
        // Clear out the state of the promise but stash the handlers.
        $this->state = $state;
        $this->result = $value;
        $handlers = $this->handlers;
        $this->handlers = null;
        $this->waitList = $this->waitFn = null;
        $this->cancelFn = null;
 
        if (!$handlers) {
            return;
        }
 
        // If the value was not a settled promise or a thenable, then resolve
        // it in the task queue using the correct ID.
        if (!method_exists($value, 'then')) {
            $id = $state === self::FULFILLED ? 1 : 2;
            // It's a success, so resolve the handlers in the queue.
            queue()->add(static function () use ($id, $value, $handlers) {
                foreach ($handlers as $handler) {
                    self::callHandler($id, $value, $handler);
                }
            });
        } elseif ($value instanceof Promise
            && $value->getState() === self::PENDING
        ) {
            // We can just merge our handlers onto the next promise.
            $value->handlers = array_merge($value->handlers, $handlers);
        } else {
            // Resolve the handlers when the forwarded promise is resolved.
            $value->then(
                static function ($value) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(1, $value, $handler);
                    }
                },
                static function ($reason) use ($handlers) {
                    foreach ($handlers as $handler) {
                        self::callHandler(2, $reason, $handler);
                    }
                }
            );
        }
    }
 
    /**
     * Call a stack of handlers using a specific callback index and value.
     *
     * @param int   $index   1 (resolve) or 2 (reject).
     * @param mixed $value   Value to pass to the callback.
     * @param array $handler Array of handler data (promise and callbacks).
     *
     * @return array Returns the next group to resolve.
     */
    private static function callHandler($index, $value, array $handler)
    {
        /** @var PromiseInterface $promise */
        $promise = $handler[0];
 
        // The promise may have been cancelled or resolved before placing
        // this thunk in the queue.
        if ($promise->getState() !== self::PENDING) {
            return;
        }
 
        try {
            if (isset($handler[$index])) {
                $promise->resolve($handler[$index]($value));
            } elseif ($index === 1) {
                // Forward resolution values as-is.
                $promise->resolve($value);
            } else {
                // Forward rejections down the chain.
                $promise->reject($value);
            }
        } catch (\Exception $reason) {
            $promise->reject($reason);
        }
    }
 
    private function waitIfPending()
    {
        if ($this->state !== self::PENDING) {
            return;
        } elseif ($this->waitFn) {
            $this->invokeWaitFn();
        } elseif ($this->waitList) {
            $this->invokeWaitList();
        } else {
            // If there's not wait function, then reject the promise.
            $this->reject('Cannot wait on a promise that has '
                . 'no internal wait function. You must provide a wait '
                . 'function when constructing the promise to be able to '
                . 'wait on a promise.');
        }
 
        queue()->run();
 
        if ($this->state === self::PENDING) {
            $this->reject('Invoking the wait callback did not resolve the promise');
        }
    }
 
    private function invokeWaitFn()
    {
        try {
            $wfn = $this->waitFn;
            $this->waitFn = null;
            $wfn(true);
        } catch (\Exception $reason) {
            if ($this->state === self::PENDING) {
                // The promise has not been resolved yet, so reject the promise
                // with the exception.
                $this->reject($reason);
            } else {
                // The promise was already resolved, so there's a problem in
                // the application.
                throw $reason;
            }
        }
    }
 
    private function invokeWaitList()
    {
        $waitList = $this->waitList;
        $this->waitList = null;
 
        foreach ($waitList as $result) {
            descend:
            $result->waitIfPending();
            if ($result->result instanceof Promise) {
                $result = $result->result;
                goto descend;
            }
        }
    }
}
#14GuzzleHttp\Promise\Promise->wait()
/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/AwsClient.php (205)
<?php
namespace Aws;
 
use Aws\Api\ApiProvider;
use Aws\Api\DocModel;
use Aws\Api\Service;
use Aws\Signature\SignatureProvider;
use GuzzleHttp\Psr7\Uri;
 
/**
 * Default AWS client implementation
 */
class AwsClient implements AwsClientInterface
{
    /** @var array */
    private $config;
 
    /** @var string */
    private $region;
 
    /** @var string */
    private $endpoint;
 
    /** @var Service */
    private $api;
 
    /** @var callable */
    private $signatureProvider;
 
    /** @var callable */
    private $credentialProvider;
 
    /** @var HandlerList */
    private $handlerList;
 
    /** @var array*/
    private $defaultRequestOptions;
 
    /**
     * Get an array of client constructor arguments used by the client.
     *
     * @return array
     */
    public static function getArguments()
    {
        return ClientResolver::getDefaultArguments();
    }
 
    /**
     * The client constructor accepts the following options:
     *
     * - api_provider: (callable) An optional PHP callable that accepts a
     *   type, service, and version argument, and returns an array of
     *   corresponding configuration data. The type value can be one of api,
     *   waiter, or paginator.
     * - credentials:
     *   (Aws\Credentials\CredentialsInterface|array|bool|callable) Specifies
     *   the credentials used to sign requests. Provide an
     *   Aws\Credentials\CredentialsInterface object, an associative array of
     *   "key", "secret", and an optional "token" key, `false` to use null
     *   credentials, or a callable credentials provider used to create
     *   credentials or return null. See Aws\Credentials\CredentialProvider for
     *   a list of built-in credentials providers. If no credentials are
     *   provided, the SDK will attempt to load them from the environment.
     * - debug: (bool|array) Set to true to display debug information when
     *   sending requests. Alternatively, you can provide an associative array
     *   with the following keys: logfn: (callable) Function that is invoked
     *   with log messages; stream_size: (int) When the size of a stream is
     *   greater than this number, the stream data will not be logged (set to
     *   "0" to not log any stream data); scrub_auth: (bool) Set to false to
     *   disable the scrubbing of auth data from the logged messages; http:
     *   (bool) Set to false to disable the "debug" feature of lower level HTTP
     *   adapters (e.g., verbose curl output).
     * - endpoint: (string) The full URI of the webservice. This is only
     *   required when connecting to a custom endpoint (e.g., a local version
     *   of S3).
     * - endpoint_provider: (callable) An optional PHP callable that
     *   accepts a hash of options including a "service" and "region" key and
     *   returns NULL or a hash of endpoint data, of which the "endpoint" key
     *   is required. See Aws\Endpoint\EndpointProvider for a list of built-in
     *   providers.
     * - handler: (callable) A handler that accepts a command object,
     *   request object and returns a promise that is fulfilled with an
     *   Aws\ResultInterface object or rejected with an
     *   Aws\Exception\AwsException. A handler does not accept a next handler
     *   as it is terminal and expected to fulfill a command. If no handler is
     *   provided, a default Guzzle handler will be utilized.
     * - http: (array, default=array(0)) Set to an array of SDK request
     *   options to apply to each request (e.g., proxy, verify, etc.).
     * - http_handler: (callable) An HTTP handler is a function that
     *   accepts a PSR-7 request object and returns a promise that is fulfilled
     *   with a PSR-7 response object or rejected with an array of exception
     *   data. NOTE: This option supersedes any provided "handler" option.
     * - profile: (string) Allows you to specify which profile to use when
     *   credentials are created from the AWS credentials file in your HOME
     *   directory. This setting overrides the AWS_PROFILE environment
     *   variable. Note: Specifying "profile" will cause the "credentials" key
     *   to be ignored.
     * - region: (string, required) Region to connect to. See
     *   http://docs.aws.amazon.com/general/latest/gr/rande.html for a list of
     *   available regions.
     * - retries: (int, default=int(3)) Configures the maximum number of
     *   allowed retries for a client (pass 0 to disable retries).
     * - scheme: (string, default=string(5) "https") URI scheme to use when
     *   connecting connect. The SDK will utilize "https" endpoints (i.e.,
     *   utilize SSL/TLS connections) by default. You can attempt to connect to
     *   a service over an unencrypted "http" endpoint by setting ``scheme`` to
     *   "http".
     * - signature_provider: (callable) A callable that accepts a signature
     *   version name (e.g., "v4"), a service name, and region, and
     *   returns a SignatureInterface object or null. This provider is used to
     *   create signers utilized by the client. See
     *   Aws\Signature\SignatureProvider for a list of built-in providers
     * - signature_version: (string) A string representing a custom
     *   signature version to use with a service (e.g., v4). Note that
     *   per/operation signature version MAY override this requested signature
     *   version.
     * - validate: (bool, default=bool(true)) Set to false to disable
     *   client-side parameter validation.
     * - version: (string, required) The version of the webservice to
     *   utilize (e.g., 2006-03-01).
     *
     * @param array $args Client configuration arguments.
     *
     * @throws \InvalidArgumentException if any required options are missing or
     *                                   the service is not supported.
     */
    public function __construct(array $args)
    {
        list($service, $exceptionClass) = $this->parseClass();
        if (!isset($args['service'])) {
            $args['service'] = manifest($service)['endpoint'];
        }
        if (!isset($args['exception_class'])) {
            $args['exception_class'] = $exceptionClass;
        }
 
        $this->handlerList = new HandlerList();
        $resolver = new ClientResolver(static::getArguments());
        $config = $resolver->resolve($args, $this->handlerList);
        $this->api = $config['api'];
        $this->signatureProvider = $config['signature_provider'];
        $this->endpoint = new Uri($config['endpoint']);
        $this->credentialProvider = $config['credentials'];
        $this->region = isset($config['region']) ? $config['region'] : null;
        $this->config = $config['config'];
        $this->defaultRequestOptions = $config['http'];
        $this->addSignatureMiddleware();
 
        if (isset($args['with_resolved'])) {
            $args['with_resolved']($config);
        }
    }
 
    public function getHandlerList()
    {
        return $this->handlerList;
    }
 
    public function __call($name, array $args)
    {
        $params = isset($args[0]) ? $args[0] : [];
 
        if (substr($name, -5) === 'Async') {
            return $this->executeAsync(
                $this->getCommand(substr($name, 0, -5), $params)
            );
        }
 
        return $this->execute($this->getCommand($name, $params));
    }
 
    public function getConfig($option = null)
    {
        return $option === null
            ? $this->config
            : (isset($this->config[$option])
                ? $this->config[$option]
                : null);
    }
 
    public function getCredentials()
    {
        $fn = $this->credentialProvider;
        return $fn();
    }
 
    public function getEndpoint()
    {
        return $this->endpoint;
    }
 
    public function getRegion()
    {
        return $this->region;
    }
 
    public function getApi()
    {
        return $this->api;
    }
 
    public function execute(CommandInterface $command)
    {
        return $this->executeAsync($command)->wait();
    }
 
    public function executeAsync(CommandInterface $command)
    {
        $handler = $command->getHandlerList()->resolve();
        return $handler($command);
    }
 
    public function getCommand($name, array $args = [])
    {
        // Fail fast if the command cannot be found in the description.
        if (!isset($this->api['operations'][$name])) {
            $name = ucfirst($name);
            if (!isset($this->api['operations'][$name])) {
                throw new \InvalidArgumentException("Operation not found: $name");
            }
        }
 
        if (!isset($args['@http'])) {
            $args['@http'] = $this->defaultRequestOptions;
        } else {
            $args['@http'] += $this->defaultRequestOptions;
        }
 
        return new Command($name, $args, clone $this->getHandlerList());
    }
 
    public function getIterator($name, array $args = [])
    {
        $config = $this->api->getPaginatorConfig($name);
        if (!$config['result_key']) {
            throw new \UnexpectedValueException(sprintf(
                'There are no resources to iterate for the %s operation of %s',
                $name, $this->api['serviceFullName']
            ));
        }
 
        $key = is_array($config['result_key'])
            ? $config['result_key'][0]
            : $config['result_key'];
 
        if ($config['output_token'] && $config['input_token']) {
            return $this->getPaginator($name, $args)->search($key);
        }
 
        $result = $this->execute($this->getCommand($name, $args))->search($key);
 
        return new \ArrayIterator((array) $result);
    }
 
    public function getPaginator($name, array $args = [])
    {
        $config = $this->api->getPaginatorConfig($name);
 
        return new ResultPaginator($this, $name, $args, $config);
    }
 
    public function waitUntil($name, array $args = [])
    {
        return $this->getWaiter($name, $args)->promise()->wait();
    }
 
    public function getWaiter($name, array $args = [])
    {
        $config = isset($args['@waiter']) ? $args['@waiter'] : [];
        $config += $this->api->getWaiterConfig($name);
 
        return new Waiter($this, $name, $args, $config);
    }
 
    public function __sleep()
    {
        throw new \RuntimeException('Instances of ' . static::class
            . ' cannot be serialized');
    }
 
    /**
     * Get the signature_provider function of the client.
     *
     * @return callable
     */
    final protected function getSignatureProvider()
    {
        return $this->signatureProvider;
    }
 
    /**
     * Parse the class name and setup the custom exception class of the client
     * and return the "service" name of the client and "exception_class".
     *
     * @return array
     */
    private function parseClass()
    {
        $klass = get_class($this);
 
        if ($klass === __CLASS__) {
            return ['', 'Aws\Exception\AwsException'];
        }
 
        $service = substr($klass, strrpos($klass, '\\') + 1, -6);
 
        return [
            strtolower($service),
            "Aws\\{$service}\\Exception\\{$service}Exception"
        ];
    }
 
    private function addSignatureMiddleware()
    {
        // Sign requests. This may need to be modified later to support
        // variable signatures per/operation.
        $this->handlerList->appendSign(
            Middleware::signer(
                $this->credentialProvider,
                constantly(SignatureProvider::resolve(
                    $this->signatureProvider,
                    $this->config['signature_version'],
                    $this->api->getSigningName(),
                    $this->region
                ))
            ),
            'signer'
        );
    }
 
    /**
     * Returns a service model and doc model with any necessary changes
     * applied.
     *
     * @param array $api  Array of service data being documented.
     * @param array $docs Array of doc model data.
     *
     * @return array Tuple containing a [Service, DocModel]
     *
     * @internal This should only used to document the service API.
     * @codeCoverageIgnore
     */
    public static function applyDocFilters(array $api, array $docs)
    {
        return [
            new Service($api, ApiProvider::defaultProvider()),
            new DocModel($docs)
        ];
    }
 
    /**
     * @deprecated
     * @return static
     */
    public static function factory(array $config = [])
    {
        return new static($config);
    }
}
#15Aws\AwsClient->execute(Object(Aws\Command))
/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/AwsClient.php (170)
<?php
namespace Aws;
 
use Aws\Api\ApiProvider;
use Aws\Api\DocModel;
use Aws\Api\Service;
use Aws\Signature\SignatureProvider;
use GuzzleHttp\Psr7\Uri;
 
/**
 * Default AWS client implementation
 */
class AwsClient implements AwsClientInterface
{
    /** @var array */
    private $config;
 
    /** @var string */
    private $region;
 
    /** @var string */
    private $endpoint;
 
    /** @var Service */
    private $api;
 
    /** @var callable */
    private $signatureProvider;
 
    /** @var callable */
    private $credentialProvider;
 
    /** @var HandlerList */
    private $handlerList;
 
    /** @var array*/
    private $defaultRequestOptions;
 
    /**
     * Get an array of client constructor arguments used by the client.
     *
     * @return array
     */
    public static function getArguments()
    {
        return ClientResolver::getDefaultArguments();
    }
 
    /**
     * The client constructor accepts the following options:
     *
     * - api_provider: (callable) An optional PHP callable that accepts a
     *   type, service, and version argument, and returns an array of
     *   corresponding configuration data. The type value can be one of api,
     *   waiter, or paginator.
     * - credentials:
     *   (Aws\Credentials\CredentialsInterface|array|bool|callable) Specifies
     *   the credentials used to sign requests. Provide an
     *   Aws\Credentials\CredentialsInterface object, an associative array of
     *   "key", "secret", and an optional "token" key, `false` to use null
     *   credentials, or a callable credentials provider used to create
     *   credentials or return null. See Aws\Credentials\CredentialProvider for
     *   a list of built-in credentials providers. If no credentials are
     *   provided, the SDK will attempt to load them from the environment.
     * - debug: (bool|array) Set to true to display debug information when
     *   sending requests. Alternatively, you can provide an associative array
     *   with the following keys: logfn: (callable) Function that is invoked
     *   with log messages; stream_size: (int) When the size of a stream is
     *   greater than this number, the stream data will not be logged (set to
     *   "0" to not log any stream data); scrub_auth: (bool) Set to false to
     *   disable the scrubbing of auth data from the logged messages; http:
     *   (bool) Set to false to disable the "debug" feature of lower level HTTP
     *   adapters (e.g., verbose curl output).
     * - endpoint: (string) The full URI of the webservice. This is only
     *   required when connecting to a custom endpoint (e.g., a local version
     *   of S3).
     * - endpoint_provider: (callable) An optional PHP callable that
     *   accepts a hash of options including a "service" and "region" key and
     *   returns NULL or a hash of endpoint data, of which the "endpoint" key
     *   is required. See Aws\Endpoint\EndpointProvider for a list of built-in
     *   providers.
     * - handler: (callable) A handler that accepts a command object,
     *   request object and returns a promise that is fulfilled with an
     *   Aws\ResultInterface object or rejected with an
     *   Aws\Exception\AwsException. A handler does not accept a next handler
     *   as it is terminal and expected to fulfill a command. If no handler is
     *   provided, a default Guzzle handler will be utilized.
     * - http: (array, default=array(0)) Set to an array of SDK request
     *   options to apply to each request (e.g., proxy, verify, etc.).
     * - http_handler: (callable) An HTTP handler is a function that
     *   accepts a PSR-7 request object and returns a promise that is fulfilled
     *   with a PSR-7 response object or rejected with an array of exception
     *   data. NOTE: This option supersedes any provided "handler" option.
     * - profile: (string) Allows you to specify which profile to use when
     *   credentials are created from the AWS credentials file in your HOME
     *   directory. This setting overrides the AWS_PROFILE environment
     *   variable. Note: Specifying "profile" will cause the "credentials" key
     *   to be ignored.
     * - region: (string, required) Region to connect to. See
     *   http://docs.aws.amazon.com/general/latest/gr/rande.html for a list of
     *   available regions.
     * - retries: (int, default=int(3)) Configures the maximum number of
     *   allowed retries for a client (pass 0 to disable retries).
     * - scheme: (string, default=string(5) "https") URI scheme to use when
     *   connecting connect. The SDK will utilize "https" endpoints (i.e.,
     *   utilize SSL/TLS connections) by default. You can attempt to connect to
     *   a service over an unencrypted "http" endpoint by setting ``scheme`` to
     *   "http".
     * - signature_provider: (callable) A callable that accepts a signature
     *   version name (e.g., "v4"), a service name, and region, and
     *   returns a SignatureInterface object or null. This provider is used to
     *   create signers utilized by the client. See
     *   Aws\Signature\SignatureProvider for a list of built-in providers
     * - signature_version: (string) A string representing a custom
     *   signature version to use with a service (e.g., v4). Note that
     *   per/operation signature version MAY override this requested signature
     *   version.
     * - validate: (bool, default=bool(true)) Set to false to disable
     *   client-side parameter validation.
     * - version: (string, required) The version of the webservice to
     *   utilize (e.g., 2006-03-01).
     *
     * @param array $args Client configuration arguments.
     *
     * @throws \InvalidArgumentException if any required options are missing or
     *                                   the service is not supported.
     */
    public function __construct(array $args)
    {
        list($service, $exceptionClass) = $this->parseClass();
        if (!isset($args['service'])) {
            $args['service'] = manifest($service)['endpoint'];
        }
        if (!isset($args['exception_class'])) {
            $args['exception_class'] = $exceptionClass;
        }
 
        $this->handlerList = new HandlerList();
        $resolver = new ClientResolver(static::getArguments());
        $config = $resolver->resolve($args, $this->handlerList);
        $this->api = $config['api'];
        $this->signatureProvider = $config['signature_provider'];
        $this->endpoint = new Uri($config['endpoint']);
        $this->credentialProvider = $config['credentials'];
        $this->region = isset($config['region']) ? $config['region'] : null;
        $this->config = $config['config'];
        $this->defaultRequestOptions = $config['http'];
        $this->addSignatureMiddleware();
 
        if (isset($args['with_resolved'])) {
            $args['with_resolved']($config);
        }
    }
 
    public function getHandlerList()
    {
        return $this->handlerList;
    }
 
    public function __call($name, array $args)
    {
        $params = isset($args[0]) ? $args[0] : [];
 
        if (substr($name, -5) === 'Async') {
            return $this->executeAsync(
                $this->getCommand(substr($name, 0, -5), $params)
            );
        }
 
        return $this->execute($this->getCommand($name, $params));
    }
 
    public function getConfig($option = null)
    {
        return $option === null
            ? $this->config
            : (isset($this->config[$option])
                ? $this->config[$option]
                : null);
    }
 
    public function getCredentials()
    {
        $fn = $this->credentialProvider;
        return $fn();
    }
 
    public function getEndpoint()
    {
        return $this->endpoint;
    }
 
    public function getRegion()
    {
        return $this->region;
    }
 
    public function getApi()
    {
        return $this->api;
    }
 
    public function execute(CommandInterface $command)
    {
        return $this->executeAsync($command)->wait();
    }
 
    public function executeAsync(CommandInterface $command)
    {
        $handler = $command->getHandlerList()->resolve();
        return $handler($command);
    }
 
    public function getCommand($name, array $args = [])
    {
        // Fail fast if the command cannot be found in the description.
        if (!isset($this->api['operations'][$name])) {
            $name = ucfirst($name);
            if (!isset($this->api['operations'][$name])) {
                throw new \InvalidArgumentException("Operation not found: $name");
            }
        }
 
        if (!isset($args['@http'])) {
            $args['@http'] = $this->defaultRequestOptions;
        } else {
            $args['@http'] += $this->defaultRequestOptions;
        }
 
        return new Command($name, $args, clone $this->getHandlerList());
    }
 
    public function getIterator($name, array $args = [])
    {
        $config = $this->api->getPaginatorConfig($name);
        if (!$config['result_key']) {
            throw new \UnexpectedValueException(sprintf(
                'There are no resources to iterate for the %s operation of %s',
                $name, $this->api['serviceFullName']
            ));
        }
 
        $key = is_array($config['result_key'])
            ? $config['result_key'][0]
            : $config['result_key'];
 
        if ($config['output_token'] && $config['input_token']) {
            return $this->getPaginator($name, $args)->search($key);
        }
 
        $result = $this->execute($this->getCommand($name, $args))->search($key);
 
        return new \ArrayIterator((array) $result);
    }
 
    public function getPaginator($name, array $args = [])
    {
        $config = $this->api->getPaginatorConfig($name);
 
        return new ResultPaginator($this, $name, $args, $config);
    }
 
    public function waitUntil($name, array $args = [])
    {
        return $this->getWaiter($name, $args)->promise()->wait();
    }
 
    public function getWaiter($name, array $args = [])
    {
        $config = isset($args['@waiter']) ? $args['@waiter'] : [];
        $config += $this->api->getWaiterConfig($name);
 
        return new Waiter($this, $name, $args, $config);
    }
 
    public function __sleep()
    {
        throw new \RuntimeException('Instances of ' . static::class
            . ' cannot be serialized');
    }
 
    /**
     * Get the signature_provider function of the client.
     *
     * @return callable
     */
    final protected function getSignatureProvider()
    {
        return $this->signatureProvider;
    }
 
    /**
     * Parse the class name and setup the custom exception class of the client
     * and return the "service" name of the client and "exception_class".
     *
     * @return array
     */
    private function parseClass()
    {
        $klass = get_class($this);
 
        if ($klass === __CLASS__) {
            return ['', 'Aws\Exception\AwsException'];
        }
 
        $service = substr($klass, strrpos($klass, '\\') + 1, -6);
 
        return [
            strtolower($service),
            "Aws\\{$service}\\Exception\\{$service}Exception"
        ];
    }
 
    private function addSignatureMiddleware()
    {
        // Sign requests. This may need to be modified later to support
        // variable signatures per/operation.
        $this->handlerList->appendSign(
            Middleware::signer(
                $this->credentialProvider,
                constantly(SignatureProvider::resolve(
                    $this->signatureProvider,
                    $this->config['signature_version'],
                    $this->api->getSigningName(),
                    $this->region
                ))
            ),
            'signer'
        );
    }
 
    /**
     * Returns a service model and doc model with any necessary changes
     * applied.
     *
     * @param array $api  Array of service data being documented.
     * @param array $docs Array of doc model data.
     *
     * @return array Tuple containing a [Service, DocModel]
     *
     * @internal This should only used to document the service API.
     * @codeCoverageIgnore
     */
    public static function applyDocFilters(array $api, array $docs)
    {
        return [
            new Service($api, ApiProvider::defaultProvider()),
            new DocModel($docs)
        ];
    }
 
    /**
     * @deprecated
     * @return static
     */
    public static function factory(array $config = [])
    {
        return new static($config);
    }
}
#16Aws\AwsClient->__call(sendMessage, Array([0] => Array([QueueUrl] => https://sqs.eu-west-1.amazonaws.com/324404655028/beanstalk, [MessageBody] => {"task":"icecat","action":"update","params":["651025"],"localQueueId":"4466148"})))
/home/ubuntu/partsit-site/app/library/PhalconHelpers/Injectable/SQS.php (75)
<?php
 
namespace PhalconHelpers\Injectable;
 
use \Phalcon\Di\InjectionAwareInterface;
 
/**
 * A wrapper class for the AWS SQS service which is used as a scalable/modular beanstalk service.
 * @author Jack Timblin
 * @version 1
 */
class SQS implements InjectionAwareInterface
{
  private $_di;
  private $queueUrl = 'https://sqs.eu-west-1.amazonaws.com/324404655028/beanstalk';
 
  /**
   * {@inheritDoc}
   */
  public function setDI(\Phalcon\DiInterface $di)
  {
    $this->_di = $di;
  }
 
  /**
   * {@inheritDoc}
   */
  public function getDI()
  {
    return $this->_di;
  }
 
  /**
   * Sends a message to AWS SQS.
   * @param  array $body the message to send, json encoded.
   * @return \Aws\Result the result.
   */
  public function sendMessage($body)
  {
    $params = json_encode(isset($body['params']) ? $body['params'] : array());
 
    if(!isset($body['task'])) {
      return null;
    }
 
    if(!isset($body['action'])) {
      return null;
    }
 
    $localQueueId = null;
 
    try {
      $qe = new \Models\BeanstalkQueueEntry();
      $qe->setTask($body['task']);
      $qe->setAction($body['action']);
      $qe->setParams($params);
      $qe->save();
      $localQueueId = $qe->getId();
    } catch (\Exception $e) {
      return null;
    }
 
    if($localQueueId == null) {
      return null;
    }
 
    $body['localQueueId'] = $localQueueId;
 
    $message = json_encode($body);
    $request = array(
      'QueueUrl'    => $this->queueUrl,
      'MessageBody' => $message
    );
    $sqs = $this->_di->get('aws')->createSqs();
    $result = $sqs->sendMessage($request);
    return $result;
  }
 
  /**
   * Placeholder/Legacy function to replace \Pheanstalk_Pheanstalk::put()
   */
  public function put($body)
  {
    return $this->sendMessage($body);
  }
 
  /**
   * Attempts to receive (and then delete) a message from AWS SQS.
   * @return array|null the message body on success, null if there is no message to receive.
   */
  public function receiveMessage()
  {
    $request = array(
      'MaxNumberOfMessages' => 1,
      'AttributeNames'      => array( 'All' ),
      'QueueUrl'            => $this->queueUrl,
      'VisibilityTimeout'   => 2, //to hide from other process while its deleted.
      'WaitTimeSeconds'     => 20
    );
    $sqs     = $this->_di->get('aws')->createSqs();
    $result  = $sqs->receiveMessage($request);
 
    if(!isset($result['Messages'])) {
      return null; //no messages.
    }
 
    $message = $result['Messages'][0]; //there will only ever be one message.
    $body    = json_decode($message['Body'], true);
 
    //get the reference to our local queue id.
    $id = $body['localQueueId'];
 
    if(isset($id)) {
      $qe = \Models\BeanstalkQueueEntry::findFirst(array('id = ?1', 'bind' => array(1 => $id)));
      if($qe) {
        $qe->delete();
      }
    }
 
    $handle  = $message['ReceiptHandle']; //used to delete the message.
 
    //delete the message from SQS, it will be handled in the background. 
    $sqs->deleteMessage(
      array(
        'QueueUrl'      => $this->queueUrl,
        'ReceiptHandle' => $handle
      )
    );
 
    //get the required variables & attributes.
    $job = array(
      'body'       => $body,
      'id'         => $message['MessageId'],
      'firstReceived' => $message['Attributes']['ApproximateFirstReceiveTimestamp'],
      'sent'      => $message['Attributes']['SentTimestamp']
    );
 
    $job['age'] = $job['sent'] - $job['firstReceived'];
 
    return $job;
  }
 
  /**
   * Gets the attributes of the current SQS queue.
   * @return \Aws\Result the 
   */
  public function getQueueAttributes()
  {
    $sqs = $this->_di->get('aws')->createSqs();
    return $sqs->getQueueAttributes(
      array(
        'AttributeNames' => array( 'All' ),
        'QueueUrl'       => $this->queueUrl 
      )
    );
  }
 
}
#17Aws\Sqs\SqsClient->sendMessage(Array([QueueUrl] => https://sqs.eu-west-1.amazonaws.com/324404655028/beanstalk, [MessageBody] => {"task":"icecat","action":"update","params":["651025"],"localQueueId":"4466148"}))
/home/ubuntu/partsit-site/app/library/PhalconHelpers/Injectable/SQS.php (75)
<?php
 
namespace PhalconHelpers\Injectable;
 
use \Phalcon\Di\InjectionAwareInterface;
 
/**
 * A wrapper class for the AWS SQS service which is used as a scalable/modular beanstalk service.
 * @author Jack Timblin
 * @version 1
 */
class SQS implements InjectionAwareInterface
{
  private $_di;
  private $queueUrl = 'https://sqs.eu-west-1.amazonaws.com/324404655028/beanstalk';
 
  /**
   * {@inheritDoc}
   */
  public function setDI(\Phalcon\DiInterface $di)
  {
    $this->_di = $di;
  }
 
  /**
   * {@inheritDoc}
   */
  public function getDI()
  {
    return $this->_di;
  }
 
  /**
   * Sends a message to AWS SQS.
   * @param  array $body the message to send, json encoded.
   * @return \Aws\Result the result.
   */
  public function sendMessage($body)
  {
    $params = json_encode(isset($body['params']) ? $body['params'] : array());
 
    if(!isset($body['task'])) {
      return null;
    }
 
    if(!isset($body['action'])) {
      return null;
    }
 
    $localQueueId = null;
 
    try {
      $qe = new \Models\BeanstalkQueueEntry();
      $qe->setTask($body['task']);
      $qe->setAction($body['action']);
      $qe->setParams($params);
      $qe->save();
      $localQueueId = $qe->getId();
    } catch (\Exception $e) {
      return null;
    }
 
    if($localQueueId == null) {
      return null;
    }
 
    $body['localQueueId'] = $localQueueId;
 
    $message = json_encode($body);
    $request = array(
      'QueueUrl'    => $this->queueUrl,
      'MessageBody' => $message
    );
    $sqs = $this->_di->get('aws')->createSqs();
    $result = $sqs->sendMessage($request);
    return $result;
  }
 
  /**
   * Placeholder/Legacy function to replace \Pheanstalk_Pheanstalk::put()
   */
  public function put($body)
  {
    return $this->sendMessage($body);
  }
 
  /**
   * Attempts to receive (and then delete) a message from AWS SQS.
   * @return array|null the message body on success, null if there is no message to receive.
   */
  public function receiveMessage()
  {
    $request = array(
      'MaxNumberOfMessages' => 1,
      'AttributeNames'      => array( 'All' ),
      'QueueUrl'            => $this->queueUrl,
      'VisibilityTimeout'   => 2, //to hide from other process while its deleted.
      'WaitTimeSeconds'     => 20
    );
    $sqs     = $this->_di->get('aws')->createSqs();
    $result  = $sqs->receiveMessage($request);
 
    if(!isset($result['Messages'])) {
      return null; //no messages.
    }
 
    $message = $result['Messages'][0]; //there will only ever be one message.
    $body    = json_decode($message['Body'], true);
 
    //get the reference to our local queue id.
    $id = $body['localQueueId'];
 
    if(isset($id)) {
      $qe = \Models\BeanstalkQueueEntry::findFirst(array('id = ?1', 'bind' => array(1 => $id)));
      if($qe) {
        $qe->delete();
      }
    }
 
    $handle  = $message['ReceiptHandle']; //used to delete the message.
 
    //delete the message from SQS, it will be handled in the background. 
    $sqs->deleteMessage(
      array(
        'QueueUrl'      => $this->queueUrl,
        'ReceiptHandle' => $handle
      )
    );
 
    //get the required variables & attributes.
    $job = array(
      'body'       => $body,
      'id'         => $message['MessageId'],
      'firstReceived' => $message['Attributes']['ApproximateFirstReceiveTimestamp'],
      'sent'      => $message['Attributes']['SentTimestamp']
    );
 
    $job['age'] = $job['sent'] - $job['firstReceived'];
 
    return $job;
  }
 
  /**
   * Gets the attributes of the current SQS queue.
   * @return \Aws\Result the 
   */
  public function getQueueAttributes()
  {
    $sqs = $this->_di->get('aws')->createSqs();
    return $sqs->getQueueAttributes(
      array(
        'AttributeNames' => array( 'All' ),
        'QueueUrl'       => $this->queueUrl 
      )
    );
  }
 
}
#18PhalconHelpers\Injectable\SQS->sendMessage(Array([task] => icecat, [action] => update, [params] => Array([0] => 651025)))
/home/ubuntu/partsit-site/app/library/PhalconHelpers/Injectable/SQS.php (84)
<?php
 
namespace PhalconHelpers\Injectable;
 
use \Phalcon\Di\InjectionAwareInterface;
 
/**
 * A wrapper class for the AWS SQS service which is used as a scalable/modular beanstalk service.
 * @author Jack Timblin
 * @version 1
 */
class SQS implements InjectionAwareInterface
{
  private $_di;
  private $queueUrl = 'https://sqs.eu-west-1.amazonaws.com/324404655028/beanstalk';
 
  /**
   * {@inheritDoc}
   */
  public function setDI(\Phalcon\DiInterface $di)
  {
    $this->_di = $di;
  }
 
  /**
   * {@inheritDoc}
   */
  public function getDI()
  {
    return $this->_di;
  }
 
  /**
   * Sends a message to AWS SQS.
   * @param  array $body the message to send, json encoded.
   * @return \Aws\Result the result.
   */
  public function sendMessage($body)
  {
    $params = json_encode(isset($body['params']) ? $body['params'] : array());
 
    if(!isset($body['task'])) {
      return null;
    }
 
    if(!isset($body['action'])) {
      return null;
    }
 
    $localQueueId = null;
 
    try {
      $qe = new \Models\BeanstalkQueueEntry();
      $qe->setTask($body['task']);
      $qe->setAction($body['action']);
      $qe->setParams($params);
      $qe->save();
      $localQueueId = $qe->getId();
    } catch (\Exception $e) {
      return null;
    }
 
    if($localQueueId == null) {
      return null;
    }
 
    $body['localQueueId'] = $localQueueId;
 
    $message = json_encode($body);
    $request = array(
      'QueueUrl'    => $this->queueUrl,
      'MessageBody' => $message
    );
    $sqs = $this->_di->get('aws')->createSqs();
    $result = $sqs->sendMessage($request);
    return $result;
  }
 
  /**
   * Placeholder/Legacy function to replace \Pheanstalk_Pheanstalk::put()
   */
  public function put($body)
  {
    return $this->sendMessage($body);
  }
 
  /**
   * Attempts to receive (and then delete) a message from AWS SQS.
   * @return array|null the message body on success, null if there is no message to receive.
   */
  public function receiveMessage()
  {
    $request = array(
      'MaxNumberOfMessages' => 1,
      'AttributeNames'      => array( 'All' ),
      'QueueUrl'            => $this->queueUrl,
      'VisibilityTimeout'   => 2, //to hide from other process while its deleted.
      'WaitTimeSeconds'     => 20
    );
    $sqs     = $this->_di->get('aws')->createSqs();
    $result  = $sqs->receiveMessage($request);
 
    if(!isset($result['Messages'])) {
      return null; //no messages.
    }
 
    $message = $result['Messages'][0]; //there will only ever be one message.
    $body    = json_decode($message['Body'], true);
 
    //get the reference to our local queue id.
    $id = $body['localQueueId'];
 
    if(isset($id)) {
      $qe = \Models\BeanstalkQueueEntry::findFirst(array('id = ?1', 'bind' => array(1 => $id)));
      if($qe) {
        $qe->delete();
      }
    }
 
    $handle  = $message['ReceiptHandle']; //used to delete the message.
 
    //delete the message from SQS, it will be handled in the background. 
    $sqs->deleteMessage(
      array(
        'QueueUrl'      => $this->queueUrl,
        'ReceiptHandle' => $handle
      )
    );
 
    //get the required variables & attributes.
    $job = array(
      'body'       => $body,
      'id'         => $message['MessageId'],
      'firstReceived' => $message['Attributes']['ApproximateFirstReceiveTimestamp'],
      'sent'      => $message['Attributes']['SentTimestamp']
    );
 
    $job['age'] = $job['sent'] - $job['firstReceived'];
 
    return $job;
  }
 
  /**
   * Gets the attributes of the current SQS queue.
   * @return \Aws\Result the 
   */
  public function getQueueAttributes()
  {
    $sqs = $this->_di->get('aws')->createSqs();
    return $sqs->getQueueAttributes(
      array(
        'AttributeNames' => array( 'All' ),
        'QueueUrl'       => $this->queueUrl 
      )
    );
  }
 
}
#19PhalconHelpers\Injectable\SQS->put(Array([task] => icecat, [action] => update, [params] => Array([0] => 651025)))
/home/ubuntu/partsit-site/app/controllers/ProductController.php (64)
<?php
 
namespace Controllers;
 
class ProductController extends \Controllers\ControllerBase
{
  public function beforeExecuteRoute(\Phalcon\Mvc\Dispatcher $dispatcher)
  {
    $expireDate = new \DateTime();
    $expireDate->modify('+1 day');
    
    $this->response->setExpires($expireDate);
    
    $this->response->setHeader('Cache-Control', 'max-age=86400');
  }
  
  
  
  public function indexAction()
  {
    return $this->response->redirect('');
  }
  
  public function productAction()
  {
    $partURL = $this->dispatcher->getParam('partURL');
    
    $old = \Models\OldCategories::findFirst(array('token = ?1', 'bind' => array(1 => $partURL)));
    //check to see if any of the old keywords match.
    if($old) {
      return $this->response->redirect($old->getReplacement());
    }
    
    $url = '/product/' . $partURL;
    
    $this->view->url = $url;
    
    if ($this->request->isAjax()) {
      $this->view->disable();
      
      $this->session->set('viewAs', $this->request->getPost('viewAs'));
      
      echo json_encode(array('success' => 'success'));
      exit();
    }
    
    $this->view->viewAs = $this->session->get('viewAs') == 'true';
    
    $part = \Models\Parts::findFromURL($partURL);
    
    if (!$part) {
      return $this->error404();
    }
 
    //update this products information in the background.
    $this->queue->put(
      array(
        'task' => 'icecat',
        'action' => 'update',
        'params' => array(
          $part->getPartID()
        )
      )
    );
       
    
    $manufacturer = $part->getManufacturers();
    
    
    $alibaba = \Models\Distributors::findFromURL('alibaba');
    
    if ($part->countStockParts('distributorID = ' . $alibaba->getDistributorID()) == 0) {
//      $this->queue->put(
//        array(
//          'task'   => 'alibaba',
//          'action' => 'importIndividual',
//          'params' => array(
//            $part->getPartID()
//          )
//        )
//      );
    }
    
    $didYouMean = ($this->session->has('pquery') && strlen($this->session->get('pquery') > 0)) 
          ? $this->session->get('pquery')
          : false;
 
    if(is_array($didYouMean)) {
 
      $products = \Models\Parts::search(
        $didYouMean,
        1,
        10
      );
 
      if(count($products['parts']) > 0) {
 
        foreach($products['parts'] as $index => $p) {
          if(strtolower(trim($didYouMean[0])) == strtolower($p->getPartNumber())) {
            unset($products['parts'][$index]);
          }
        }
 
        $this->view->search = $products['parts'];
      }
 
      $this->session->remove('pquery');
    }
    
    
    $now = new \DateTime();
    $now = $now->format('Y-m-d H:i:s');
    
        $this->view->opts = $part->getBulkBuyOptions();
        
    //TODO
    $recentlyViewed = \Models\RecentlyViewed::findFirst(
      array(
        'partID = :partID:',
        'bind' => array(
          'partID' => $part->getPartID()
        )
      )
    );
    
    if (!$recentlyViewed) {
      $recentlyViewed = new \Models\RecentlyViewed();
      
      $recentlyViewed->setIPAddress($_SERVER['REMOTE_ADDR']);
      $recentlyViewed->setPartID($part->getPartID());
    }
    
    $recentlyViewed->setTimestamp($now);
    $recentlyViewed->save();
        
    if ($this->session->has('customer')) {
      $customer = $this->session->get('customer');
      
      $sapPart = $part->getSapParts();
      
      if ($sapPart) {
        $previousOrders = $this->modelsManager->executeQuery(
          'SELECT
            \Models\SAP\Orders.date
          FROM \Models\SAP\Orders
          
          JOIN \Models\SAP\OrderParts ON
            \Models\SAP\Orders.orderID = \Models\SAP\OrderParts.orderID
          
          WHERE
            \Models\SAP\OrderParts.partNumber = "' . $sapPart->getPartNumber() . '"
            AND
            \Models\SAP\Orders.shortcode = "' . $customer->getShortcode() . '"
          
          ORDER BY
            \Models\SAP\Orders.date DESC
          
          LIMIT 1'
        );
        
        if (count($previousOrders) > 0) {
          $this->flashSession->notice(
            'You previously bought this item ' . $previousOrders[0]['date'] . '. <a href="/product/' . $part->getPartURL() . '/review" class="alert-link" data-toggle="modal" data-target="#addReview" data-remote="false">Would you like to review it</a>?'
          );
        }
      }
    }
    
    
    
    if ($this->view->allowed) {
 
      $now = new \DateTime();
      $now = $now->format('Y-m-d');
 
      $fixedPrice = \Models\FixedPrice::findFirst(array(
        'partID = ?1 AND validTo > ?2',
        'bind' => array(
          1 => $part->getPartID(),
          2 => $now
        )
      ));
 
      $orderParts = $part->getSapOrderParts(
        array(
          'order' => 'orderID DESC',
          'limit' => 10
        )
      );
      
      $quoteParts = $part->getSapQuoteParts(
        array(
          'order' => 'quoteID DESC',
          'limit' => 10
        )
      );
      
      $purchaseOrderParts = $part->getSapPurchaseOrderParts(
        array(
          'order' => 'purchaseOrderID DESC',
          'limit' => 10
        )
      );
      
      $this->view->orderParts         = $orderParts;
      $this->view->quoteParts         = $quoteParts;
      $this->view->purchaseOrderParts = $purchaseOrderParts;
      $this->view->fixedPrice         = $fixedPrice;
    }
    
    
    $partConditions = \Models\PartConditions::find();
    
    if($part->isPartOfABundle()) {
      //get the parts on this bundle.
      $bp = $part->getBundleParts();
      
      $bundles = array();
      foreach($bp as $b) {
        $bu = $b->getBundle();
        if($bu instanceof \Models\Bundle) {
          $bundles[] = $bu;
        }
      }
 
      $this->view->bundles = $bundles;
 
    }
    
    $this->view->part         = $part;
    $this->view->manufacturer = $manufacturer;
    
    $this->view->partConditions = $partConditions;
    
    $this->tag->prependTitle(
      $part->getManufacturers()->getManufacturer() . ' ' . $part->getTitle() . ' Parts Available Here | '
    );
  }
    
    public function refurbAction() {
 
      $partURL = $this->dispatcher->getParam('partURL');
    
    $part = \Models\Parts::findFromURL($partURL);
    
    if (!$part) {
      return $this->error404();
    }
 
    //send a refurb request to admin@partsit.com
    //get the details from the form.
    if($this->request->isPost()) {
      $email = $this->request->getPost('emailAddress');
      $quantity = $this->request->getPost('quantity');
      if(!isset($quantity) || strlen($quantity) == 0) {
        $quantity = 1;
      }
      $quantity = intval($quantity);
      $name = $this->request->getPost('username');
      \Models\RefurbRequest::createNew($email, $name, $quantity, $part->getPartID());
      $this->flashSession->success(
        'Thank you, you have been emailed.'
      );
    } else {
      $this->flashSession->error(
        'Please enter a valid email address.'
      );
    }
 
    return $this->response->redirect(
      'product/' . $part->getPartURL()
    );
 
    }
  
  public function emailAction()
  {
    $partURL = $this->dispatcher->getParam('partURL');
    
    $part = \Models\Parts::findFromURL($partURL);
    
    if (!$part) {
      return $this->error404();
    }
    
    if ($this->request->getPost('submit')) {
      if ($this->request->getPost('emailAddress', 'email')) {
        $this->console->handle(
          array(
            'task'   => 'mail',
            'action' => 'emailMeThisProduct',
            'params' => array(
              'emailAddress' => $this->request->getPost('emailAddress', 'email'),
              'partID'       => $part->getPartID()
            )
          ),
          array(
            'priority' => 100
          )
        );
        
        $this->flashSession->success(
          'Thank you, you have been emailed.'
        );
        
        return $this->response->redirect(
          'product/' . $part->getPartURL()
        );
      } else {
        $this->flashSession->error(
          'Please enter a valid email address.'
        );
      }
      
      return $this->response->redirect('product/' . $part->getPartURL());
    }
    
    $this->view->part = $part;
    
    $this->tag->prependTitle(
      'Email Me Information About ' . $part->getManufacturers()->getManufacturer() . ' ' . $part->getTitle() . ' | '
    );
  }
  
  public function requestPriceAction()
  {
    $partURL = $this->dispatcher->getParam('partURL');
    
    $part = \Models\Parts::findFromURL($partURL);
    
    if (!$part) {
      return $this->error404();
    }
    
    if ($this->request->getPost('submit')) {
      if ($this->request->getPost('emailAddress', 'email')) {
        $now = new \DateTime();
        $now = $now->format('Y-m-d');
        
        $priceRequest = new \Models\PriceRequests();
        
        $priceRequest->setPartID($part->getPartID());
        $priceRequest->setDateRequested($now);
        $priceRequest->setName($this->request->getPost('name'));
        $priceRequest->setEmailAddress($this->request->getPost('emailAddress', 'email'));
        
        $priceRequest->save();
        
        $this->console->handle(
          array(
            'task'   => 'mail',
            'action' => 'sendPriceRequest',
            'params' => array(
              'priceRequestID' => $priceRequest->getRequestID()
            )
          ),
          array(
            'priority' => 100
          )
        );
        
        $this->flashSession->success(
          'Thank you, your price request has been sent.'
        );
      } else {
        $this->flashSession->error(
          'Please enter a valid email address.'
        );
      }
      
      return $this->response->redirect('product/' . $part->getPartURL());
    }
    
    $this->view->part = $part;
    
    $this->tag->prependTitle(
      'Request a Price for ' . $part->getManufacturers()->getManufacturer() . ' ' . $part->getTitle() . ' | '
    );
  }
  
  public function reviewAction()
  {
    $customer = $this->session->get('customer');
    
    if (!$customer) {
      return $this->notLoggedIn();
    }
    
    $partURL = $this->dispatcher->getParam('partURL');
    
    $part = \Models\Parts::findFromURL($partURL);
    
    if (!$part) {
      return $this->error404();
    }
    
    if ($this->request->getPost('review')) {
      $now = new \DateTime();
      $now = $now->format('Y-m-d H:i:s');
      
      $review = new \Models\Reviews();
      
      $review->setPartID($part->getPartID());
      $review->setCustomerID($customer->getCustomerID());
      $review->setStarRating(5); //TODO
      $review->setTitle($this->request->getPost('title'));
      $review->setContent($this->request->getPost('review'));
      $review->setReviewDate($now);
      $review->setIsApproved(0);
      
      $review->save();
      
      $this->flashSession->success(
        'Thank you for your review. All reviews must first be approved before they appear on the site.'
      );
      
      return $this->response->redirect('product/' . $part->getPartURL());
    }
    
    $this->view->part = $part;
    
    $this->tag->prependTitle(
      'Review ' . $part->getManufacturers()->getManufacturer() . ' ' . $part->getTitle() . ' | '
    );
  }
 
}
#20Controllers\ProductController->productAction(dell-65htg)
#21Phalcon\Dispatcher->dispatch()
#22Phalcon\Mvc\Application->handle()
/home/ubuntu/partsit-site/app/web.php (424)
<?php
 
define('BOOTSTRAP', 'WEB');
 
if (isset($_SERVER['HTTP_X_VARNISH']) && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
  $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
 
if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'http') {
  header("Location: https://www.partsit.com{$_SERVER['REQUEST_URI']}");
}
 
// if(geoip_country_code_by_name($_SERVER['REMOTE_ADDR']) == 'CN') {
//   header("HTTP/1.0 404 Not Found");
//   return;
// }
 
require 'startup.php';
 
if (ENVIRONMENT == 'development') {
  $debug = new \Phalcon\Debug();
  $debug->listen();
}
 
$di->set('markdown', function($view, $di){
  $engine = new \Engine\Markdown($view, $di);
  return $engine;
});
 
 
// Setting up the view component.
$di->set(
  'view',
  function () use ($config, $di) {
    $view = new \Phalcon\Mvc\View();
    
    $view->setViewsDir($config->application->viewsDir);
    
    // Set the volt templating engine.
    $view->registerEngines(
      array(
        '.volt' => 'volt',
        '.md'   => 'markdown'
      )
    );
    
    return $view;
  }
);
 
$di->set(
  'console',
  function() {
    $console = new \Console();
    return $console;
  },true
);
 
$di->set(
  'cookies',
  function () {
    $cookies = new \Phalcon\Http\Response\Cookies();
    
    $cookies->useEncryption(false);
    
    return $cookies;
  }
);
 
$di->set(
  'viewCache',
  function () use ($config) {
    $frontCache = new \Phalcon\Cache\Frontend\Output(
      array(
        'lifetime' => $config->cache->viewCache
      )
    );
 
    $cache = new \Phalcon\Cache\Backend\APC(
      $frontCache,
      array(
        'prefix' => 'viewCache:'
      )
    );
    
    return $cache;
  }
);
 
$di->set(
  'flash',
  function () {
    $flash = new \Phalcon\Flash\Direct(
      array(
        'error'   => 'alert alert-danger',
        'success' => 'alert alert-success',
        'notice'  => 'alert alert-info',
        'warning' => 'alert alert-warning'
      )
    );
    
    return $flash;
  }
);
 
// Register the flash service with Twitter Bootstrap classes.
$di->set(
  'flashSession',
  function () {
    $flash = new \Phalcon\Flash\Session(
      array(
        'error'   => 'alert alert-danger',
        'success' => 'alert alert-success',
        'notice'  => 'alert alert-info',
        'warning' => 'alert alert-warning'
      )
    );
    
    return $flash;
  }
);
 
// Set custom dispatcher to catch events in the dispatch loop.
$di->set(
  'dispatcher',
  function () use ($di) {
    $dispatcher = new \Phalcon\Mvc\Dispatcher();
    
    $dispatcher->setDefaultNamespace('\Controllers');
    
    // Obtain the standard eventsManager from the DI.
    $eventsManager = $di->getShared('eventsManager');
    
    // Attach a listener for type "dispatch".
    $eventsManager->attach(
      'dispatch:beforeDispatchLoop',
      function ($event, $dispatcher) {
        if ($dispatcher->getActionName()) {
          $actionName = lcfirst(\Phalcon\Text::camelize($dispatcher->getActionName()));
          
          $dispatcher->setActionName($actionName);
        }
      }
    );
    
    $eventsManager->attach(
      'dispatch:beforeException',
      function ($event, $dispatcher, $exception) {
        switch ($exception->getCode()) {
          case \Phalcon\Mvc\Dispatcher::EXCEPTION_HANDLER_NOT_FOUND:
          case \Phalcon\Mvc\Dispatcher::EXCEPTION_ACTION_NOT_FOUND:
            $dispatcher->forward(
              array(
                'controller' => 'error',
                'action'     => 'route404'
              )
            );
            
            return false;
        }
      }
    );
    
    $dispatcher->setEventsManager($eventsManager);
    
    return $dispatcher;
  },
  true
);
 
$di->set(
  'url',
  function () {
    $url = new \Phalcon\Mvc\Url();
    
    // if (ENVIRONMENT == 'production') {
    //   $url->setBaseUri('http://www.partsit.com/');
    // }
    
    return $url;
  }
);
 
/*
 * Start the session the first time when some component request the session
 * service.
 */
$di->setShared(
  'session',
  function () {
    $session = new \Phalcon\Session\Adapter\Files();
    
    $session->start();
    
    return $session;
  }
);
 
$di->set(
  'logger',
  function () use ($logger) {
    return $logger;
  }
);
 
// Set up custom routes in the application.
$di->set(
  'router',
  function () {
    $router = new \Phalcon\Mvc\Router(false);
    
    $router->removeExtraSlashes(true);
    
    $router->add(
      '/:controller',
      array(
        'controller' => 1
      )
    );
    
    $router->add(
      '/:controller/([a-zA-Z0-9\-]+)/:params',
      array(
        'controller' => 1,
        'action'     => 2,
        'params'     => 3
      )
    )->convert(
      'action',
      function ($action) {
        return \Phalcon\Text::camelize($action);
      }
    );
 
    $router->add('/applegate.csv', 'applegate::index');
    //$router->add('/sitemap.xml',    'sitemap::file');
 
    //add all of the old links, and redirect to new equivilent
    $router->add('/support/sitemap', 'sitemap::index');
    $router->add('/support/partsit-com-rma-returns-request-terms-conditions', 'support::returnsPolicy');
    $router->add('/support/cookies-policy', 'support::cookiePolicy');
    $router->add('/support/public-sector-credit-account', 'public-sector-credit-account::index');
    $router->add('/support/about-partsit-com', 'about::index');
    
    $router->add('/consumers',   'index::consumers');
    $router->add('/maintenance', 'index::maintenance');
    $router->add('/end-users',   'index::endUsers');
    $router->add('/government',  'index::government');
    $router->add('/brokers',     'index::brokers');
    
    $router->add('/categories-ajax/{sectionURL:[a-z0-9\-]+}',                           'categories-ajax::section');
    $router->add('/categories-ajax/{sectionURL:[a-z0-9\-]+}/{categoryURL:[a-z0-9\-]+}', 'categories-ajax::category');
    
    /* chat.chat route */
    $router->add('/chat/{chatID:[0-9]+}', 'chat::chat');
    
    /* product route */
    $router->add('/product/{partURL:[a-z0-9\-]+}',               'product::product');
    $router->add('/product/{partURL:[a-z0-9\-]+}/email',         'product::email');
    $router->add('/product/{partURL:[a-z0-9\-]+}/request-price', 'product::requestPrice');
    $router->add('/product/{partURL:[a-z0-9\-]+}/review',        'product::review');
    $router->add('/product/{partURL:[a-z0-9\-]+}/email-example', 'product::emailExample');
    $router->add('/product/{partURL:[a-z0-9\-]+}/refurb',      'product::refurb');
    
    $router->add(
      '/product/{partURL:[a-z0-9\-]+}/admin/([a-zA-Z0-9\-]+)',
      array(
        'controller' => 'product-admin',
        'action'     => 2
      )
    );
 
    /* products route */
    $router->add('/products/{partURL:[a-z0-9\-]+}',               'product::product');
    $router->add('/products/{partURL:[a-z0-9\-]+}/email',         'product::email');
    $router->add('/products/{partURL:[a-z0-9\-]+}/request-price', 'product::requestPrice');
    $router->add('/products/{partURL:[a-z0-9\-]+}/review',        'product::review');
    $router->add('/products/{partURL:[a-z0-9\-]+}/email-example', 'product::emailExample');
    
    $router->add(
      '/products/{partURL:[a-z0-9\-]+}/admin/([a-zA-Z0-9\-]+)',
      array(
        'controller' => 'product-admin',
        'action'     => 2
      )
    );
 
    $router->add('/resources/image/{hash:[a-zA-Z0-9\-]+}', 'resources::image');
    $router->add('/resources/blob/{partID:[0-9]+}', 'resources::blob');
        
        $router->add('/background/alibaba/{partURL:[a-z0-9\-]+}',    'background::alibaba');
    
    $router->add('/reviews/{partURL:[a-z0-9\-]+}',               'reviews::product');
    
    /* part-finder routes */
    $router->add('/part-finder/{systemManufacturerURL:[a-z0-9\-]+}',                                                                                     'part-finder::manufacturer');
    $router->add('/part-finder/{systemManufacturerURL:[a-z0-9\-]+}/{modelFamilyURL:[a-z0-9\-]+}',                                                        'part-finder::modelFamily');
    $router->add('/part-finder/{systemManufacturerURL:[a-z0-9\-]+}/{modelFamilyURL:[a-z0-9\-]+}/{modelNumberURL:[a-z0-9\-]+}',                           'part-finder::modelNumber');
    $router->add('/part-finder/{systemManufacturerURL:[a-z0-9\-]+}/{modelFamilyURL:[a-z0-9\-]+}/{modelNumberURL:[a-z0-9\-]+}/{oldCategorySlug:[a-z-]+}', 'part-finder::modelNumber');
    $router->add('/part-finder/search',                                                                                                                  'part-finder::search');
    
    $router->add('/account/returns/{pageNumber:[0-9]+}',          'account::returns');
    
    $router->add('/account/previous-purchases/{pageNumber:[0-9]+}',          'account::previousPurchases');
    $router->add('/account/quotes/{pageNumber:[0-9]+}',                      'account::quotes');
    $router->add('/account/invoices/{pageNumber:[0-9]+}',                    'account::invoices');
    
    /* part-finder admin routes */
    $router->add('/dashboard/part-finder/{systemManufacturerURL:[a-z0-9\-]+}',                                                           'dashboard::partFinderManufacturer');
    $router->add('/dashboard/part-finder/{systemManufacturerURL:[a-z0-9\-]+}/{modelFamilyURL:[a-z0-9\-]+}',                              'dashboard::partFinderModelFamily');
    $router->add('/dashboard/part-finder/{systemManufacturerURL:[a-z0-9\-]+}/{modelFamilyURL:[a-z0-9\-]+}/{modelNumberURL:[a-z0-9\-]+}', 'dashboard::partFinderModelNumber');
    
    $router->add('/dashboard/categories/{sectionURL:[a-z0-9\-]+}',                                                        'dashboard::categoriesSection');
    $router->add('/dashboard/categories/{sectionURL:[a-z0-9\-]+}/{categoryURL:[a-z0-9\-]+}',                              'dashboard::categoriesCategory');
    
    $router->add('/dashboard/promo/{page:[0-9]+}', 'dashboard::promo');
    $router->add('/dashboard/pending-orders/{page:[0-9]+}', 'dashboard::pendingOrders');
    $router->add('/dashboard/pending-orders/{page:[0-9]+}/{orderDirection:[0-1]{1}}', 'dashboard::pendingOrders');
 
    $router->add('/api/xml/all', 'api::xmlAll');
 
    $router->add('/dashboard/feedback/{pageNumber:[0-9]+}',      'dashboard::feedback');
    $router->add('/dashboard/feedback/add',                      'dashboard::feedbackAdd');
    $router->add('/dashboard/feedback/edit/{feedbackID:[0-9]+}', 'dashboard::feedbackEdit');
    
    //TODO
    $router->add('/dashboard/email-shots/new', 'dashboard::emailShotsNew');
    $router->add('/dashboard/approve-images/{s:[A-Za-z0-9]+}', 'dashboard::approveImages');
    
    $router->add('/dashboard/parts/add',                             'dashboard::partsAdd');
    $router->add('/dashboard/parts/modify/{partURL:[A-Za-z0-9\-]+}', 'dashboard::partsModify');
    
    $router->add('/dashboard/accounts/{pageNumber:[0-9]+}',          'dashboard::accounts');
    $router->add('/dashboard/accounts/orders/{customerID:[0-9]+}',   'dashboard::accountsOrders');
    $router->add('/dashboard/accounts/rmas/{customerID:[0-9]+}',     'dashboard::accountsRmas');
    
    $router->add('/dashboard/survey/add', 'dashboard::surveyAdd');
    $router->add('/dashboard/newsletter-subscribers/{page:[0-9]+}', 'dashboard::newsletterSubscribers');
    
    $router->add('/dashboard/carousel/add',                        'dashboard::carouselAdd');
    $router->add('/dashboard/carousel/edit/{carouselID:[0-9]+}',   'dashboard::carouselEdit');
    $router->add('/dashboard/carousel/delete/{carouselID:[0-9]+}', 'dashboard::carouselDelete');
    
    $router->add('/dashboard/online-users/{pageNumber:[0-9]+}', 'dashboard::onlineUsers');
    
    $router->add('/dashboard/reviews/{pageNumber:[0-9]+}', 'dashboard::reviews');
    
    $router->add('/dashboard/part-images/{pageNumber:[0-9]+}', 'dashboard::partImages');
    
    $router->add('/dashboard/pending-orders/search/{pendingOrderID:[0-9]+}', 'dashboard::pendingOrdersSingle');
    
    $router->add('/dashboard/showcases/edit/{showcaseURL:[a-z0-9\-]+}', 'dashboard::showcasesEdit');
    
    $router->add('/manufacturers/{letter:[a-z]}',                     'manufacturers::letter');
    
    /* manufacturer */
    $router->add('/manufacturer/{manufacturerURL:[a-z0-9\-]+}',                     'manufacturer::manufacturer');
    $router->add('/manufacturer/{manufacturerURL:[a-z0-9\-]+}/{pageNumber:[0-9]+}', 'manufacturer::manufacturer');
    
    /* category routes. */
    $router->add('/category/{sectionURL:[a-z0-9\-]+}',                                                                            'category::section');
    $router->add('/category/{sectionURL:[a-z0-9\-]+}/{categoryURL:[a-z0-9\-]+}',                                                  'category::category');
    $router->add('/category/{sectionURL:[a-z0-9\-]+}/{categoryURL:[a-z0-9\-]+}/{subCategoryURL:[a-z0-9\-]+}',                     'category::subCategory');
    $router->add('/category/{sectionURL:[a-z0-9\-]+}/{categoryURL:[a-z0-9\-]+}/{subCategoryURL:[a-z0-9\-]+}/{pageNumber:[0-9]+}', 'category::subCategory');
    
    /* basket.add routes. */
    $router->add('/basket/add/{partURL:[a-z0-9\-]+}',                   'basket::add');
    $router->add('/basket/add/{partURL:[a-z0-9\-]+}/{quantity:[0-9]+}', 'basket::add');
    $router->add('/basket/add-bundle/{partBundleID:[0-9]+}',            'basket::addBundle');
    
    /* basket.remove */
    $router->add('/basket/remove/{partURL:[a-z0-9\-]+}', 'basket::remove');
    
    $router->add('/feedback/{pageNumber:[0-9]+}', 'feedback::index');
    
    $router->add('/returns/{orderID:[a-zA-Z0-9\-]+}',        'returns::return');
    $router->add('/returns/{orderID:[a-zA-Z0-9\-]+}/submit', 'returns::submit');
    
    $router->add('/res/css/{cssFile:[A-Za-z0-9\-\.]+}', 'res::css');
    $router->add('/res/js/{jsFile:[A-Za-z0-9\-\.]+}',   'res::js');
    
    $router->add('/review/{reviewID:[0-9]+}/helpful',   'reviews::helpful');
    $router->add('/review/{reviewID:[0-9]+}/unhelpful', 'reviews::unhelpful');
    
    $router->add('/survey/{surveyURL:[A-Za-z0-9-]+}', 'survey::survey');
    
    /* dashboard.staff-ips routes. */
    $router->add('/dashboard/staff-ips/add',                               'dashboard::staffIpsAdd');
    $router->addPost('/background/update-staff-ip-status',                 'dashboard::updateIPStatus');
    $router->add('/dashboard/staff-ips/edit/{staffIpURL:[A-Za-z0-9-]+}',   'dashboard::staffIpsEdit');
    $router->add('/dashboard/staff-ips/delete/{staffIpURL:[A-Za-z0-9-]+}', 'dashboard::staffIpsDelete');
    
    $router->add('/showcase/{showcaseURL:[a-z0-9\-]+}', 'showcase::showcase');
    
    $router->add('/sitemap/xml/pages',                     'sitemap::xmlPages');
    $router->add('/sitemap/xml/manufacturers',             'sitemap::xmlManufacturers');
    $router->add('/sitemap/xml/parts/{pageNumber:[0-9]+}', 'sitemap::xmlParts');
    
    $router->add('/guides/{guideURL:[A-Za-z0-9-]+}', 'guides::guide');
    
    $router->add('/api/xml/{page:[0-9]+}', 'api::xml');
    
    $router->add('/clearance/{manufacturerURL:[A-Za-z0-9-]+}',                     'clearance::manufacturer');
    $router->add('/clearance/{manufacturerURL:[A-Za-z0-9-]+}/{pageNumber:[0-9]+}', 'clearance::manufacturer');
    
    $router->add('/tracking/{orderID:[0-9]+}', 'tracking::details');
    
    return $router;
  }
);
 
// Handle the request.
$application = new \Phalcon\Mvc\Application($di);
 
$eventsManager = new \Phalcon\Events\Manager();
$application->setEventsManager($eventsManager);
 
$eventsManager->attach("application:boot", new \PhalconHelpers\ServiceProvider\Aws(
  array(
    'region' => 'eu-west-1'
  )
));
 
echo $application->handle()->getContent();
 
// Just in case there's nothing to commit.
try {
  $logger->commit();
} catch (\Exception $e) {
  
}
#23require_once(/home/ubuntu/partsit-site/app/web.php)
/home/ubuntu/partsit-site/public/index.php (3)
<?php
 
require_once '../app/web.php';
KeyValue
_url/products/dell-65htg/
KeyValue
USERwww-data
HOME/var/www
FCGI_ROLERESPONDER
QUERY_STRING_url=/products/dell-65htg/
REQUEST_METHODGET
CONTENT_TYPE
CONTENT_LENGTH
SCRIPT_FILENAME/home/ubuntu/partsit-site/public/index.php
SCRIPT_NAME/index.php
REQUEST_URI/products/dell-65htg/
DOCUMENT_URI/index.php
DOCUMENT_ROOT/home/ubuntu/partsit-site/public
SERVER_PROTOCOLHTTP/1.1
GATEWAY_INTERFACECGI/1.1
SERVER_SOFTWAREnginx/1.4.6
REMOTE_ADDR172.31.40.162
REMOTE_PORT47798
SERVER_ADDR172.31.47.41
SERVER_PORT443
SERVER_NAMEwww.partsit.com
HTTPSon
REDIRECT_STATUS200
PATH_INFO
PATH_TRANSLATED/home/ubuntu/partsit-site/public
HTTP_HOSTwww.partsit.com
HTTP_ACCEPTtext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODINGx-gzip, gzip, deflate
HTTP_USER_AGENTCCBot/2.0 (http://commoncrawl.org/faq/)
HTTP_X_FORWARDED_FOR54.196.17.193
HTTP_X_FORWARDED_PORT443
HTTP_X_FORWARDED_PROTOhttps
HTTP_CONNECTIONkeep-alive
PHP_SELF/index.php
REQUEST_TIME_FLOAT1495654903.7221
REQUEST_TIME1495654903
#Path
0/home/ubuntu/partsit-site/public/index.php
1/home/ubuntu/partsit-site/app/web.php
2/home/ubuntu/partsit-site/app/startup.php
3/home/ubuntu/partsit-site/vendor/autoload.php
4/home/ubuntu/partsit-site/vendor/composer/autoload_real.php
5/home/ubuntu/partsit-site/vendor/composer/ClassLoader.php
6/home/ubuntu/partsit-site/vendor/composer/include_paths.php
7/home/ubuntu/partsit-site/vendor/composer/autoload_namespaces.php
8/home/ubuntu/partsit-site/vendor/composer/autoload_psr4.php
9/home/ubuntu/partsit-site/vendor/composer/autoload_classmap.php
10/home/ubuntu/partsit-site/vendor/composer/autoload_files.php
11/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/functions_include.php
12/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/functions.php
13/home/ubuntu/partsit-site/vendor/guzzlehttp/psr7/src/functions_include.php
14/home/ubuntu/partsit-site/vendor/guzzlehttp/psr7/src/functions.php
15/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/functions_include.php
16/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/functions.php
17/home/ubuntu/partsit-site/vendor/mtdowling/jmespath.php/src/JmesPath.php
18/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/functions.php
19/home/ubuntu/partsit-site/vendor/swiftmailer/swiftmailer/lib/swift_required.php
20/home/ubuntu/partsit-site/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
21/home/ubuntu/partsit-site/vendor/ircmaxell/password-compat/lib/password.php
22/home/ubuntu/partsit-site/vendor/symfony/polyfill-php55/bootstrap.php
23/home/ubuntu/partsit-site/vendor/symfony/polyfill-php54/bootstrap.php
24/home/ubuntu/partsit-site/vendor/react/promise/src/functions_include.php
25/home/ubuntu/partsit-site/vendor/react/promise/src/functions.php
26/home/ubuntu/partsit-site/vendor/symfony/polyfill-mbstring/bootstrap.php
27/home/ubuntu/partsit-site/vendor/illuminate/support/Illuminate/Support/helpers.php
28/home/ubuntu/partsit-site/app/library/PhalconHelpers/ServiceProvider/Aws.php
29/home/ubuntu/partsit-site/app/controllers/ProductController.php
30/home/ubuntu/partsit-site/app/controllers/ControllerBase.php
31/home/ubuntu/partsit-site/app/library/Auth.php
32/home/ubuntu/partsit-site/app/models/StaffIPs.php
33/home/ubuntu/partsit-site/app/models/BaseModel.php
34/home/ubuntu/partsit-site/app/models/Baskets.php
35/home/ubuntu/partsit-site/app/models/ExchangeRates.php
36/home/ubuntu/partsit-site/app/models/Sections.php
37/home/ubuntu/partsit-site/app/models/Metadata.php
38/home/ubuntu/partsit-site/app/models/Manufacturers.php
39/home/ubuntu/partsit-site/app/models/SystemManufacturers.php
40/home/ubuntu/partsit-site/app/models/OldCategories.php
41/home/ubuntu/partsit-site/app/models/Parts.php
42/home/ubuntu/partsit-site/app/library/PhalconHelpers/Injectable/SQS.php
43/home/ubuntu/partsit-site/app/models/BeanstalkQueueEntry.php
44/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Sdk.php
45/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/ClientInterface.php
46/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Handler/GuzzleV6/GuzzleHandler.php
47/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Client.php
48/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/HandlerStack.php
49/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php
50/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
51/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
52/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php
53/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php
54/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
55/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Middleware.php
56/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php
57/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/data/manifest.json.php
58/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Sqs/SqsClient.php
59/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/AwsClient.php
60/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/AwsClientInterface.php
61/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/HandlerList.php
62/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/ClientResolver.php
63/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Signature/SignatureProvider.php
64/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Endpoint/EndpointProvider.php
65/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/data/endpoints.json.php
66/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Endpoint/PatternEndpointProvider.php
67/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/ApiProvider.php
68/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/Service.php
69/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/AbstractModel.php
70/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/data/sqs/2012-11-05/api-2.json.php
71/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/ShapeMap.php
72/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/Serializer/QuerySerializer.php
73/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/Serializer/QueryParamBuilder.php
74/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/Parser/QueryParser.php
75/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/Parser/AbstractParser.php
76/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/Parser/PayloadParserTrait.php
77/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/Parser/XmlParser.php
78/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/ErrorParser/XmlErrorParser.php
79/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Middleware.php
80/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php
81/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Credentials/Credentials.php
82/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Credentials/CredentialsInterface.php
83/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/FulfilledPromise.php
84/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/PromiseInterface.php
85/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/RetryMiddleware.php
86/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/Validator.php
87/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php
88/home/ubuntu/partsit-site/vendor/guzzlehttp/psr7/src/Uri.php
89/home/ubuntu/partsit-site/vendor/psr/http-message/src/UriInterface.php
90/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Signature/SignatureV4.php
91/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Signature/SignatureInterface.php
92/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Command.php
93/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/CommandInterface.php
94/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/HasDataTrait.php
95/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/Operation.php
96/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/Shape.php
97/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/StructureShape.php
98/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Api/MapShape.php
99/home/ubuntu/partsit-site/vendor/guzzlehttp/psr7/src/Request.php
100/home/ubuntu/partsit-site/vendor/psr/http-message/src/RequestInterface.php
101/home/ubuntu/partsit-site/vendor/psr/http-message/src/MessageInterface.php
102/home/ubuntu/partsit-site/vendor/guzzlehttp/psr7/src/MessageTrait.php
103/home/ubuntu/partsit-site/vendor/guzzlehttp/psr7/src/Stream.php
104/home/ubuntu/partsit-site/vendor/psr/http-message/src/StreamInterface.php
105/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/TaskQueue.php
106/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/Promise.php
107/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php
108/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/RequestOptions.php
109/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php
110/home/ubuntu/partsit-site/vendor/guzzlehttp/psr7/src/Response.php
111/home/ubuntu/partsit-site/vendor/psr/http-message/src/ResponseInterface.php
112/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php
113/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php
114/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php
115/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php
116/home/ubuntu/partsit-site/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php
117/home/ubuntu/partsit-site/vendor/guzzlehttp/promises/src/RejectedPromise.php
118/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Sqs/Exception/SqsException.php
119/home/ubuntu/partsit-site/vendor/aws/aws-sdk-php/src/Exception/AwsException.php
Memory
Usage3145728