public function collectConsole()
    {
        if (!$this->isEnabled()) {
            return;
        }


        $this->meta = [
            'time'   => microtime(true),
            'method' => 'CLI',
            'uri'    => isset($_SERVER['argv']) ? implode(' ', $_SERVER['argv']) : null,
            'ip'     => isset($_SERVER['SSH_CLIENT']) ? $_SERVER['SSH_CLIENT'] : null,
        ];

        foreach ($this->collectors as $name => $collector) {
            $this->data[$name] = $collector->collect();
        }

        // Remove all invalid (non UTF-8) characters
        array_walk_recursive(
            $this->data,
            function (&$item) {
                if (is_string($item) && !mb_check_encoding($item, 'UTF-8')) {
                    $item = mb_convert_encoding($item, 'UTF-8', 'UTF-8');
                }
            }
        );


        $this->persistData();


        return $this->data;
    }
public function collectConsole()
    {
        if (!$this->isEnabled()) {
            return;
        }


        $this->meta = [
            'time'   => microtime(true),
            'method' => 'CLI',
            'uri'    => isset($_SERVER['argv']) ? implode(' ', $_SERVER['argv']) : null,
            'ip'     => isset($_SERVER['SSH_CLIENT']) ? $_SERVER['SSH_CLIENT'] : null,
        ];

        foreach ($this->collectors as $name => $collector) {
            $this->data[$name] = $collector->collect();
        }

        // Remove all invalid (non UTF-8) characters
        array_walk_recursive(
            $this->data,
            function (&$item) {
                if (is_string($item) && !mb_check_encoding($item, 'UTF-8')) {
                    $item = mb_convert_encoding($item, 'UTF-8', 'UTF-8');
                }
            }
        );


        $this->persistData();


        return $this->data;
    }
public function collectConsole ( ) { if ( ! $ this -> isEnabled ( ) ) { return ; } $ this -> meta = [ 'time' => microtime ( true ) , 'method' => 'CLI' , 'uri' => isset ( $ _SERVER [ 'argv' ] ) ? implode ( ' ' , $ _SERVER [ 'argv' ] ) : null , 'ip' => isset ( $ _SERVER [ 'SSH_CLIENT' ] ) ? $ _SERVER [ 'SSH_CLIENT' ] : null , ] ; foreach ( $ this -> collectors as $ name => $ collector ) { $ this -> data [ $ name ] = $ collector -> collect ( ) ; } // Remove all invalid (non UTF-8) characters array_walk_recursive ( $ this -> data , function ( & $ item ) { if ( is_string ( $ item ) && ! mb_check_encoding ( $ item , 'UTF-8' ) ) { $ item = mb_convert_encoding ( $ item , 'UTF-8' , 'UTF-8' ) ; } } ) ; $ this -> persistData ( ) ; return $ this -> data ; }
Collect data in a CLI request

@return array
Collect data in a CLI request