for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Spires\Plugins\BangMessage\Inbound;
use Spires\Plugins\Message\Inbound\Message;
class BangMessage extends Message
{
/**
* The bang command
* e.g. the message "!somersault mouse acrobat"
* would return "somersault" as the bang command
*
* @return string
*/
public function bangCommand()
list($bangCommand, $bangText) = explode(' ', $this->text(), 2);
$bangText
list($first,,$third)
This checks looks for assignemnts to variables using the list(...) function, where not all assigned variables are subsequently used.
list(...)
Consider the following code example.
<?php function returnThreeValues() { return array('a', 'b', 'c'); } list($a, $b, $c) = returnThreeValues(); print $a . " - " . $c;
Only the variables $a and $c are used. There was no need to assign $b.
$a
$c
$b
Instead, the list call could have been.
list($a,, $c) = returnThreeValues();
return ltrim($bangCommand, '!');
}
* The bang text
* would return "mouse acrobat" as the bang text
public function bangText()
$bangCommand
return $bangText;
This checks looks for assignemnts to variables using the
list(...)
function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$a
and$c
are used. There was no need to assign$b
.Instead, the list call could have been.