PocketMine-MP 5.44.3 git-327e8a1690982f1ac3634944d705ebad5d91f4ad
Loading...
Searching...
No Matches
WhiskerScopeDataSummary.php
1<?php
2
3/*
4 * This file is part of BedrockProtocol.
5 * Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6 *
7 * BedrockProtocol is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 */
12
13declare(strict_types=1);
14
15namespace pocketmine\network\mcpe\protocol\types;
16
17use pmmp\encoding\ByteBufferReader;
18use pmmp\encoding\ByteBufferWriter;
19use pmmp\encoding\LE;
21
23
24 public function __construct(
25 private string $label,
26 private string $indentation,
27 private int $totalHighCostNS,
28 private int $totalMidCostNS,
29 private int $totalLowCostNS,
30 ){}
31
32 public function getLabel() : string{ return $this->label; }
33
34 public function getIndentation() : string{ return $this->indentation; }
35
36 public function getTotalHighCostNS() : int{ return $this->totalHighCostNS; }
37
38 public function getTotalMidCostNS() : int{ return $this->totalMidCostNS; }
39
40 public function getTotalLowCostNS() : int{ return $this->totalLowCostNS; }
41
42 public static function read(ByteBufferReader $in) : self{
43 $label = CommonTypes::getString($in);
44 $indentation = CommonTypes::getString($in);
45 $totalHighCostNS = LE::readUnsignedLong($in);
46 $totalMidCostNS = LE::readUnsignedLong($in);
47 $totalLowCostNS = LE::readUnsignedLong($in);
48
49 return new self(
50 $label,
51 $indentation,
52 $totalHighCostNS,
53 $totalMidCostNS,
54 $totalLowCostNS
55 );
56 }
57
58 public function write(ByteBufferWriter $out) : void{
59 CommonTypes::putString($out, $this->label);
60 CommonTypes::putString($out, $this->indentation);
61 LE::writeUnsignedLong($out, $this->totalHighCostNS);
62 LE::writeUnsignedLong($out, $this->totalMidCostNS);
63 LE::writeUnsignedLong($out, $this->totalLowCostNS);
64 }
65}