0 follower

Final Class Yiisoft\Yii\Debug\Collector\Stream\HttpStreamCollector

InheritanceYiisoft\Yii\Debug\Collector\Stream\HttpStreamCollector
ImplementsYiisoft\Yii\Debug\Collector\SummaryCollectorInterface
Uses TraitsYiisoft\Yii\Debug\Collector\CollectorTrait

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( array $ignoredPathPatterns = [], array $ignoredClasses = [], array $ignoredUrls = [] )
$ignoredPathPatterns array
$ignoredClasses array
$ignoredUrls array

                public function __construct(
    /**
     * @var string[]
     */
    private readonly array $ignoredPathPatterns = [],
    /**
     * @var string[]
     */
    private readonly array $ignoredClasses = [],
    /**
     * @var string[]
     */
    private readonly array $ignoredUrls = []
) {
}

            
collect() public method

public void collect ( string $operation, string $path, array $args )
$operation string
$path string
$args array

                public function collect(string $operation, string $path, array $args): void
{
    if (!$this->isActive()) {
        return;
    }
    $this->requests[$operation][] = [
        'uri' => $path,
        'args' => $args,
    ];
}

            
getCollected() public method

public array getCollected ( )

                public function getCollected(): array
{
    if (!$this->isActive()) {
        return [];
    }
    return $this->requests;
}

            
getName() public method
public string getName ( )

                public function getName(): string
{
    return self::class;
}

            
getSummary() public method

public array getSummary ( )

                public function getSummary(): array
{
    if (!$this->isActive()) {
        return [];
    }
    return [
        'streams' => array_merge(
            ...array_map(
                fn (string $operation) => [
                    $operation => count($this->requests[$operation]),
                ],
                array_keys($this->requests)
            )
        ),
    ];
}

            
shutdown() public method

public void shutdown ( )

                public function shutdown(): void
{
    HttpStreamProxy::unregister();
    HttpStreamProxy::$collector = null;
    $this->reset();
    $this->isActive = false;
}

            
startup() public method

public void startup ( )

                public function startup(): void
{
    $this->isActive = true;
    HttpStreamProxy::register();
    HttpStreamProxy::$ignoredPathPatterns = $this->ignoredPathPatterns;
    HttpStreamProxy::$ignoredClasses = $this->ignoredClasses;
    HttpStreamProxy::$ignoredUrls = $this->ignoredUrls;
    HttpStreamProxy::$collector = $this;
    // TODO: add cURL support, maybe through proxy?
    // https://github.com/php/php-src/issues/10509
    //stream_context_set_default([
    //    'http' => [
    //        'proxy' => 'yii-debug-http://127.0.0.1',
    //    ],
    //]);
}