| Total Complexity | 6 |
| Total Lines | 74 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 20 | class Response |
||
| 21 | { |
||
| 22 | /** @var string */ |
||
| 23 | protected $raw; |
||
| 24 | |||
| 25 | /** @var int */ |
||
| 26 | protected $code; |
||
| 27 | |||
| 28 | /** @var string */ |
||
| 29 | protected $message; |
||
| 30 | |||
| 31 | /** @var bool */ |
||
| 32 | protected $multiline; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param string $reply The raw FTP reply string. |
||
| 36 | */ |
||
| 37 | public function __construct($reply) |
||
| 38 | { |
||
| 39 | $parser = new ResponseParser($reply); |
||
| 40 | $response = $parser->parseToArray(); |
||
| 41 | |||
| 42 | $this->raw = $reply; |
||
| 43 | $this->code = $response['code']; |
||
|
|
|||
| 44 | $this->message = $response['message']; |
||
| 45 | $this->multiline = $response['multiline']; |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Gets the raw (original) reply string sent by the server. |
||
| 50 | * |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | public function getRaw() |
||
| 54 | { |
||
| 55 | return $this->raw; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Gets reply code. |
||
| 60 | * |
||
| 61 | * @return int |
||
| 62 | */ |
||
| 63 | public function getCode() |
||
| 64 | { |
||
| 65 | return $this->code; |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Gets reply message. |
||
| 70 | * |
||
| 71 | * @return string |
||
| 72 | */ |
||
| 73 | public function getMessage() |
||
| 74 | { |
||
| 75 | return $this->message; |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * Whether the FTP response consists of multiple lines or not. |
||
| 80 | * |
||
| 81 | * @return bool |
||
| 82 | */ |
||
| 83 | public function isMultiline() |
||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @return bool |
||
| 90 | */ |
||
| 91 | public function hasCode() |
||
| 94 | } |
||
| 95 | } |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountIdthat can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theidproperty of an instance of theAccountclass. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.