for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Class QRString
*
* @filesource QRString.php
* @created 05.12.2015
* @package chillerlan\QRCode\Output
* @author Smiley <[email protected]>
* @copyright 2015 Smiley
* @license MIT
*/
namespace chillerlan\QRCode\Output;
use chillerlan\QRCode\QRCode;
class QRString extends QROutputAbstract{
protected $optionsInterface = QRStringOptions::class;
protected $types = [
QRCode::OUTPUT_STRING_TEXT,
QRCode::OUTPUT_STRING_JSON,
];
* @return string
public function dump(){
switch($this->options->type){
case QRCode::OUTPUT_STRING_TEXT: return $this->toString();
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.
switch ($expr) { case "A": doSomething(); //right break; case "B": doSomethingElse(); //wrong break;
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.
As per the PSR-2 coding standard, the break (or other terminating) statement must be on a line of its own.
break
switch ($expr) { case "A": doSomething(); break; //wrong case "B": doSomething(); break; //right case "C:": doSomething(); return true; //right }
case QRCode::OUTPUT_STRING_JSON:
default:
return json_encode($this->matrix);
protected function toString(){
$str = '';
foreach($this->matrix as $row){
foreach($row as $col){
$str .= $col
? $this->options->textDark
: $this->options->textLight;
$str .= $this->options->eol;
return $str;
According to the PSR-2, the body of a case statement must start on the line immediately following the case statement.
}
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.