/** * @covers ::from * @dataProvider provideRangesToExpand */ public function testCanCallStatically($range, $expectedResult) { // ---------------------------------------------------------------- // setup your test // ---------------------------------------------------------------- // perform the change $actualResult = ExpandRange::from($range); // ---------------------------------------------------------------- // test the results $this->assertEquals($expectedResult, $actualResult); }
/** * extract the columns from an array of strings * * @param array|Traversable $data * the data to be filtered * @param string $columnNos * the columns to be extracted * @param string $columnSeparator * the column delimiter * @return array * a list of the filtered strings */ public static function fromTraversable($data, $columnNos, $columnSeparator) { // robustness! RequireTraversable::checkMixed($data, E4xx_UnsupportedType::class); RequireStringy::checkMixed($columnNos, E4xx_UnsupportedType::class); RequireStringy::checkMixed($columnSeparator, E4xx_UnsupportedType::class); $colsToMatch = array_flip(ExpandRange::from($columnNos)); return self::filterArray($data, $columnSeparator, $colsToMatch); }