/** * @dataProvider combineProvider */ public function testFlatten($count, $params, $message = '') { $flat = Arrays::flatten($params); $this->assertCount($count, $flat); foreach ($flat as $param) { $this->assertFalse(is_array($param), $message); } }
/** * @param \nochso\WriteMe\Interfaces\Placeholder $placeholder * * @return \nochso\WriteMe\Reflection\Method[] Methods belonging to a placeholder. */ public function getMethodsForPlaceholder(Placeholder $placeholder) { $methods = []; /** @var \nochso\WriteMe\Reflection\Method $method */ foreach (Arrays::flatten($this->methods) as $method) { if ($method->getPlaceholder() === $placeholder) { $methods[] = $method; } } return $methods; }
public function getNormalizedOperationsPerUnit(UnitResult $unitResult) { $allResults = Arrays::flatten($unitResult->getResults()); $minOpsPerSec = PHP_INT_MAX; /** @var Result $result */ foreach ($allResults as $result) { $minOpsPerSec = min($minOpsPerSec, $result->getOperationsPerSecond()); } $opsPerUnit = $this->getOperationsPerSecond(); $unit = 's'; if ($minOpsPerSec < 1) { $minOpsPerSec *= 60; $opsPerUnit *= 60; $unit = 'm'; } if ($minOpsPerSec < 1) { $opsPerUnit *= 60; $unit = 'h'; } return $this->formatNumber($opsPerUnit) . '/' . $unit; }