From a7577ecff09263623370ddf86cfa9491a32485e1 Mon Sep 17 00:00:00 2001 From: Thomas Kerin Date: Sat, 30 Dec 2017 00:23:53 +0000 Subject: [PATCH] use instanceof in Parser constructor --- src/Buffertools/Parser.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Buffertools/Parser.php b/src/Buffertools/Parser.php index 5ca477c..22d1af2 100644 --- a/src/Buffertools/Parser.php +++ b/src/Buffertools/Parser.php @@ -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; } }