Skip to content

Commit

Permalink
use instanceof in Parser constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Kerin committed Dec 30, 2017
1 parent 2c6f5ea commit 1f855e7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Buffertools/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ class Parser
*/
public function __construct(BufferInterface $input = null)
{
$this->position = 0;

if (null === $input) {
$this->string = '';
$this->size = 0;
} else {
if ($input instanceof BufferInterface) {
$this->string = $input->getBinary();
$this->size = $input->getSize();
} else {
$this->string = '';
$this->size = 0;
}
}

Expand Down

0 comments on commit 1f855e7

Please sign in to comment.