lib/Loop/Driver.php
public function getInfo(): array
    {
        $watchers = [
            "referenced" => 0,
            "unreferenced" => 0,
        ];

        $defer = $delay = $repeat = $onReadable = $onWritable = $onSignal = [
            "enabled" => 0,
            "disabled" => 0,
        ];

        foreach ($this->watchers as $watcher) {
            switch ($watcher->type) {
                case Watcher::READABLE:
                    $array = &$onReadable;
                    break;
                case Watcher::WRITABLE:
                    $array = &$onWritable;
                    break;
                case Watcher::SIGNAL:
                    $array = &$onSignal;
                    break;
                case Watcher::DEFER:
                    $array = &$defer;
                    break;
                case Watcher::DELAY:
                    $array = &$delay;
                    break;
                case Watcher::REPEAT:
                    $array = &$repeat;
                    break;

                default:
                    // @codeCoverageIgnoreStart
                    throw new \Error("Unknown watcher type");
                // @codeCoverageIgnoreEnd
            }

            if ($watcher->enabled) {
                ++$array["enabled"];

                if ($watcher->referenced) {
                    ++$watchers["referenced"];
                } else {
                    ++$watchers["unreferenced"];
                }
            } else {
                ++$array["disabled"];
            }
        }

        return [
            "enabled_watchers" => $watchers,
            "defer" => $defer,
            "delay" => $delay,
            "repeat" => $repeat,
            "on_readable" => $onReadable,
            "on_writable" => $onWritable,
            "on_signal" => $onSignal,
            "running" => (bool) $this->running,
        ];
    }
public function getInfo(): array
    {
        $watchers = [
            "referenced" => 0,
            "unreferenced" => 0,
        ];

        $defer = $delay = $repeat = $onReadable = $onWritable = $onSignal = [
            "enabled" => 0,
            "disabled" => 0,
        ];

        foreach ($this->watchers as $watcher) {
            switch ($watcher->type) {
                case Watcher::READABLE:
                    $array = &$onReadable;
                    break;
                case Watcher::WRITABLE:
                    $array = &$onWritable;
                    break;
                case Watcher::SIGNAL:
                    $array = &$onSignal;
                    break;
                case Watcher::DEFER:
                    $array = &$defer;
                    break;
                case Watcher::DELAY:
                    $array = &$delay;
                    break;
                case Watcher::REPEAT:
                    $array = &$repeat;
                    break;

                default:
                    // @codeCoverageIgnoreStart
                    throw new \Error("Unknown watcher type");
                // @codeCoverageIgnoreEnd
            }

            if ($watcher->enabled) {
                ++$array["enabled"];

                if ($watcher->referenced) {
                    ++$watchers["referenced"];
                } else {
                    ++$watchers["unreferenced"];
                }
            } else {
                ++$array["disabled"];
            }
        }

        return [
            "enabled_watchers" => $watchers,
            "defer" => $defer,
            "delay" => $delay,
            "repeat" => $repeat,
            "on_readable" => $onReadable,
            "on_writable" => $onWritable,
            "on_signal" => $onSignal,
            "running" => (bool) $this->running,
        ];
    }
public function getInfo ( ) : array { $ watchers = [ "referenced" => 0 , "unreferenced" => 0 , ] ; $ defer = $ delay = $ repeat = $ onReadable = $ onWritable = $ onSignal = [ "enabled" => 0 , "disabled" => 0 , ] ; foreach ( $ this -> watchers as $ watcher ) { switch ( $ watcher -> type ) { case Watcher :: READABLE : $ array = & $ onReadable ; break ; case Watcher :: WRITABLE : $ array = & $ onWritable ; break ; case Watcher :: SIGNAL : $ array = & $ onSignal ; break ; case Watcher :: DEFER : $ array = & $ defer ; break ; case Watcher :: DELAY : $ array = & $ delay ; break ; case Watcher :: REPEAT : $ array = & $ repeat ; break ; default : // @codeCoverageIgnoreStart throw new \ Error ( "Unknown watcher type" ) ; // @codeCoverageIgnoreEnd } if ( $ watcher -> enabled ) { ++ $ array [ "enabled" ] ; if ( $ watcher -> referenced ) { ++ $ watchers [ "referenced" ] ; } else { ++ $ watchers [ "unreferenced" ] ; } } else { ++ $ array [ "disabled" ] ; } } return [ "enabled_watchers" => $ watchers , "defer" => $ defer , "delay" => $ delay , "repeat" => $ repeat , "on_readable" => $ onReadable , "on_writable" => $ onWritable , "on_signal" => $ onSignal , "running" => ( bool ) $ this -> running , ] ; }
Retrieve an associative array of information about the event loop driver.

The returned array MUST contain the following data describing the driver's currently registered watchers:

[
"defer"            => ["enabled" => int, "disabled" => int],
"delay"            => ["enabled" => int, "disabled" => int],
"repeat"           => ["enabled" => int, "disabled" => int],
"on_readable"      => ["enabled" => int, "disabled" => int],
"on_writable"      => ["enabled" => int, "disabled" => int],
"on_signal"        => ["enabled" => int, "disabled" => int],
"enabled_watchers" => ["referenced" => int, "unreferenced" => int],
"running"          => bool
];

Implementations MAY optionally add more information in the array but at minimum the above `key => value` format
MUST always be provided.

@return array Statistics about the loop in the described format.
Retrieve an associative array of information about the event loop driver .