for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Thruster\Component\Dns;
/**
* Class RecordBag
*
* @package Thruster\Component\Dns
* @author Aurimas Niekis <[email protected]>
*/
class RecordBag
{
* @var array
private $records;
public function __construct()
$this->records = [];
}
public function set(int $currentTime, Record $record)
$this->records[$record->getData()] = [$currentTime + $record->getTtl(), $record];
public function all() : array
return array_values(
array_map(
function ($value) {
list($expiresAt, $record) = $value;
$expiresAt
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 $record;
},
$this->records
)
);
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.