File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -259,25 +259,28 @@ public function addEciSegment(int $encoding, string $data):static{
259259 $ eciCharset = new ECICharset ($ encoding );
260260 // get charset name
261261 $ eciCharsetName = $ eciCharset ->getName ();
262- // convert the string to the given charset
263- if ($ eciCharsetName !== null ){
264- $ data = mb_convert_encoding ($ data , $ eciCharsetName , mb_internal_encoding ());
265262
266- if ($ data === false ){
267- throw new QRCodeException ('mb_convert_encoding() error ' ); // @codeCoverageIgnore
268- }
263+ if ($ eciCharsetName === null ){
264+ throw new QRCodeException ('unable to add ECI segment ' );
265+ }
269266
270- return $ this
271- ->addEciDesignator ($ eciCharset ->getID ())
272- ->addByteSegment ($ data )
273- ;
267+ // convert the string to the given charset
268+ $ data = mb_convert_encoding ($ data , $ eciCharsetName , mb_internal_encoding ());
269+
270+ if ($ data === false ){
271+ throw new QRCodeException ('mb_convert_encoding() error ' ); // @codeCoverageIgnore
274272 }
275273
276- throw new QRCodeException ('unable to add ECI segment ' );
274+ return $ this
275+ ->addEciDesignator ($ eciCharset ->getID ())
276+ ->addByteSegment ($ data )
277+ ;
277278 }
278279
279280 /**
280281 * Reads a QR Code from a given file
282+ *
283+ * @codeCoverageIgnore
281284 */
282285 public function readFromFile (string $ path ):DecoderResult {
283286 return $ this ->readFromSource ($ this ->luminanceSourceFQN ::fromFile ($ path , $ this ->options ));
You can’t perform that action at this time.
0 commit comments