/** * @covers ::fromString * @covers ::parseString * @covers ::parseRange * @dataProvider provideIllegalRangeStrings * * @expectedException GanbaroDigital\TextTools\Exceptions\E4xx_CannotParseRange */ public function testThrowsExceptionWhenIllegalRangeReceived($range) { // ---------------------------------------------------------------- // setup your test // ---------------------------------------------------------------- // perform the change ExpandRange::fromString($range); }
/** * 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); }