public final function toClass(string $class): ?array
    {
        $data = null;
        if (!empty($this->data)) {
            $data = $this->data;
            foreach ($data as &$dat) {
                $datClass = new $class();
                foreach ((array) $dat as $key => $value) {
                    $datClass->{$key} = $value;
                }
                $dat = $datClass;
            }
        }

        return $data;
    }
public final function toClass(string $class): ?array
    {
        $data = null;
        if (!empty($this->data)) {
            $data = $this->data;
            foreach ($data as &$dat) {
                $datClass = new $class();
                foreach ((array) $dat as $key => $value) {
                    $datClass->{$key} = $value;
                }
                $dat = $datClass;
            }
        }

        return $data;
    }
public final function toClass ( string $ class ) : ? array { $ data = null ; if ( ! empty ( $ this -> data ) ) { $ data = $ this -> data ; foreach ( $ data as & $ dat ) { $ datClass = new $ class ( ) ; foreach ( ( array ) $ dat as $ key => $ value ) { $ datClass -> { $ key } = $ value ; } $ dat = $ datClass ; } } return $ data ; }
To class.
@param  string $class
@return ?array
To class .