| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 49 | 15 | protected function parsePaddingData(string $data): int |
|
| 50 | { |
||
| 51 | 15 | if ($this->flags->hasFlag(Flag::PADDED)) { |
|
| 52 | 6 | if (!$unpack = @unpack('Cpadding_length', substr($data, 0, 1))) { |
|
| 53 | 1 | throw new \Hyphper\Frame\Exception\InvalidFrameException("Invalid Padding Data"); |
|
| 54 | } |
||
| 55 | |||
| 56 | 5 | $this->padding_length = $unpack['padding_length']; |
|
| 57 | |||
| 58 | 5 | return static::IS_PADDED; |
|
| 59 | } |
||
| 60 | |||
| 61 | 9 | return static::IS_NOT_PADDED; |
|
| 62 | } |
||
| 63 | } |
||
| 64 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: